public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: "Björn Fisseler" <bjoern.fisseler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Lua filter to set meta data
Date: Wed, 11 Aug 2021 09:25:00 -0700 (PDT)	[thread overview]
Message-ID: <998f827a-92f9-49fc-ab87-25707ba5c7e8n@googlegroups.com> (raw)


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


Hi, 

I want to use Pandoc for converting DOCX to HTML. The goal is to convert 
DOCX to Moodle-Books. While understanding the very basic of developing Lua 
filters is relatively easy, I find it has a steep learning curve when you 
want to achieve certain things.

For example, I need to convert a heading level 2 to the meta data element 
title while reducing all other levels by one (h3 > h4, h4 > h5). This is 
the code that I came up with:
function Header(el)
if (el.level > 2) then
el.level = el.level + 1
end
if (el.level == 2) then
title = el.content
end
return el
end

Thing is, it doesn't work as intended and I don't know why. While it 
correctly modifies the heading levels, it won't set the title. Could 
anybody point me to some documentation? Browsing the Pandoc manual didn't 
help me to understand why this wouldn't work.

-- 
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/998f827a-92f9-49fc-ab87-25707ba5c7e8n%40googlegroups.com.

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

             reply	other threads:[~2021-08-11 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 16:25 Björn Fisseler [this message]
     [not found] ` <998f827a-92f9-49fc-ab87-25707ba5c7e8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-11 18:05   ` John MacFarlane
     [not found]     ` <m2k0kr7t7o.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-08-12 11:05       ` Björn Fisseler

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=998f827a-92f9-49fc-ab87-25707ba5c7e8n@googlegroups.com \
    --to=bjoern.fisseler-re5jqeeqqe8avxtiumwx3w@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).