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

* Re: Lua Filters for DOCX Custom Styles
       [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>
  0 siblings, 1 reply; 5+ messages in thread
From: Leonard Rosenthol @ 2021-03-24 18:22 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3709 bytes --]

Unfortunately, you have to actually write the "raw" DOCX XML output from
your filter.  I did some of this in a bunch of filters that I wrote to
handle producing ISO standards from markdown.

here's an example of where I mapped definition lists to use a custom style
in Word.

```
local RAW_TERM_OPEN = '<w:pPr><w:pStyle w:val="Term(s)"/></w:pPr><w:r><w:t>'
local RAW_TERM_CLOSE = '</w:t></w:r>'
local RAW_LINEBREAK = '<w:br />'

local function do_def_list(dl)
local outList = {}

for i, item in ipairs(dl.content) do
-- debug(string.format("Found item %d - %s | %s", i,
pandoc.utils.stringify(item[1]), item[2]))

local termNum = string.format("3.%d", i)
local outTerm = docx_inline( RAW_TERM_OPEN ..
termNum ..
RAW_LINEBREAK ..
pandoc.utils.stringify(item[1]) ..
RAW_TERM_CLOSE)
local outDef = item[2];
table.insert(outList, {outTerm, outDef})
end

return pandoc.DefinitionList(outList)
end

------------------------
-- don't do anything unless we target docx
if FORMAT ~= "docx" then
return {}
end
-- this is the "main" Pandoc routine that connects the parts of the
doc->methods
return {
{
DefinitionList = do_def_list,
}
}
```

On Wed, Mar 24, 2021 at 2:16 PM Henning Schwentner <
henning.schwentner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> 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
> <https://groups.google.com/d/msgid/pandoc-discuss/95ba2798-44ed-4028-aed5-d3d868c9407bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CALu%3Dv3%2BXKtzXdULo6s9vpgY%2BTo7iG%3D5X%3DhV61WsLZWT9RYKKGw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 7544 bytes --]

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

* Re: Lua Filters for DOCX Custom Styles
       [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>
  0 siblings, 1 reply; 5+ messages in thread
From: Leonard Rosenthol @ 2021-03-24 18:23 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 4177 bytes --]

Forgot two important methods!!

```
local function docx_inline(text)
return pandoc.RawInline("openxml", text)
end

local function docx_block(text)
return pandoc.RawBlock("openxml", text)
end
```

On Wed, Mar 24, 2021 at 2:22 PM Leonard Rosenthol <leonardr-bM6h3K5UM15l57MIdRCFDg@public.gmane.org>
wrote:

> Unfortunately, you have to actually write the "raw" DOCX XML output from
> your filter.  I did some of this in a bunch of filters that I wrote to
> handle producing ISO standards from markdown.
>
> here's an example of where I mapped definition lists to use a custom style
> in Word.
>
> ```
> local RAW_TERM_OPEN = '<w:pPr><w:pStyle
> w:val="Term(s)"/></w:pPr><w:r><w:t>'
> local RAW_TERM_CLOSE = '</w:t></w:r>'
> local RAW_LINEBREAK = '<w:br />'
>
> local function do_def_list(dl)
> local outList = {}
>
> for i, item in ipairs(dl.content) do
> -- debug(string.format("Found item %d - %s | %s", i,
> pandoc.utils.stringify(item[1]), item[2]))
>
> local termNum = string.format("3.%d", i)
> local outTerm = docx_inline( RAW_TERM_OPEN ..
> termNum ..
> RAW_LINEBREAK ..
> pandoc.utils.stringify(item[1]) ..
> RAW_TERM_CLOSE)
> local outDef = item[2];
> table.insert(outList, {outTerm, outDef})
> end
>
> return pandoc.DefinitionList(outList)
> end
>
> ------------------------
> -- don't do anything unless we target docx
> if FORMAT ~= "docx" then
> return {}
> end
> -- this is the "main" Pandoc routine that connects the parts of the
> doc->methods
> return {
> {
> DefinitionList = do_def_list,
> }
> }
> ```
>
> On Wed, Mar 24, 2021 at 2:16 PM Henning Schwentner <
> henning.schwentner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> 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
>> <https://groups.google.com/d/msgid/pandoc-discuss/95ba2798-44ed-4028-aed5-d3d868c9407bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/CALu%3Dv3JWea%3DvZiO46284r4vVGCfc5%2Bo4UNFpkezZsz5SO5-uhQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 8784 bytes --]

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

