ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* filter module's inline command and supressed spacing
@ 2014-12-30  9:00 Piotr Kopszak
  2014-12-30  9:28 ` Piotr Kopszak
  2015-01-19 15:46 ` Aditya Mahajan
  0 siblings, 2 replies; 5+ messages in thread
From: Piotr Kopszak @ 2014-12-30  9:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello list,

It looks like a bug in the filter module, but maybe I'm doing
something wrong. Any help will be greatly appreciated. When using the
\inlinepandoc command in the first paragraph below the space at the
end of the paragraph in "życiaA. Mickiewicza" is supressed when it
should be "życia A. Mickiewicza". This does not happen when using
pandoc environment. If you want to run the minimal example you have to
make sure you got the recent pandoc which supports twiki input format
and create the "output" subdirectory in your working directory.

Best

Piotr
----------------------------------------------------------------------------
\usemodule[filter]
\defineexternalfilter
  [pandoc]
  [
    filter={pandoc -f \externalfilterparameter{format} -t context
                   -o \externalfilteroutputfile},
    format=twiki,
    directory=output,
  ]
\starttext
Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
nr nr 118 s. 2.  (\inlinepandoc{w artykule L*** (E.
Januszkiewicza)  "Notatki wspomnień z życia A. Mickiewicza"}).

\startpandoc
Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
nr nr 118 s. 2.  (w artykule L*** (E. Januszkiewicza)
"Notatki wspomnień z życia A. Mickiewicza").
\stoppandoc
\stoptext
---------------------------------------------------------------------------------

-- 
http://okle.pl
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: filter module's inline command and supressed spacing
  2014-12-30  9:00 filter module's inline command and supressed spacing Piotr Kopszak
@ 2014-12-30  9:28 ` Piotr Kopszak
  2015-01-01 22:14   ` Mark Szepieniec
  2015-01-19 15:46 ` Aditya Mahajan
  1 sibling, 1 reply; 5+ messages in thread
From: Piotr Kopszak @ 2014-12-30  9:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

P.S.

Silly of me not to check ConTeXt version first. Anyway, the problem
persists with most recent ConTeXt although different errors are
produced. The space is supressed
in 'Januszkiewicza)"Notatki' and html entities are not interpreted
properly when using \inlinepandoc.

2014-12-30 10:00 GMT+01:00 Piotr Kopszak <kopszak@gmail.com>:
> Hello list,
>
> It looks like a bug in the filter module, but maybe I'm doing
> something wrong. Any help will be greatly appreciated. When using the
> \inlinepandoc command in the first paragraph below the space at the
> end of the paragraph in "życiaA. Mickiewicza" is supressed when it
> should be "życia A. Mickiewicza". This does not happen when using
> pandoc environment. If you want to run the minimal example you have to
> make sure you got the recent pandoc which supports twiki input format
> and create the "output" subdirectory in your working directory.
>
> Best
>
> Piotr
> ----------------------------------------------------------------------------
> \usemodule[filter]
> \defineexternalfilter
>   [pandoc]
>   [
>     filter={pandoc -f \externalfilterparameter{format} -t context
>                    -o \externalfilteroutputfile},
>     format=twiki,
>     directory=output,
>   ]
> \starttext
> Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
> perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
> 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
> nr nr 118 s. 2.  (\inlinepandoc{w artykule L&#42;&#42;&#42; (E.
> Januszkiewicza)  "Notatki wspomnień z życia A. Mickiewicza"}).
>
> \startpandoc
> Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
> perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
> 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
> nr nr 118 s. 2.  (w artykule L&#42;&#42;&#42; (E. Januszkiewicza)
> "Notatki wspomnień z życia A. Mickiewicza").
> \stoppandoc
> \stoptext
> ---------------------------------------------------------------------------------
>
> --
> http://okle.pl



-- 
http://okle.pl
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: filter module's inline command and supressed spacing
  2014-12-30  9:28 ` Piotr Kopszak
@ 2015-01-01 22:14   ` Mark Szepieniec
  2015-01-02 12:48     ` Piotr Kopszak
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Szepieniec @ 2015-01-01 22:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2998 bytes --]

Hi Piotr,

maybe you can try opening an issue in the code's repository:
https://github.com/adityam/filter/issues

