public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Lua filter to add \medskip
@ 2018-11-13 21:20 Jeremy Theler
       [not found] ` <1542144045.2173.3.camel-24em0bpozeFWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Theler @ 2018-11-13 21:20 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

Hello all

Is there anyone out there who can tell me how to write a Lua filter
such that if two markdown paragraphs are separated by two (three) blank
lines in the input then a LaTeX \medskip (\bigskip) command is inserted
into the output?

Thanks
--
jeremy theler
www.seamplex.com

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1542144045.2173.3.camel%40seamplex.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 1392 bytes --]

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

* Re: Lua filter to add \medskip
       [not found] ` <1542144045.2173.3.camel-24em0bpozeFWk0Htik3J/w@public.gmane.org>
@ 2018-11-13 21:51   ` BP Jonsson
       [not found]     ` <CAFC_yuRxziHqR=K0ed5tCZ3FszLxV9k1JwTEgjNnOfOL_ZAPMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: BP Jonsson @ 2018-11-13 21:51 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3575 bytes --]

Pandoc doesn't preserve any info about the number of blank lines in the
input, i.e. two newlines, three newlines or more are equivalent and just
register as a paragraph/other block break.

I suppose you know that you simply can type `\medskip` in a paragraph on
its own? It will be passed through unchanged to LaTeX output and ignored in
other ourput formats. If you want similar behavior in HTML output you can
have a filter intercept RawBlock elements with format `latex` and text
`\medakip` and insert e.g. a span with suitable CSS styling. I do something
similar with `\newpage` even in DOCX output.

If you don't like the raw LaTeX but don't otherwise use horizontal rules
you could put a horizontal rule where you want a medskip and use a filter
to replace HorizontalRule elements with latex RawBlock elements with
content `\medakip` for LaTeX output, or to remove them in HTML output.

tis 13 nov. 2018 kl. 22:20 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:

> Hello all
>
> Is there anyone out there who can tell me how to write a Lua filter such
> that if two markdown paragraphs are separated by two (three) blank lines in
> the input then a LaTeX \medskip (\bigskip) command is inserted into the
> output?
>
> Thanks
> --
> jeremy theler
> www.seamplex.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/1542144045.2173.3.camel%40seamplex.com
> <https://groups.google.com/d/msgid/pandoc-discuss/1542144045.2173.3.camel%40seamplex.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

------------------------------
SavedURI :Show URLShow URLSavedURI :
SavedURI :Hide URLHide URLSavedURI :
https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvwhttps://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw
<https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
<https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
------------------------------

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFC_yuRxziHqR%3DK0ed5tCZ3FszLxV9k1JwTEgjNnOfOL_ZAPMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 5101 bytes --]

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

* Re: Lua filter to add \medskip
       [not found]     ` <CAFC_yuRxziHqR=K0ed5tCZ3FszLxV9k1JwTEgjNnOfOL_ZAPMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-11-13 22:12       ` Jeremy Theler
       [not found]         ` <1542147146.3901.1.camel-24em0bpozeFWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Theler @ 2018-11-13 22:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 2303 bytes --]

Hi
Thanks for the prompt response. 
On Tue, 2018-11-13 at 22:51 +0100, BP Jonsson wrote:
> Pandoc doesn't preserve any info about the number of blank lines in
> the input, i.e. two newlines, three newlines or more are equivalent
> and just register as a paragraph/other block break.

oh
> I suppose you know that you simply can type `\medskip` in a paragraph
> on its own? It will be passed through unchanged to LaTeX output and
> ignored in other ourput formats.

Yes, I was aware. But I am trying to have other non-LaTeX people to
switch to pandoc and a double separation lines seemed a good way of
using LaTeX tricks to impress them.
>  If you want similar behavior in HTML output you can have a filter
> intercept RawBlock elements with format `latex` and text `\medakip`
> and insert e.g. a span with suitable CSS styling. I do something
> similar with `\newpage` even in DOCX output.

can you post this sample filter?
> If you don't like the raw LaTeX but don't otherwise use horizontal
> rules you could put a horizontal rule where you want a medskip and
> use a filter to replace HorizontalRule elements with latex RawBlock
> elements with content `\medakip` for LaTeX output, or to remove them
> in HTML output.

seems a good solution
> tis 13 nov. 2018 kl. 22:20 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:
> > Hello all
> > 
> > Is there anyone out there who can tell me how to write a Lua filter
> > such that if two markdown paragraphs are separated by two (three)
> > blank lines in the input then a LaTeX \medskip (\bigskip) command
> > is inserted into the output?
> > 
> > Thanks
> > --
> > jeremy theler
> > www.seamplex.com
> > 
> > 
> > 
> > 
> > 

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1542147146.3901.1.camel%40seamplex.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 3478 bytes --]

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

* Re: Lua filter to add \medskip
       [not found]         ` <1542147146.3901.1.camel-24em0bpozeFWk0Htik3J/w@public.gmane.org>
