public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Help with lua filter for docx to latex conversion
@ 2022-08-26 17:08 Sandra Martin
       [not found] ` <0df70b72-8e13-4e1c-986f-6a54ef352f6cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Sandra Martin @ 2022-08-26 17:08 UTC (permalink / raw)
  To: pandoc-discuss


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

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 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/0df70b72-8e13-4e1c-986f-6a54ef352f6cn%40googlegroups.com.

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

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

end of thread, other threads:[~2022-08-27  8:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 17:08 Help with lua filter for docx to latex conversion Sandra Martin
     [not found] ` <0df70b72-8e13-4e1c-986f-6a54ef352f6cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-08-26 17:40   ` Bastien DUMONT
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

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