On Tue, Dec 30, 2014 at 10:28 AM, Piotr Kopszak <kopszak@gmail.com> wrote:

> P.S.
>
> Silly of me not to check ConTeXt version first. Anyway, the problem
> persists with most recent ConTeXt although different errors are
> produced. The space is supressed
> in 'Januszkiewicza)"Notatki' and html entities are not interpreted
> properly when using \inlinepandoc.
>
> 2014-12-30 10:00 GMT+01:00 Piotr Kopszak <kopszak@gmail.com>:
> > Hello list,
> >
> > It looks like a bug in the filter module, but maybe I'm doing
> > something wrong. Any help will be greatly appreciated. When using the
> > \inlinepandoc command in the first paragraph below the space at the
> > end of the paragraph in "życiaA. Mickiewicza" is supressed when it
> > should be "życia A. Mickiewicza". This does not happen when using
> > pandoc environment. If you want to run the minimal example you have to
> > make sure you got the recent pandoc which supports twiki input format
> > and create the "output" subdirectory in your working directory.
> >
> > Best
> >
> > Piotr
> >
> ----------------------------------------------------------------------------
> > \usemodule[filter]
> > \defineexternalfilter
> >   [pandoc]
> >   [
> >     filter={pandoc -f \externalfilterparameter{format} -t context
> >                    -o \externalfilteroutputfile},
> >     format=twiki,
> >     directory=output,
> >   ]
> > \starttext
> > Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
> > perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
> > 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
> > nr nr 118 s. 2.  (\inlinepandoc{w artykule L&#42;&#42;&#42; (E.
> > Januszkiewicza)  "Notatki wspomnień z życia A. Mickiewicza"}).
> >
> > \startpandoc
> > Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
> > perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
> > 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
> > nr nr 118 s. 2.  (w artykule L&#42;&#42;&#42; (E. Januszkiewicza)
> > "Notatki wspomnień z życia A. Mickiewicza").
> > \stoppandoc
> > \stoptext
> >
> ---------------------------------------------------------------------------------
> >
> > --
> > http://okle.pl
>
>
>
> --
> http://okle.pl
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 4294 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: filter module's inline command and supressed spacing
  2015-01-01 22:14   ` Mark Szepieniec
@ 2015-01-02 12:48     ` Piotr Kopszak
  0 siblings, 0 replies; 5+ messages in thread
From: Piotr Kopszak @ 2015-01-02 12:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users

OK, will do so.

Best

Piotr

2015-01-01 23:14 GMT+01:00 Mark Szepieniec <mszepien@gmail.com>:
> Hi Piotr,
>
> maybe you can try opening an issue in the code's repository:
> https://github.com/adityam/filter/issues
>
> On Tue, Dec 30, 2014 at 10:28 AM, Piotr Kopszak <kopszak@gmail.com> wrote:
>>
>> P.S.
>>
>> Silly of me not to check ConTeXt version first. Anyway, the problem
>> persists with most recent ConTeXt although different errors are
>> produced. The space is supressed
>> in 'Januszkiewicza)"Notatki' and html entities are not interpreted
>> properly when using \inlinepandoc.
>>
>> 2014-12-30 10:00 GMT+01:00 Piotr Kopszak <kopszak@gmail.com>:
>> > Hello list,
>> >
>> > It looks like a bug in the filter module, but maybe I'm doing
>> > something wrong. Any help will be greatly appreciated. When using the
>> > \inlinepandoc command in the first paragraph below the space at the
>> > end of the paragraph in "życiaA. Mickiewicza" is supressed when it
>> > should be "życia A. Mickiewicza". This does not happen when using
>> > pandoc environment. If you want to run the minimal example you have to
>> > make sure you got the recent pandoc which supports twiki input format
>> > and create the "output" subdirectory in your working directory.
>> >
>> > Best
>> >
>> > Piotr
>> >
>> > ----------------------------------------------------------------------------
>> > \usemodule[filter]
>> > \defineexternalfilter
>> >   [pandoc]
>> >   [
>> >     filter={pandoc -f \externalfilterparameter{format} -t context
>> >                    -o \externalfilteroutputfile},
>> >     format=twiki,
>> >     directory=output,
>> >   ]
>> > \starttext
>> > Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
>> > perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
>> > 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
>> > nr nr 118 s. 2.  (\inlinepandoc{w artykule L&#42;&#42;&#42; (E.
>> > Januszkiewicza)  "Notatki wspomnień z życia A. Mickiewicza"}).
>> >
>> > \startpandoc
>> > Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
>> > perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
>> > 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
>> > nr nr 118 s. 2.  (w artykule L&#42;&#42;&#42; (E. Januszkiewicza)
>> > "Notatki wspomnień z życia A. Mickiewicza").
>> > \stoppandoc
>> > \stoptext
>> >
>> > ---------------------------------------------------------------------------------
>> >
>> > --
>> > http://okle.pl
>>
>>
>>
>> --
>> http://okle.pl
>>
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to
>> the Wiki!
>>
>> maillist : ntg-context@ntg.nl /
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
>> archive  : http://foundry.supelec.fr/projects/contextrev/
>> wiki     : http://contextgarden.net
>>
>> ___________________________________________________________________________________
>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________