@ 2018-11-15 10:05           ` BP Jonsson
       [not found]             ` <CAFC_yuTZ+WXOErRsYGsyB5cVQ6TUfWBG5oGdcHYn9BXD0kR9gg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: BP Jonsson @ 2018-11-15 10:05 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 4729 bytes --]

A Perl implementation of the newpage filter is in this gist:

https://gist.github.com/bpj/39b1da5517fe06161213d12711c99182#file-pandoc-newpage-pl

I haven't ported it to Lua since I haven't felt the need (all my machines
which have pandoc also have perl and the requisite modules) but doing so
shouldn't be too hard apart from the strictly redundant bits taking config
from metadata. In Pandoc::Elements we have put some work into routines
which convert a tree of metadata objects into a plain data structure. There
is as yet nothing such for Lua filters. I guess Perl filters have to be
better at something! :-)

tis 13 nov. 2018 kl. 23:12 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:

> Hi
>
> Thanks for the prompt response.
>
> On Tue, 2018-11-13 at 22:51 +0100, BP Jonsson wrote:
>
> Pandoc doesn't preserve any info about the number of blank lines in the
> input, i.e. two newlines, three newlines or more are equivalent and just
> register as a paragraph/other block break.
>
>
> oh
>
>
> I suppose you know that you simply can type `\medskip` in a paragraph on
> its own? It will be passed through unchanged to LaTeX output and ignored in
> other ourput formats.
>
>
> Yes, I was aware. But I am trying to have other non-LaTeX people to switch
> to pandoc and a double separation lines seemed a good way of using LaTeX
> tricks to impress them.
>
> If you want similar behavior in HTML output you can have a filter
> intercept RawBlock elements with format `latex` and text `\medakip` and
> insert e.g. a span with suitable CSS styling. I do something similar with
> `\newpage` even in DOCX output.
>
>
> can you post this sample filter?
>
>
> If you don't like the raw LaTeX but don't otherwise use horizontal rules
> you could put a horizontal rule where you want a medskip and use a filter
> to replace HorizontalRule elements with latex RawBlock elements with
> content `\medakip` for LaTeX output, or to remove them in HTML output.
>
>
> seems a good solution
>
>
> tis 13 nov. 2018 kl. 22:20 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:
>
> Hello all
>
> Is there anyone out there who can tell me how to write a Lua filter such
> that if two markdown paragraphs are separated by two (three) blank lines in
> the input then a LaTeX \medskip (\bigskip) command is inserted into the
> output?
>
> Thanks
> --
> jeremy theler
> www.seamplex.com
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/1542147146.3901.1.camel%40seamplex.com
> <https://groups.google.com/d/msgid/pandoc-discuss/1542147146.3901.1.camel%40seamplex.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

------------------------------
SavedURI :Show URLShow URLSavedURI :
SavedURI :Hide URLHide URLSavedURI :
https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvwhttps://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw
<https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
<https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
------------------------------

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFC_yuTZ%2BWXOErRsYGsyB5cVQ6TUfWBG5oGdcHYn9BXD0kR9gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 7023 bytes --]

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

