Docx writer: Bibliography entries get Bibliography style.

Closes #1559.
This commit is contained in:
John MacFarlane 2014-08-23 20:51:18 -07:00
parent 2956ef251c
commit 0ef1f787c7
3 changed files with 9 additions and 5 deletions

6
README
View file

@ -551,9 +551,9 @@ Options affecting specific writers
used. The following styles are used by pandoc: [paragraph]
Normal, Compact, Title, Subtitle, Authors, Date, Abstract, Heading 1,
Heading 2, Heading 3, Heading 4, Heading 5, Block Quote, Definition Term,
Definition, Body Text, Table Caption, Image Caption; [character] Default
Paragraph Font, Body Text Char, Verbatim Char, Footnote Ref,
Link.
Definition, Bibliography, Body Text, Table Caption, Image Caption;
[character] Default Paragraph Font, Body Text Char, Verbatim Char,
Footnote Ref, Link.
`--epub-stylesheet=`*FILE*
: Use the specified CSS file to style the EPUB. If no stylesheet

Binary file not shown.

View file

@ -532,13 +532,17 @@ getUniqueId = liftIO $ (show . (+ 20) . hashUnique) `fmap` newUnique
-- | Convert a Pandoc block element to OpenXML.
blockToOpenXML :: WriterOptions -> Block -> WS [Element]
blockToOpenXML _ Null = return []
blockToOpenXML opts (Div (_,["references"],_) bs) = do
let (hs, bs') = span isHeaderBlock bs
header <- blocksToOpenXML opts hs
-- We put the Bibliography style on paragraphs after the header
rest <- withParaProp (pStyle "Bibliography") $ blocksToOpenXML opts bs'
return (header ++ rest)
blockToOpenXML opts (Div _ bs) = blocksToOpenXML opts bs
blockToOpenXML opts (Header lev (ident,_,_) lst) = do
paraProps <- withParaProp (pStyle $ "Heading" ++ show lev) $
getParaProps False
contents <- inlinesToOpenXML opts lst
usedIdents <- gets stSectionIds
let bookmarkName = if null ident
then uniqueIdent lst usedIdents