public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Custom roles and directives for reStructuredText?
@ 2018-06-12 11:18 HiPhish
       [not found] ` <fe379709-9c1c-4dab-a653-9cd7dc1e2b36-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: HiPhish @ 2018-06-12 11:18 UTC (permalink / raw)
  To: pandoc-discuss


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

Hello everyone,

I use reStructuredText to write PDFs with lots of mathematics and I would 
like to add my own roles and directives, for example a '.. pause::' 
directive which inserts a '\pause' command if the output format is Beamer, 
and does nothing otherwise. I see that Lua can be used to manipulate the 
Pandoc AST, but is there a way to extend the reader so it can add new 
elements to the AST from the source format? Roles and directives are the 
primary extension mechanism of reST and one of the great advantages of reST 
over Markdown, so is there a way to make use of this feature in Pandoc?

-- 
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/fe379709-9c1c-4dab-a653-9cd7dc1e2b36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Custom roles and directives for reStructuredText?
       [not found] ` <fe379709-9c1c-4dab-a653-9cd7dc1e2b36-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-06-12 17:43   ` John MacFarlane
       [not found]     ` <yh480k7en3oq7o.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2018-06-12 17:43 UTC (permalink / raw)
  To: HiPhish, pandoc-discuss


Well, the parser can be modified of course (it's open
source), but then would need to be recompiled.

So your best bet as an end-user is to use lua filters.
They can intercept things in the AST and change them
to other AST elements, including "raw blocks" in
various formats.

HiPhish <hiphish-1Ww2luigxekRVMDPamJrIw@public.gmane.org> writes:

> Hello everyone,
>
> I use reStructuredText to write PDFs with lots of mathematics and I would 
> like to add my own roles and directives, for example a '.. pause::' 
> directive which inserts a '\pause' command if the output format is Beamer, 
> and does nothing otherwise. I see that Lua can be used to manipulate the 
> Pandoc AST, but is there a way to extend the reader so it can add new 
> elements to the AST from the source format? Roles and directives are the 
> primary extension mechanism of reST and one of the great advantages of reST 
> over Markdown, so is there a way to make use of this feature in Pandoc?
>
> -- 
> 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/fe379709-9c1c-4dab-a653-9cd7dc1e2b36%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


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

* Re: Custom roles and directives for reStructuredText?
       [not found]     ` <yh480k7en3oq7o.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2018-06-18 16:23       ` Francesco Occhipinti
  2018-06-27 21:01       ` HiPhish
  1 sibling, 0 replies; 4+ messages in thread
From: Francesco Occhipinti @ 2018-06-18 16:23 UTC (permalink / raw)
  To: pandoc-discuss


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

I hadn't realised that unknown directives were parsed into Divs, and that 
raw blocks and inlines enable us to develop powerful custom conversion 
logic using the filters!

I found a limitation in the way unknown directives are currently parsed and 
i created this issue https://github.com/jgm/pandoc/issues/4715 about it.
 

-- 
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/1b54763f-016d-40ef-a85c-9e608a545035%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

* Re: Custom roles and directives for reStructuredText?
       [not found]     ` <yh480k7en3oq7o.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  2018-06-18 16:23       ` Francesco Occhipinti
@ 2018-06-27 21:01       ` HiPhish
  1 sibling, 0 replies; 4+ messages in thread
From: HiPhish @ 2018-06-27 21:01 UTC (permalink / raw)
  To: pandoc-discuss


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

Thank you for the replies and sorry for not responding, I had not noticed 
that I was using another email address, so I thought no one had replied. 
Modifying Pandoc itself is not an option, but the tip that unknown roles 
are parsed as DIVs is a good one, I did not know that. I now have something 
to look deeper into.

-- 
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/83508c14-985f-4630-933f-353c0ee24ff3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

end of thread, other threads:[~2018-06-27 21:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 11:18 Custom roles and directives for reStructuredText? HiPhish
     [not found] ` <fe379709-9c1c-4dab-a653-9cd7dc1e2b36-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-06-12 17:43   ` John MacFarlane
     [not found]     ` <yh480k7en3oq7o.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-06-18 16:23       ` Francesco Occhipinti
2018-06-27 21:01       ` HiPhish

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