* Apply filter to beamer blocks @ 2023-03-10 10:24 Bruno Grenet [not found] ` <e9bfa616-059a-4df7-9d92-d462ea6f3ed0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Bruno Grenet @ 2023-03-10 10:24 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1074 bytes --] Dear all, My question is a rewrite of a previous question of mine (https://groups.google.com/g/pandoc-discuss/c/wg3UIgI7G8I/m/V8GoGf9ACwAJ), with less convoluted explanation. For conversion from markdown to beamer, is there a(n easy...) way to define a lua filter that applies to headers that will become beamer blocks? The goal is to be able for instance to add classes and attributes to the header becoming beamer blocks to control the display. A few examples include things like "width = XX%", or ".centered" for the inside text to be centered, etc. Of course, there are other ways to achieve such results, but the source file become kind of ugly. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e9bfa616-059a-4df7-9d92-d462ea6f3ed0n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1471 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <e9bfa616-059a-4df7-9d92-d462ea6f3ed0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Apply filter to beamer blocks [not found] ` <e9bfa616-059a-4df7-9d92-d462ea6f3ed0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2023-03-10 11:00 ` Bastien DUMONT 2023-03-13 12:00 ` bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w 0 siblings, 1 reply; 5+ messages in thread From: Bastien DUMONT @ 2023-03-10 11:00 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw If you set the --slide-level option on the command line, you will be able to match the headers that are below this level, i.e. those that will be rendered as block headings. Example below: ``` BLOCK_LEVEL = PANDOC_WRITER_OPTIONS.slide_level - 1 function Header(header) if header.level >= BLOCK_LEVEL then print('**********\nIt works!\n**********\n') end end ``` Le Friday 10 March 2023 à 02:24:31AM, Bruno Grenet a écrit : > Dear all, > > My question is a rewrite of a previous question of mine (https:// > groups.google.com/g/pandoc-discuss/c/wg3UIgI7G8I/m/V8GoGf9ACwAJ), with less > convoluted explanation. > > For conversion from markdown to beamer, is there a(n easy...) way to define a > lua filter that applies to headers that will become beamer blocks? > > The goal is to be able for instance to add classes and attributes to the header > becoming beamer blocks to control the display. A few examples include things > like "width = XX%", or ".centered" for the inside text to be centered, etc. Of > course, there are other ways to achieve such results, but the source file > become kind of ugly. > > > -- > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [2]https://groups.google.com/d/msgid/ > pandoc-discuss/e9bfa616-059a-4df7-9d92-d462ea6f3ed0n%40googlegroups.com. > > References: > > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2] https://groups.google.com/d/msgid/pandoc-discuss/e9bfa616-059a-4df7-9d92-d462ea6f3ed0n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ZAsN61oTsAgxb3t2%40localhost. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Apply filter to beamer blocks 2023-03-10 11:00 ` Bastien DUMONT @ 2023-03-13 12:00 ` bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w [not found] ` <22f6d608-baef-aa60-6fea-e3fb2d44d0c8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w @ 2023-03-13 12:00 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Thanks for your reply. Ideally, I'd like something which is not based on the command line options, but that's already a working solution. Best, Bruno On 10/03/2023 12:00, Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org> wrote: > If you set the --slide-level option on the command line, you will be able to match the headers that are below this level, i.e. those that will be rendered as block headings. Example below: > > ``` > BLOCK_LEVEL = PANDOC_WRITER_OPTIONS.slide_level - 1 > > function Header(header) > if header.level >= BLOCK_LEVEL then > print('**********\nIt works!\n**********\n') > end > end > ``` > > > Le Friday 10 March 2023 à 02:24:31AM, Bruno Grenet a écrit : > > Dear all, > > > > My question is a rewrite of a previous question of mine (https:// > > groups.google.com/g/pandoc-discuss/c/wg3UIgI7G8I/m/V8GoGf9ACwAJ), with less > > convoluted explanation. > > > > For conversion from markdown to beamer, is there a(n easy...) way to define a > > lua filter that applies to headers that will become beamer blocks? > > > > The goal is to be able for instance to add classes and attributes to the header > > becoming beamer blocks to control the display. A few examples include things > > like "width = XX%", or ".centered" for the inside text to be centered, etc. Of > > course, there are other ways to achieve such results, but the source file > > become kind of ugly. > > > > > > -- > > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2]https://groups.google.com/d/msgid/ > > pandoc-discuss/e9bfa616-059a-4df7-9d92-d462ea6f3ed0n%40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] https://groups.google.com/d/msgid/pandoc-discuss/e9bfa616-059a-4df7-9d92-d462ea6f3ed0n%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/22f6d608-baef-aa60-6fea-e3fb2d44d0c8%40gmail.com. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <22f6d608-baef-aa60-6fea-e3fb2d44d0c8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Apply filter to beamer blocks [not found] ` <22f6d608-baef-aa60-6fea-e3fb2d44d0c8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2023-03-13 13:01 ` Albert Krewinkel [not found] ` <87cz5c7qfj.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Albert Krewinkel @ 2023-03-13 13:01 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org writes: > Thanks for your reply. Ideally, I'd like something which is not based on the > command line options, but that's already a working solution. We've added a `pandoc.structure.slide_level` Lua function in a recent release, Bastien's elegant solution can be made to work even when pandoc auto-detects the slide level: function Pandoc (doc) local SLIDE_LEVEL = PANDOC_WRITER_OPTIONS.slide_level or pandoc.structure.slide_level(doc) return doc:walk { Header = function (header) if header.level == SLIDE_LEVEL then print(pandoc.utils.stringify(header)) end end } end -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <87cz5c7qfj.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>]
* Re: Apply filter to beamer blocks [not found] ` <87cz5c7qfj.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> @ 2023-03-13 13:06 ` bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w 0 siblings, 0 replies; 5+ messages in thread From: bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w @ 2023-03-13 13:06 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Oh, that's great! Thanks! On 13/03/2023 14:01, Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> wrote: > > bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org writes: > > > Thanks for your reply. Ideally, I'd like something which is not based on the > > command line options, but that's already a working solution. > > We've added a `pandoc.structure.slide_level` Lua function in a recent > release, Bastien's elegant solution can be made to work even when pandoc > auto-detects the slide level: > > function Pandoc (doc) > local SLIDE_LEVEL = > PANDOC_WRITER_OPTIONS.slide_level or > pandoc.structure.slide_level(doc) > return doc:walk { > Header = function (header) > if header.level == SLIDE_LEVEL then > print(pandoc.utils.stringify(header)) > end > end > } > end > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-13 13:06 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-03-10 10:24 Apply filter to beamer blocks Bruno Grenet [not found] ` <e9bfa616-059a-4df7-9d92-d462ea6f3ed0n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2023-03-10 11:00 ` Bastien DUMONT 2023-03-13 12:00 ` bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w [not found] ` <22f6d608-baef-aa60-6fea-e3fb2d44d0c8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2023-03-13 13:01 ` Albert Krewinkel [not found] ` <87cz5c7qfj.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2023-03-13 13:06 ` bruno.grenet-Re5JQEeQqe8AvxtiuMwx3w
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).