From: Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Adding own elements to pandoc AST
Date: Wed, 13 Jul 2022 22:34:05 +0000 [thread overview]
Message-ID: <Ys9IXXrcD4Nwmu6q@localhost> (raw)
In-Reply-To: <CAMwawgNgACJDXLyFAcx26iy4-71yOUD+Hccx67+RgJB132D0_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Is the content of the \gls macro always a one-word string (without spaces)? If so, using the markup in your sample, you will end up with Str objects that you can handle like this (in Lua, I don't speak Python but it should not be difficult to translate):
```
function Str(s)
if string.match(s.text, '^gls:') then
-- code to handle the string
end
return s
end
```
Le Wednesday 13 July 2022 à 11:05:33PM, A A a écrit :
> Dear all,
>
> I have a use case where I would like to be able to add my own element to the
> pandoc AST such that I can use it in a panflute filter. This would be an inline
> element emulating LaTeX’s \gls{term} command from the glossaries.sty package.
>
> I envision the markdown to look something like this:
>
> mentioning a gls:term from the glossary.
>
> or something like this:
>
> mentioning a gls(term) from the glossary
>
> So the syntax would be very similar to LaTeX, but a bit more lightweight.
>
> Is there a way to do this in pandoc? Inheriting from Block or Inline and
> setting up custom syntax such that it can be processed by a Lua or Python
> filter?
>
> Thanks for your consideration.
>
> Regards,
>
> Amine
>
> --
> 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/
> CAMwawgNgACJDXLyFAcx26iy4-71yOUD%2BHccx67%2BRgJB132D0_A%40mail.gmail.com.
>
> References:
>
> [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [2] https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgNgACJDXLyFAcx26iy4-71yOUD%2BHccx67%2BRgJB132D0_A%40mail.gmail.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/Ys9IXXrcD4Nwmu6q%40localhost.
next prev parent reply other threads:[~2022-07-13 22:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 21:05 A A
[not found] ` <CAMwawgNgACJDXLyFAcx26iy4-71yOUD+Hccx67+RgJB132D0_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-13 22:34 ` Bastien DUMONT [this message]
2022-07-14 3:17 ` A A
[not found] ` <CAMwawgNLuqw-NM_RYCHurBdg0EH20sjeAiYGOepmbgQLW9MD_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-07-14 7:46 ` Bastien DUMONT
2022-07-15 9:29 ` John MacFarlane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ys9IXXrcD4Nwmu6q@localhost \
--to=bastien.dumont-vwifzpto/vqstnjn9+bgxg@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).