* Re: Lua filter to add \medskip
       [not found]             ` <CAFC_yuTZ+WXOErRsYGsyB5cVQ6TUfWBG5oGdcHYn9BXD0kR9gg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-11-16  6:56               ` Albert Krewinkel
       [not found]                 ` <8736s18q86.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Albert Krewinkel @ 2018-11-16  6:56 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I pushed the pagebreak filter, which I had written for a stackoverflow
question, to the Lua filters repo:
https://github.com/pandoc/lua-filters/tree/master/pagebreak

BP, your filter has great documentation and very useful features. Would
you be ok with me merging your work into the Lua filter? This would
require a change of license (MIT).

Cheers,
Albert

BP Jonsson writes:

> A Perl implementation of the newpage filter is in this gist:
>
> https://gist.github.com/bpj/39b1da5517fe06161213d12711c99182#file-pandoc-newpage-pl
>
> I haven't ported it to Lua since I haven't felt the need (all my machines
> which have pandoc also have perl and the requisite modules) but doing so
> shouldn't be too hard apart from the strictly redundant bits taking config
> from metadata. In Pandoc::Elements we have put some work into routines
> which convert a tree of metadata objects into a plain data structure. There
> is as yet nothing such for Lua filters. I guess Perl filters have to be
> better at something! :-)
>
> tis 13 nov. 2018 kl. 23:12 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:
>
>> Hi
>>
>> Thanks for the prompt response.
>>
>> On Tue, 2018-11-13 at 22:51 +0100, BP Jonsson wrote:
>>
>> Pandoc doesn't preserve any info about the number of blank lines in the
>> input, i.e. two newlines, three newlines or more are equivalent and just
>> register as a paragraph/other block break.
>>
>>
>> oh
>>
>>
>> I suppose you know that you simply can type `\medskip` in a paragraph on
>> its own? It will be passed through unchanged to LaTeX output and ignored in
>> other ourput formats.
>>
>>
>> Yes, I was aware. But I am trying to have other non-LaTeX people to switch
>> to pandoc and a double separation lines seemed a good way of using LaTeX
>> tricks to impress them.
>>
>> If you want similar behavior in HTML output you can have a filter
>> intercept RawBlock elements with format `latex` and text `\medakip` and
>> insert e.g. a span with suitable CSS styling. I do something similar with
>> `\newpage` even in DOCX output.
>>
>>
>> can you post this sample filter?
>>
>>
>> If you don't like the raw LaTeX but don't otherwise use horizontal rules
>> you could put a horizontal rule where you want a medskip and use a filter
>> to replace HorizontalRule elements with latex RawBlock elements with
>> content `\medakip` for LaTeX output, or to remove them in HTML output.
>>
>>
>> seems a good solution
>>
>>
>> tis 13 nov. 2018 kl. 22:20 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:
>>
>> Hello all
>>
>> Is there anyone out there who can tell me how to write a Lua filter such
>> that if two markdown paragraphs are separated by two (three) blank lines in
>> the input then a LaTeX \medskip (\bigskip) command is inserted into the
>> output?
>>
>> Thanks
>> --
>> jeremy theler
>> www.seamplex.com
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/1542147146.3901.1.camel%40seamplex.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/1542147146.3901.1.camel%40seamplex.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> ------------------------------
> SavedURI :Show URLShow URLSavedURI :
> SavedURI :Hide URLHide URLSavedURI :
> https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvwhttps://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw
> <https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
> <https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
> ------------------------------


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8736s18q86.fsf%40zeitkraut.de.
For more options, visit https://groups.google.com/d/optout.


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

* Re: Lua filter to add \medskip
       [not found]                 ` <8736s18q86.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2018-11-16  7:33                   ` BP Jonsson
       [not found]                     ` <CAFC_yuT4m2JXgYSmaLsx556TGSxgBotBEAeEvG9LcaQZ_D5LFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: BP Jonsson @ 2018-11-16  7:33 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 7231 bytes --]

fre 16 nov. 2018 kl. 07:57 skrev Albert Krewinkel <
albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>:

>
> BP, your filter has great documentation and very useful features. Would
> you be ok with me merging your work into the Lua filter? This would
> require a change of license (MIT).
>

Sure, go ahead! I'd love to learn how configuration via metadata should be
done in Lua. :-) As for the license I usually use MIT for my non-Perl stuff
so I have absolutely no problem with that.

/bpj


