Hi group,
I am writing a multilingual document and I want to convert a markdown header to a latex command like so:
## A header | 中文标题
->
\bisection{A header}{中文标题}
Using
this example about man pages from the documentation, I have come up with something like the following filter:
~~~lua
local text = pandoc.text
local raw = function (content)
return pandoc.RawInline('latex', content)
end
function Header(el)
local pattern = "(%a+)%s+|%s+(.*)"
headertext = table.unpack(el.content).text
local _, _, enh, zhh = string.find(headertext, pattern)
return raw('\\bisection{'..enh..'}{'..zhh..'}')
end
~~~
However, Lua tells me I'm trying to concatenate a nil value `zhh`. I guess it could be that my regex is wrong, or that I'm using string.find incorrectly; I copied the pattern from
the Lua manual Section 20.3, "Captures". Can anyone give me any pointers?
Thank you all!
Randy
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/03fcdfd9-2811-4622-897e-98d2303e54e1n%40googlegroups.com.