admin管理员组文章数量:1122846
I have the following asciidoc document.
= Test
== Introduction
lorem ipsum
[.custom]
This text should use the CustomStyle from Word.
I am converting this document to MS word (via DocBook) as follows (using the standard reference.docx file)
docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor:1.67 asciidoctor -b docbook "/documents/test.adoc"
docker run --rm -v $(pwd):/data/ pandoc/core:latest /data/test.xml -s -o /data/test.docx -r docbook -t docx --reference-doc="/data/reference.docx"
Unfortunately, the custom style gets lost during the second step. I can still see the custom style in the DocBook as follows
<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc?>
<?asciidoc-numbered?>
<article xmlns="; xmlns:xl="; version="5.0" xml:lang="en">
<info>
<title>Test</title>
<date>2025-01-06</date>
</info>
<section xml:id="_introduction">
<title>Introduction</title>
<simpara>lorem ipsum</simpara>
<simpara role="custom">This text should use the CustomStyle from Word.</simpara>
</section>
</article>
but in the MS word output it gets lost. When I unzip the MS word and look into the xml, it says
<w:p><w:pPr><w:pStyle w:val="BodyText" /></w:pPr><w:r><w:t xml:space="preserve">This text should use the CustomStyle from Word.</w:t></w:r></w:p>
Am I missing anything here or is this a bug in pandoc?
I have the following asciidoc document.
= Test
== Introduction
lorem ipsum
[.custom]
This text should use the CustomStyle from Word.
I am converting this document to MS word (via DocBook) as follows (using the standard reference.docx file)
docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor:1.67 asciidoctor -b docbook "/documents/test.adoc"
docker run --rm -v $(pwd):/data/ pandoc/core:latest /data/test.xml -s -o /data/test.docx -r docbook -t docx --reference-doc="/data/reference.docx"
Unfortunately, the custom style gets lost during the second step. I can still see the custom style in the DocBook as follows
<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc?>
<?asciidoc-numbered?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
<info>
<title>Test</title>
<date>2025-01-06</date>
</info>
<section xml:id="_introduction">
<title>Introduction</title>
<simpara>lorem ipsum</simpara>
<simpara role="custom">This text should use the CustomStyle from Word.</simpara>
</section>
</article>
but in the MS word output it gets lost. When I unzip the MS word and look into the xml, it says
<w:p><w:pPr><w:pStyle w:val="BodyText" /></w:pPr><w:r><w:t xml:space="preserve">This text should use the CustomStyle from Word.</w:t></w:r></w:p>
Am I missing anything here or is this a bug in pandoc?
Share Improve this question asked yesterday DerNilsDerNils 1331 silver badge4 bronze badges 1 |1 Answer
Reset to default 0Thanks! I managed to get the AST manipulated accordingly using a lua filter as follows
function Strong(el)
return pandoc.Span(el.content, {["custom-style"] = "test"})
end
This assigns a custom style to all bold elements.
本文标签: asciidocPandoc is ignoringloosing custom styles when exporting to MS wordStack Overflow
版权声明:本文标题:asciidoc - Pandoc is ignoringloosing custom styles when exporting to MS word - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282106a1926536.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
custom-style
attribute. That's because paragraphs themselves currently cannot have attributes in pandoc. It's designed to transform content, not layout stuff. Probably it will take some experimentation to get that through the asciidoc -> docbook -> pandoc AST chain. (usepandoc -t native
to see the pandoc AST). – mb21 Commented yesterday