public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schwentner <henning.schwentner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Lua Filters for DOCX Custom Styles
Date: Wed, 24 Mar 2021 11:16:32 -0700 (PDT)	[thread overview]
Message-ID: <95ba2798-44ed-4028-aed5-d3d868c9407bn@googlegroups.com> (raw)


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

Hi,

I've written a book on LeanPub and then signed a contract with a "real" 
publisher. Now I'm using Pandoc (thanks for the great tool!) to convert the 
sources from LeanPub's Markua to Addison-Wesley's homegrown Word template. 
They have defined their own style for everything, e.g. normal body text is 
in style CHAP_BM or emphasized text in style BOLD.

I'm trying to write a Lua filter that makes use of the custom style feature 
of the Pandoc DOCX writer. So I want to replace the following Markdown

# Chapter 1: Introduction

You *really* have to be **honest** here.

with

::: {custom-style="CHAP_TTL"}
Chapter 1: Introduction
:::
::: {custom-style="CHAP_BM"}
You [really]{custom-style="ITAL"} have to be 
[honest]{custom-style="BOLD"} here.
:::

in my Lua filter so that the DOCX-Writer then can work its magic. I tried 
something like

function Emph(elem)
    return '[' .. elem.c .. ']{custom-style="ITAL"}'
end

function Para(elem)
    return pandoc.Para('::: {custom-style="CHAP_BM"}\n' .. elem.c .. 
'\n:::')
end

but it does not work—the whole text including the added 
']{custom-style="ITAL"}' and so on ends up in the docx file and the 
formatting is not changed. What am I doing wrong?

Any help here would be greatly appreciated!

Best,
Henning

-- 
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/95ba2798-44ed-4028-aed5-d3d868c9407bn%40googlegroups.com.

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

             reply	other threads:[~2021-03-24 18:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 18:16 Henning Schwentner [this message]
     [not found] ` <95ba2798-44ed-4028-aed5-d3d868c9407bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-03-24 18:22   ` Leonard Rosenthol
     [not found]     ` <CALu=v3+XKtzXdULo6s9vpgY+To7iG=5X=hV61WsLZWT9RYKKGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-03-24 18:23       ` Leonard Rosenthol
     [not found]         ` <CALu=v3JWea=vZiO46284r4vVGCfc5+o4UNFpkezZsz5SO5-uhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-04-12 10:34           ` Henning Schwentner
     [not found]             ` <eedb0662-52f1-4567-8764-adabb55e5c6an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-05-24 15:32               ` K4zuki

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=95ba2798-44ed-4028-aed5-d3d868c9407bn@googlegroups.com \
    --to=henning.schwentner-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).