Skip to content

Commit b6b668e

Browse files
committed
Use conventional styles/indents for Word bullet lists.
See #7280.
1 parent a0c1bde commit b6b668e

37 files changed

+18
-15
lines changed

src/Text/Pandoc/Writers/Docx.hs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -820,28 +820,31 @@ mkLvl marker lvl =
820820
[ mknode "w:numFmt" [("w:val",fmt)] ()
821821
, mknode "w:lvlText" [("w:val", lvltxt)] ()
822822
, mknode "w:lvlJc" [("w:val","left")] ()
823-
, mknode "w:pPr" []
824-
[ mknode "w:ind" [ ("w:left",tshow $ lvl * step + step)
825-
, ("w:hanging",tshow (hang :: Int))
823+
, mknode "w:pPr" [] $
824+
mknode "w:ind" [ ("w:left",tshow $ lvl * step + step)
825+
, ("w:hanging",tshow hang)
826826
] ()
827-
]
827+
: maybe []
828+
(\font -> [ mknode "w:rFonts" [ ("w:ascii", font)
829+
, ("w:hAnsi", font)
830+
, ("w:cs", font)
831+
, ("w:hint", "default") ] () ]) mbfont
828832
]
829-
where (fmt, lvltxt, start) =
833+
where (fmt, lvltxt, mbfont, start) =
830834
case marker of
831-
NoMarker -> ("bullet"," ","1")
832-
BulletMarker -> ("bullet",bulletFor lvl,"1")
835+
NoMarker -> ("bullet"," ", Nothing, "1")
836+
BulletMarker -> bulletFor lvl
833837
NumberMarker st de n -> (styleFor st lvl
834838
,patternFor de ("%" <> tshow (lvl + 1))
839+
,Nothing
835840
,tshow n)
836841
step = 720
837-
hang = 480
838-
bulletFor 0 = "\x2022" -- filled circle
839-
bulletFor 1 = "\x2013" -- en dash
840-
bulletFor 2 = "\x2022" -- hyphen bullet
841-
bulletFor 3 = "\x2013"
842-
bulletFor 4 = "\x2022"
843-
bulletFor 5 = "\x2013"
844-
bulletFor x = bulletFor (x `mod` 6)
842+
hang :: Int
843+
hang = 360
844+
bulletFor 0 = ("bullet", "\xf0b7", Just "Symbol", "1") -- filled circle
845+
bulletFor 1 = ("bullet", "o", Just "Courier New", "1") -- open o
846+
bulletFor 2 = ("bullet", "\xf0a7", Just "Wingdings", "1") -- closed box
847+
bulletFor x = bulletFor (x `mod` 3)
845848
styleFor UpperAlpha _ = "upperLetter"
846849
styleFor LowerAlpha _ = "lowerLetter"
847850
styleFor UpperRoman _ = "upperRoman"

test/docx/golden/block_quotes.docx

0 Bytes
Binary file not shown.

test/docx/golden/codeblock.docx

0 Bytes
Binary file not shown.

test/docx/golden/comments.docx

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
2 Bytes
Binary file not shown.

test/docx/golden/definition_list.docx

0 Bytes
Binary file not shown.
Binary file not shown.
-1 Bytes
Binary file not shown.

test/docx/golden/headers.docx

0 Bytes
Binary file not shown.

test/docx/golden/image.docx

0 Bytes
Binary file not shown.

test/docx/golden/inline_code.docx

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

test/docx/golden/inline_images.docx

0 Bytes
Binary file not shown.

test/docx/golden/link_in_notes.docx

0 Bytes
Binary file not shown.

test/docx/golden/links.docx

0 Bytes
Binary file not shown.

test/docx/golden/lists.docx

125 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
122 Bytes
Binary file not shown.
128 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

test/docx/golden/notes.docx

0 Bytes
Binary file not shown.

test/docx/golden/raw-blocks.docx

0 Bytes
Binary file not shown.

test/docx/golden/raw-bookmarks.docx

0 Bytes
Binary file not shown.

test/docx/golden/table_one_row.docx

0 Bytes
Binary file not shown.
123 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

test/docx/golden/tables.docx

0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.

test/docx/golden/unicode.docx

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)