diff options
| author | John MacFarlane <[email protected]> | 2024-12-17 12:10:40 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-12-17 12:10:40 -0800 |
| commit | 05ba8a0ffaa954fa36e4bedf5196c8f137a328c2 (patch) | |
| tree | 2f17ef829d2996382531bbccc036064e84f45bf3 /src | |
| parent | 7d1962b61721784c18ddfd063102f5cbaa4996c7 (diff) | |
Docx writer: use styleIds not styleNames for Title, Subtitle, etc.issue10282
This change affects the default openxml template as well as the
OpenXML writer.
Closes #10282 (regression introduced in pandoc 3.5).
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/Docx/OpenXML.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Docx/OpenXML.hs b/src/Text/Pandoc/Writers/Docx/OpenXML.hs index e3900f32f..6713d9c07 100644 --- a/src/Text/Pandoc/Writers/Docx/OpenXML.hs +++ b/src/Text/Pandoc/Writers/Docx/OpenXML.hs @@ -286,6 +286,8 @@ writeOpenXML opts (Pandoc meta blocks) = do (fmap (vcat . map (literal . showContent)) . blocksToOpenXML opts) (fmap (hcat . map (literal . showContent)) . inlinesToOpenXML opts) meta + cStyleMap <- gets (smParaStyle . stStyleMaps) + let styleIdOf name = fromStyleId $ getStyleIdFromName name cStyleMap let context = resetField "body" body . resetField "toc" (vcat (map (literal . showElement) toc)) @@ -299,6 +301,12 @@ writeOpenXML opts (Pandoc meta blocks) = do . resetField "date" date . resetField "abstract-title" abstractTitle . resetField "abstract" abstract + . resetField "title-style-id" (styleIdOf "Title") + . resetField "subtitle-style-id" (styleIdOf "Subtitle") + . resetField "author-style-id" (styleIdOf "Author") + . resetField "date-style-id" (styleIdOf "Date") + . resetField "abstract-title-style-id" (styleIdOf "AbstractTitle") + . resetField "abstract-style-id" (styleIdOf "Abstract") $ metadata tpl <- maybe (lift $ compileDefaultTemplate "openxml") pure $ writerTemplate opts let rendered = render Nothing $ renderTemplate tpl context |