>
> BP Jonsson writes:
>
> > A Perl implementation of the newpage filter is in this gist:
> >
> >
> https://gist.github.com/bpj/39b1da5517fe06161213d12711c99182#file-pandoc-newpage-pl
> >
> > I haven't ported it to Lua since I haven't felt the need (all my machines
> > which have pandoc also have perl and the requisite modules) but doing so
> > shouldn't be too hard apart from the strictly redundant bits taking
> config
> > from metadata. In Pandoc::Elements we have put some work into routines
> > which convert a tree of metadata objects into a plain data structure.
> There
> > is as yet nothing such for Lua filters. I guess Perl filters have to be
> > better at something! :-)
> >
> > tis 13 nov. 2018 kl. 23:12 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:
> >
> >> Hi
> >>
> >> Thanks for the prompt response.
> >>
> >> On Tue, 2018-11-13 at 22:51 +0100, BP Jonsson wrote:
> >>
> >> Pandoc doesn't preserve any info about the number of blank lines in the
> >> input, i.e. two newlines, three newlines or more are equivalent and just
> >> register as a paragraph/other block break.
> >>
> >>
> >> oh
> >>
> >>
> >> I suppose you know that you simply can type `\medskip` in a paragraph on
> >> its own? It will be passed through unchanged to LaTeX output and
> ignored in
> >> other ourput formats.
> >>
> >>
> >> Yes, I was aware. But I am trying to have other non-LaTeX people to
> switch
> >> to pandoc and a double separation lines seemed a good way of using LaTeX
> >> tricks to impress them.
> >>
> >> If you want similar behavior in HTML output you can have a filter
> >> intercept RawBlock elements with format `latex` and text `\medakip` and
> >> insert e.g. a span with suitable CSS styling. I do something similar
> with
> >> `\newpage` even in DOCX output.
> >>
> >>
> >> can you post this sample filter?
> >>
> >>
> >> If you don't like the raw LaTeX but don't otherwise use horizontal rules
> >> you could put a horizontal rule where you want a medskip and use a
> filter
> >> to replace HorizontalRule elements with latex RawBlock elements with
> >> content `\medakip` for LaTeX output, or to remove them in HTML output.
> >>
> >>
> >> seems a good solution
> >>
> >>
> >> tis 13 nov. 2018 kl. 22:20 skrev Jeremy Theler <jeremy-24em0bpozeFWk0Htik3J/w@public.gmane.org>:
> >>
> >> Hello all
> >>
> >> Is there anyone out there who can tell me how to write a Lua filter such
> >> that if two markdown paragraphs are separated by two (three) blank
> lines in
> >> the input then a LaTeX \medskip (\bigskip) command is inserted into the
> >> output?
> >>
> >> Thanks
> >> --
> >> jeremy theler
> >> www.seamplex.com
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "pandoc-discuss" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/pandoc-discuss/1542147146.3901.1.camel%40seamplex.com
> >> <
> https://groups.google.com/d/msgid/pandoc-discuss/1542147146.3901.1.camel%40seamplex.com?utm_medium=email&utm_source=footer
> >
> >> .
> >> For more options, visit https://groups.google.com/d/optout.
> >>
> > --
> >
> > ------------------------------
> > SavedURI :Show URLShow URLSavedURI :
> > SavedURI :Hide URLHide URLSavedURI :
> >
> https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvwhttps://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw
> > <
> https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw
> >
> > <
> https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw
> >
> > ------------------------------
>
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/8736s18q86.fsf%40zeitkraut.de
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

------------------------------
SavedURI :Show URLShow URLSavedURI :
SavedURI :Hide URLHide URLSavedURI :
https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvwhttps://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw
<https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
<https://mail.google.com/_/scs/mail-static/_/js/k=gmail.main.sv.G3GZFwvcniQ.O/m=m_i,t,it/am=fUAcTAoZawdGHAZ2YD-g9N_f7LL4CX7WlSgHQKgABHaCv9kToPiBD8qOMw/rt=h/d=1/rs=AItRSTO5CF1YB_frDRXLXTeUsQ1zItcBvw>
------------------------------

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFC_yuT4m2JXgYSmaLsx556TGSxgBotBEAeEvG9LcaQZ_D5LFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 11399 bytes --]

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

* Re: Lua filter to add \medskip
       [not found]                     ` <CAFC_yuT4m2JXgYSmaLsx556TGSxgBotBEAeEvG9LcaQZ_D5LFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-11-16 11:09                       ` Benct Philip Jonsson
       [not found]                         ` <3cb673ee-75b6-bdf2-6faa-0b896bfeacf4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2020-08-04 20:22                       ` Albert Krewinkel
  1 sibling, 1 reply; 9+ messages in thread
From: Benct Philip Jonsson @ 2018-11-16 11:09 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Den 2018-11-16 kl. 08:33, skrev BP Jonsson:
> fre 16 nov. 2018 kl. 07:57 skrev Albert Krewinkel <
> albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>:
> 
>> BP, your filter has great documentation and very useful features. Would
>> you be ok with me merging your work into the Lua filter? This would
>> require a change of license (MIT).
>>
> Sure, go ahead! I'd love to learn how configuration via metadata should be
> done in Lua. :-) As for the license I usually use MIT for my non-Perl stuff
> so I have absolutely no problem with that.

