diff options
| author | John MacFarlane <[email protected]> | 2024-02-13 15:50:12 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-02-13 15:50:12 -0800 |
| commit | 2d83b7ca6f85c8dc6c472f6b00fc51b8e0e400a9 (patch) | |
| tree | 0b9777ff048128a93bca184578926d82bf23221e | |
| parent | d836da74351d0753d1fe648e2332c056ec99e91b (diff) | |
Make LaTeX writer sensitive to `empty_paragraphs` extension.
Closes #9443.
| -rw-r--r-- | MANUAL.txt | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/Extensions.hs | 1 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 8 |
3 files changed, 9 insertions, 2 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index 0c862a0cb..b80b32173 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -3549,7 +3549,7 @@ input formats : `docx`, `html` output formats -: `docx`, `odt`, `opendocument`, `html` +: `docx`, `odt`, `opendocument`, `html`, `latex` #### Extension: `native_numbering` #### diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs index adc8b4646..22e7cc845 100644 --- a/src/Text/Pandoc/Extensions.hs +++ b/src/Text/Pandoc/Extensions.hs @@ -612,6 +612,7 @@ getAllExtensions f = universalExtensions <> getAll f , Ext_raw_tex , Ext_task_lists , Ext_literate_haskell + , Ext_empty_paragraphs ] getAll "beamer" = getAll "latex" getAll "context" = autoIdExtensions <> diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 4426c8da1..9eb7be4f6 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -404,7 +404,13 @@ blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do then blockToLaTeX (RawBlock "latex" "\\pause") else inlineListToLaTeX [Str ".",Space,Str ".",Space,Str "."] blockToLaTeX (Para lst) = - inlineListToLaTeX lst + if null lst + then do + opts <- gets stOptions + if isEnabled Ext_empty_paragraphs opts + then pure "\\hfill\\par" + else pure mempty + else inlineListToLaTeX lst blockToLaTeX (LineBlock lns) = blockToLaTeX $ linesToPara lns blockToLaTeX (BlockQuote lst) = do |
