diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-06-07 09:08:53 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-06-07 09:08:53 -0700 |
| commit | 0166aecaab1dfe050ea9ec780833a892c54060e9 (patch) | |
| tree | 5f200e3818d2ccb8b659ef619f450af352ce08bb | |
| parent | d04838b678c037fbf966504d8f29200e09b21aa5 (diff) | |
Allow `abstract-title` to be specified in docx metadata.
Closes #8794.
| -rw-r--r-- | MANUAL.txt | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index 23316f21d..0298e2b4e 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -2566,7 +2566,7 @@ Currently the following pipes are predefined: documents `abstract-title` -: title of abstract, currently used only in HTML and EPUB. +: title of abstract, currently used only in HTML, EPUB, and docx. This will be set automatically to a localized value, depending on `lang`, but can be manually overridden. diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index e39dcb648..47a8d9bfc 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -769,7 +769,11 @@ writeOpenXML opts (Pandoc meta blocks) = do abstract <- if null abstract' then return [] else do - abstractTitle <- translateTerm Abstract + abstractTitle <- case lookupMeta "abstract-title" meta of + Just (MetaBlocks bs) -> pure $ stringify bs + Just (MetaInlines ils) -> pure $ stringify ils + Just (MetaString s) -> pure s + _ -> translateTerm Abstract abstractTit <- withParaPropM (pStyleM "AbstractTitle") $ blocksToOpenXML opts [Para [Str abstractTitle]] |
