git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: Bibliography entries get Bibliography style.
0ef1f78John MacFarlane
README+3−3
@@ -551,9 +551,9 @@ Options affecting specific writers
551 used. The following styles are used by pandoc: [paragraph]
551 used. The following styles are used by pandoc: [paragraph]
552 Normal, Compact, Title, Subtitle, Authors, Date, Abstract, Heading 1,
552 Normal, Compact, Title, Subtitle, Authors, Date, Abstract, Heading 1,
553 Heading 2, Heading 3, Heading 4, Heading 5, Block Quote, Definition Term,
553 Heading 2, Heading 3, Heading 4, Heading 5, Block Quote, Definition Term,
554− Definition, Body Text, Table Caption, Image Caption; [character] Default
554+ Definition, Bibliography, Body Text, Table Caption, Image Caption;
555− Paragraph Font, Body Text Char, Verbatim Char, Footnote Ref,
555+ [character] Default Paragraph Font, Body Text Char, Verbatim Char,
556− Link.
556+ Footnote Ref, Link.
557
557
558`--epub-stylesheet=`*FILE*
558`--epub-stylesheet=`*FILE*
559: Use the specified CSS file to style the EPUB. If no stylesheet
559: Use the specified CSS file to style the EPUB. If no stylesheet
data/reference.docx

Binary file not shown.

src/Text/Pandoc/Writers/Docx.hs+6−2
@@ -532,13 +532,17 @@ getUniqueId = liftIO $ (show . (+ 20) . hashUnique) `fmap` newUnique
532-- | Convert a Pandoc block element to OpenXML.
532-- | Convert a Pandoc block element to OpenXML.
533blockToOpenXML :: WriterOptions -> Block -> WS [Element]
533blockToOpenXML :: WriterOptions -> Block -> WS [Element]
534blockToOpenXML _ Null = return []
534blockToOpenXML _ Null = return []
535+blockToOpenXML opts (Div (_,["references"],_) bs) = do
536+ let (hs, bs') = span isHeaderBlock bs
537+ header <- blocksToOpenXML opts hs
538+ -- We put the Bibliography style on paragraphs after the header
539+ rest <- withParaProp (pStyle "Bibliography") $ blocksToOpenXML opts bs'
540+ return (header ++ rest)
535blockToOpenXML opts (Div _ bs) = blocksToOpenXML opts bs
541blockToOpenXML opts (Div _ bs) = blocksToOpenXML opts bs
536blockToOpenXML opts (Header lev (ident,_,_) lst) = do
542blockToOpenXML opts (Header lev (ident,_,_) lst) = do
537−
538 paraProps <- withParaProp (pStyle $ "Heading" ++ show lev) $
543 paraProps <- withParaProp (pStyle $ "Heading" ++ show lev) $
539 getParaProps False
544 getParaProps False
540 contents <- inlinesToOpenXML opts lst
545 contents <- inlinesToOpenXML opts lst
541−
542 usedIdents <- gets stSectionIds
546 usedIdents <- gets stSectionIds
543 let bookmarkName = if null ident
547 let bookmarkName = if null ident
544 then uniqueIdent lst usedIdents
548 then uniqueIdent lst usedIdents