-- 
http://okle.pl
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: filter module's inline command and supressed spacing
  2014-12-30  9:00 filter module's inline command and supressed spacing Piotr Kopszak
  2014-12-30  9:28 ` Piotr Kopszak
@ 2015-01-19 15:46 ` Aditya Mahajan
  1 sibling, 0 replies; 5+ messages in thread
From: Aditya Mahajan @ 2015-01-19 15:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3023 bytes --]

On Tue, 30 Dec 2014, Piotr Kopszak wrote:

> Hello list,
>
> It looks like a bug in the filter module, but maybe I'm doing
> something wrong. Any help will be greatly appreciated. When using the
> \inlinepandoc command in the first paragraph below the space at the
> end of the paragraph in "życiaA. Mickiewicza" is supressed when it
> should be "życia A. Mickiewicza". This does not happen when using
> pandoc environment. If you want to run the minimal example you have to
> make sure you got the recent pandoc which supports twiki input format
> and create the "output" subdirectory in your working directory.
>
> Best
>
> Piotr
> ----------------------------------------------------------------------------
> \usemodule[filter]
> \defineexternalfilter
>  [pandoc]
>  [
>    filter={pandoc -f \externalfilterparameter{format} -t context
>                   -o \externalfilteroutputfile},
>    format=twiki,
>    directory=output,
>  ]
> \starttext
> Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
> perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
> 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
> nr nr 118 s. 2.  (\inlinepandoc{w artykule L&#42;&#42;&#42; (E.
> Januszkiewicza)  "Notatki wspomnień z życia A. Mickiewicza"}).
>
> \startpandoc
> Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
> perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
> 1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
> nr nr 118 s. 2.  (w artykule L&#42;&#42;&#42; (E. Januszkiewicza)
> "Notatki wspomnień z życia A. Mickiewicza").
> \stoppandoc
> \stoptext

Sorry for the late reply.

Short answer: Change \defineexternalfilter to (add --no-wrap):

fineexternalfilter
   [pandoc]
   [
     filter={pandoc --no-wrap -f \externalfilterparameter{format} -t 
context
                    -o \externalfilteroutputfile},
     format=twiki,
     directory=output,
   ]


Long answer: This is what is happening.

Normally, when an external filter like pandoc creates an output, it adds a 
`\n` at the end of the last line. This leads to an empty line when the 
file is read back in ConTeXt. To prevent that I set \endlinechar=-1 in the 
inline mode.

However, this also means that the linebreak at the end of every line is 
ignored. Typically this is not a problem because you expect \inline<...> 
snippets to be short.

But pandoc formats its output to 80 characters. So, the example that you 
gave is formatted as:

-----
w artykule L*** (E.Januszkiewicza) \quotation{Notatki wspomnień z życia
A. Mickiewicza}
----

When reading it, the space at the end of 'zycia' is ignored.

I can try not setting \endlinechar=-1, and adding \removeunwantedspaces 
after reading a file, but this will require some extensive testing. An 
easier solution is to add --no-wrap option to pandoc, so that pandoc does 
not wrap the lines in the first place.

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-19 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-30  9:00 filter module's inline command and supressed spacing Piotr Kopszak
2014-12-30  9:28 ` Piotr Kopszak
2015-01-01 22:14   ` Mark Szepieniec
2015-01-02 12:48     ` Piotr Kopszak
2015-01-19 15:46 ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).