public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Lua Filters for DOCX Custom Styles
@ 2021-03-24 18:16 Henning Schwentner
       [not found] ` <95ba2798-44ed-4028-aed5-d3d868c9407bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Henning Schwentner @ 2021-03-24 18:16 UTC (permalink / raw)
  To: pandoc-discuss


[-- 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 --]

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

end of thread, other threads:[~2023-05-24 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 18:16 Lua Filters for DOCX Custom Styles Henning Schwentner
     [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

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