Albert, being back at my Desktop I have looked at your filter and 
now I wonder if you would be ok with me taking the correct EPUB 
syntax and the formfeed fallback from your filter?

/bpj


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

* Re: Lua filter to add \medskip
       [not found]                         ` <3cb673ee-75b6-bdf2-6faa-0b896bfeacf4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-11-16 22:09                           ` Albert Krewinkel
  0 siblings, 0 replies; 9+ messages in thread
From: Albert Krewinkel @ 2018-11-16 22:09 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Benct Philip Jonsson writes:

> Den 2018-11-16 kl. 08:33, skrev BP Jonsson:
>> fre 16 nov. 2018 kl. 07:57 skrev Albert Krewinkel <
>> albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>:
>>
>>> BP, your filter has great documentation and very useful features. Would
>>> you be ok with me merging your work into the Lua filter? This would
>>> require a change of license (MIT).
>>>
>> Sure, go ahead! I'd love to learn how configuration via metadata should be
>> done in Lua. :-) As for the license I usually use MIT for my non-Perl stuff
>> so I have absolutely no problem with that.

Thank you, I updated the filter and added you as an author.

> Albert, being back at my Desktop I have looked at your filter and now I wonder
> if you would be ok with me taking the correct EPUB syntax and the formfeed
> fallback from your filter?

Of course, please do. Calibre seems to be a lost cause as far as page
breaks are concerned, but iBooks does respect the CSS command (but not
on div, only on p).


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

* Re: Lua filter to add \medskip
       [not found]                     ` <CAFC_yuT4m2JXgYSmaLsx556TGSxgBotBEAeEvG9LcaQZ_D5LFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2018-11-16 11:09                       ` Benct Philip Jonsson
@ 2020-08-04 20:22                       ` Albert Krewinkel
  1 sibling, 0 replies; 9+ messages in thread
From: Albert Krewinkel @ 2020-08-04 20:22 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


BP Jonsson writes:

> fre 16 nov. 2018 kl. 07:57 skrev Albert Krewinkel <
> albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>:
>
>> BP, your filter has great documentation and very useful features. Would
>> you be ok with me merging your work into the Lua filter? This would
>> require a change of license (MIT).
>
> Sure, go ahead! I'd love to learn how configuration via metadata should be
> done in Lua. :-) As for the license I usually use MIT for my non-Perl stuff
> so I have absolutely no problem with that.

I just found out recently that our filter is shipping with
RStudio as part of R Markdown. Neat, isn't it?

https://github.com/rstudio/rmarkdown/blob/v2.3/inst/rmd/lua/pagebreak.lua
https://bookdown.org/yihui/rmarkdown-cookbook/pagebreaks.html

--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


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

end of thread, other threads:[~2020-08-04 20:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-13 21:20 Lua filter to add \medskip Jeremy Theler
     [not found] ` <1542144045.2173.3.camel-24em0bpozeFWk0Htik3J/w@public.gmane.org>
2018-11-13 21:51   ` BP Jonsson
     [not found]     ` <CAFC_yuRxziHqR=K0ed5tCZ3FszLxV9k1JwTEgjNnOfOL_ZAPMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-11-13 22:12       ` Jeremy Theler
     [not found]         ` <1542147146.3901.1.camel-24em0bpozeFWk0Htik3J/w@public.gmane.org>
2018-11-15 10:05           ` BP Jonsson
     [not found]             ` <CAFC_yuTZ+WXOErRsYGsyB5cVQ6TUfWBG5oGdcHYn9BXD0kR9gg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-11-16  6:56               ` Albert Krewinkel
     [not found]                 ` <8736s18q86.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2018-11-16  7:33                   ` BP Jonsson
     [not found]                     ` <CAFC_yuT4m2JXgYSmaLsx556TGSxgBotBEAeEvG9LcaQZ_D5LFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-11-16 11:09                       ` Benct Philip Jonsson
     [not found]                         ` <3cb673ee-75b6-bdf2-6faa-0b896bfeacf4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-11-16 22:09                           ` Albert Krewinkel
2020-08-04 20:22                       ` Albert Krewinkel

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).