* Re: Lua Filters for DOCX Custom Styles
       [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>
  0 siblings, 1 reply; 5+ messages in thread
From: Henning Schwentner @ 2021-04-12 10:34 UTC (permalink / raw)
  To: pandoc-discuss


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

Thanks, Leonard! That helps me a lot. :-)

I'm still wondering if it can be done without having to write raw OOXML. To 
me it feels that knowledge about OOXML is something that belongs into 
rather into a writer than in a filter. My idea is that the functions Emph, 
Para, and so on would return a pandoc.Div or pandoc.Span with the custom 
style as an attribute. (That is kind of how I imagine fenced divs and 
bracketed spans with custom styles work.)

function Para(elem)
    return pandoc.Div(elem.c) -- set attribute with custom-style = 
'CHAP_BM' here 
end

Does that sound reasonable? How would one set attribute? 
Leonard Rosenthol schrieb am Mittwoch, 24. März 2021 um 19:23:41 UTC+1:

> Forgot two important methods!!
>
> ```
> local function docx_inline(text)
> return pandoc.RawInline("openxml", text)
> end
>
> local function docx_block(text)
> return pandoc.RawBlock("openxml", text)
> end
> ```
>
> On Wed, Mar 24, 2021 at 2:22 PM Leonard Rosenthol <leon...-bM6h3K5UM15l57MIdRCFDg@public.gmane.org> 
> wrote:
>
>> Unfortunately, you have to actually write the "raw" DOCX XML output from 
>> your filter.  I did some of this in a bunch of filters that I wrote to 
>> handle producing ISO standards from markdown.
>>
>> here's an example of where I mapped definition lists to use a custom 
>> style in Word.
>>
>> ```
>> local RAW_TERM_OPEN = '<w:pPr><w:pStyle 
>> w:val="Term(s)"/></w:pPr><w:r><w:t>'
>> local RAW_TERM_CLOSE = '</w:t></w:r>'
>> local RAW_LINEBREAK = '<w:br />'
>>
>> local function do_def_list(dl)
>> local outList = {}
>>
>> for i, item in ipairs(dl.content) do
>> -- debug(string.format("Found item %d - %s | %s", i, 
>> pandoc.utils.stringify(item[1]), item[2]))
>>
>> local termNum = string.format("3.%d", i)
>> local outTerm = docx_inline( RAW_TERM_OPEN .. 
>> termNum .. 
>> RAW_LINEBREAK ..
>> pandoc.utils.stringify(item[1]) ..
>> RAW_TERM_CLOSE)
>> local outDef = item[2];
>> table.insert(outList, {outTerm, outDef})
>> end 
>>
>> return pandoc.DefinitionList(outList)
>> end
>>
>> ------------------------
>> -- don't do anything unless we target docx
>> if FORMAT ~= "docx" then
>> return {}
>> end
>> -- this is the "main" Pandoc routine that connects the parts of the 
>> doc->methods
>> return {
>> {
>> DefinitionList = do_def_list,
>> }
>> }
>> ```
>>
>> On Wed, Mar 24, 2021 at 2:16 PM Henning Schwentner <
>> henning.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> 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-discus...-/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 
>>> <https://groups.google.com/d/msgid/pandoc-discuss/95ba2798-44ed-4028-aed5-d3d868c9407bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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/eedb0662-52f1-4567-8764-adabb55e5c6an%40googlegroups.com.

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

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

