From: Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Help with lua filter for docx to latex conversion
Date: Fri, 26 Aug 2022 17:40:57 +0000 [thread overview]
Message-ID: <YwkBUzXZumcue7DE@localhost> (raw)
In-Reply-To: <0df70b72-8e13-4e1c-986f-6a54ef352f6cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
In `"\\cite[{](%w+)[}]"`, `(%w+)` is a capture. When the pattern in string.match() specifies a capture, it is returned instead of the whole match, so `citekey` has the value of the *content* of `\cite{...}` instead of the whole macro. I guess that it should work if you remove the parentheses.
Le Friday 26 August 2022 à 10:08:50AM, Sandra Martin a écrit :
> Hello all,
>
> I have trouble writing the correct lua filter for my pandoc conversion of docx
> to latex.
>
> In short, I have citations in the format "\cite{reference}" (csl style from
> Better Bibtex) in my docx file, which I would like to preserve and keep
> unchanged during pandoc conversion.
>
> When calling "pandoc --to=native test.docx", I see that pandoc reads these
> entries as strings and I've tried writing filters with pandoc.RawInline to
> preserve these strings. However, using for instance this function keeps the
> reference keys but gets rid of all the latex formatting (the backslash and the
> curly brackets):
> function Str(el)
> local citekey = el.text:match("\\cite[{](%w+)[}]")
> if citekey then
> return pandoc.RawInline('latex', citekey)
> end
> end
>
> How do I keep my latex-styled reference strings as they are during pandoc
> conversion?
>
> Thanks in advance!
> Sandra
>
> --
> 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/0df70b72-8e13-4e1c-986f-6a54ef352f6cn%40googlegroups.com.
>
> References:
>
> [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [2] https://groups.google.com/d/msgid/pandoc-discuss/0df70b72-8e13-4e1c-986f-6a54ef352f6cn%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/YwkBUzXZumcue7DE%40localhost.
next prev parent reply other threads:[~2022-08-26 17:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 17:08 Sandra Martin
[not found] ` <0df70b72-8e13-4e1c-986f-6a54ef352f6cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-08-26 17:40 ` Bastien DUMONT [this message]
2022-08-26 19:23 ` Sandra Martin
[not found] ` <7fc77e34-86e4-48a2-8642-e226d1ae08ben-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-08-26 20:09 ` Albert Krewinkel
[not found] ` <36B1ABBF-804C-4785-BB14-E29AEE6423E4-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-08-26 21:37 ` Bastien DUMONT
2022-08-27 8:49 ` Sandra Martin
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=YwkBUzXZumcue7DE@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).