diff options
| author | John MacFarlane <[email protected]> | 2025-01-31 09:07:50 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2025-01-31 09:07:50 -0800 |
| commit | cf662b7178d4710d843c78bdd723412a255babc5 (patch) | |
| tree | 0692757bdb5fbdd5a8121bbb2fc83161d06b9096 /src | |
| parent | fc6e4956dd1c2070ec704168143fe94efa051b66 (diff) | |
Docx writer: create section divisions with `--top-level-division=part`.
Closes #10576.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/Docx/OpenXML.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Docx/OpenXML.hs b/src/Text/Pandoc/Writers/Docx/OpenXML.hs index cfe6b106e..54f3ed84a 100644 --- a/src/Text/Pandoc/Writers/Docx/OpenXML.hs +++ b/src/Text/Pandoc/Writers/Docx/OpenXML.hs @@ -375,7 +375,10 @@ blockToOpenXML' opts (Div (ident,_classes,kvs) bs) = do wrapBookmark ident $ header <> contents blockToOpenXML' opts (Header lev (ident,_,kvs) lst) = do setFirstPara - let isChapter = lev == 1 && writerTopLevelDivision opts == TopLevelChapter + let isSection = case writerTopLevelDivision opts of + TopLevelChapter -> lev == 1 + TopLevelPart -> lev <= 2 + _ -> False paraProps <- withParaPropM (pStyleM (fromString $ "Heading "++show lev)) $ getParaProps False number <- @@ -390,7 +393,7 @@ blockToOpenXML' opts (Header lev (ident,_,kvs) lst) = do else return [] contents <- (number ++) <$> inlinesToOpenXML opts lst let addSectionBreak - | isChapter = (Elem (mknode "w:p" [] + | isSection = (Elem (mknode "w:p" [] (mknode "w:pPr" [] [mknode "w:sectPr" [] ()])) :) | otherwise = id |