* Re: Lua Filters for DOCX Custom Styles
       [not found]             ` <eedb0662-52f1-4567-8764-adabb55e5c6an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-05-24 15:32               ` K4zuki
  0 siblings, 0 replies; 5+ messages in thread
From: K4zuki @ 2023-05-24 15:32 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi,

It may be too late, but I wrote a filter that does a similar process as you 
imagine.

Please check the `para()` function in this file; it finds a Para and 
replaces it with two Divs:
https://github.com/pandocker/pandocker-lua-filters/blob/master/lua/docx-image-styles.lua

2021年4月12日月曜日 19:34:26 UTC+9 Henning Schwentner:

> Thanks, Leonard! That helps me a lot. :-)
>
> I'm still wondering if it can be done without having to write raw OOXML. 
> To me it feels that knowledge about OOXML is something that belongs into 
> rather into a writer than in a filter. My idea is that the functions Emph, 
> Para, and so on would return a pandoc.Div or pandoc.Span with the custom 
> style as an attribute. (That is kind of how I imagine fenced divs and 
> bracketed spans with custom styles work.)
>
> function Para(elem)
>     return pandoc.Div(elem.c) -- set attribute with custom-style = 
> 'CHAP_BM' here 
> end
>
> Does that sound reasonable? How would one set attribute? 
> Leonard Rosenthol schrieb am Mittwoch, 24. März 2021 um 19:23:41 UTC+1:
>
>> Forgot two important methods!!
>>
>> ```
>> local function docx_inline(text)
>> return pandoc.RawInline("openxml", text)
>> end
>>
>> local function docx_block(text)
>> return pandoc.RawBlock("openxml", text)
>> end
>> ```
>>
>> On Wed, Mar 24, 2021 at 2:22 PM Leonard Rosenthol <leon...-bM6h3K5UM15l57MIdRCFDg@public.gmane.org> 
>> wrote:
>>
>>> Unfortunately, you have to actually write the "raw" DOCX XML output from 
>>> your filter.  I did some of this in a bunch of filters that I wrote to 
>>> handle producing ISO standards from markdown.
>>>
>>> here's an example of where I mapped definition lists to use a custom 
>>> style in Word.
>>>
>>> ```
>>> local RAW_TERM_OPEN = '<w:pPr><w:pStyle 
>>> w:val="Term(s)"/></w:pPr><w:r><w:t>'
>>> local RAW_TERM_CLOSE = '</w:t></w:r>'
>>> local RAW_LINEBREAK = '<w:br />'
>>>
>>> local function do_def_list(dl)
>>> local outList = {}
>>>
>>> for i, item in ipairs(dl.content) do
>>> -- debug(string.format("Found item %d - %s | %s", i, 
>>> pandoc.utils.stringify(item[1]), item[2]))
>>>
>>> local termNum = string.format("3.%d", i)
>>> local outTerm = docx_inline( RAW_TERM_OPEN .. 
>>> termNum .. 
>>> RAW_LINEBREAK ..
>>> pandoc.utils.stringify(item[1]) ..
>>> RAW_TERM_CLOSE)
>>> local outDef = item[2];
>>> table.insert(outList, {outTerm, outDef})
>>> end 
>>>
>>> return pandoc.DefinitionList(outList)
>>> end
>>>
>>> ------------------------
>>> -- don't do anything unless we target docx
>>> if FORMAT ~= "docx" then
>>> return {}
>>> end
>>> -- this is the "main" Pandoc routine that connects the parts of the 
>>> doc->methods
>>> return {
>>> {
>>> DefinitionList = do_def_list,
>>> }
>>> }
>>> ```
>>>
>>> On Wed, Mar 24, 2021 at 2:16 PM Henning Schwentner <
>>> henning.s...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>>
>>>> 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-discus...-/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 
>>>> <https://groups.google.com/d/msgid/pandoc-discuss/95ba2798-44ed-4028-aed5-d3d868c9407bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>

-- 
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/66ad3d8e-49d5-4117-85e7-350f87555920n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 10683 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).