diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-11-19 11:08:09 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-11-19 11:08:09 -0800 |
commit | a78bef17b96f431aa3bc31c1b9f8b24a9b5ea64a (patch) | |
tree | 49944da2fd518154a5aafaf070f1af94e05b1656 | |
parent | 3689d047a8086e91ceb58f8d6b7c9733a4ba22eb (diff) | |
download | pandoc-a78bef17b96f431aa3bc31c1b9f8b24a9b5ea64a.tar.gz |
For bibliography match Div with id 'refs', not class 'references'.
This was a mismatch between pandoc's docx, epub, latex, and markdown
writers and the behavior of pandoc-citeproc, which actually looks
for a div with id 'refs' rather than one with class 'references'.
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Slides.hs | 5 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 4 |
6 files changed, 13 insertions, 12 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 0bb9b20d7..9fa083c11 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -532,10 +532,10 @@ hierarchicalizeWithIds (Header level attr@(_,classes,_) title':xs) = do sectionContents' <- hierarchicalizeWithIds sectionContents rest' <- hierarchicalizeWithIds rest return $ Sec level newnum attr title' sectionContents' : rest' -hierarchicalizeWithIds (Div ("",["references"],[]) +hierarchicalizeWithIds (Div ("refs",classes',kvs') (Header level (ident,classes,kvs) title' : xs):ys) = hierarchicalizeWithIds (Header level (ident,"references":classes,kvs) - title' : (xs ++ ys)) + title' : Div ("refs",classes',kvs') xs : ys) hierarchicalizeWithIds (x:rest) = do rest' <- hierarchicalizeWithIds rest return $ Blk x : rest' diff --git a/src/Text/Pandoc/Slides.hs b/src/Text/Pandoc/Slides.hs index 2f7d83527..e30bd2640 100644 --- a/src/Text/Pandoc/Slides.hs +++ b/src/Text/Pandoc/Slides.hs @@ -57,8 +57,9 @@ prepSlides slideLevel = ensureStartWithH . splitHrule . extractRefsHeader splitHrule [] = [] extractRefsHeader bs = case reverse bs of - (Div ("",["references"],[]) (Header n attrs xs : ys) : zs) - -> reverse zs ++ (Header n attrs xs : [Div ("",["references"],[]) ys]) + (Div ("refs",classes,kvs) (Header n attrs xs : ys) : zs) + -> reverse zs ++ [Header n attrs xs, + Div ("refs",classes,kvs) ys] _ -> bs ensureStartWithH bs@(Header n _ _:_) | n <= slideLevel = bs diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 6c3494f0e..c95682331 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -871,10 +871,10 @@ blockToOpenXML' opts (Div (ident,classes,kvs) bs) = do Just "rtl" -> return $ local (\env -> env { envRTL = True }) Just "ltr" -> return $ local (\env -> env { envRTL = False }) _ -> return id - let (hs, bs') = if "references" `elem` classes + let (hs, bs') = if ident == "refs" then span isHeaderBlock bs else ([], bs) - let bibmod = if "references" `elem` classes + let bibmod = if ident == "refs" then withParaPropM (pStyleM "Bibliography") else id header <- dirmod $ stylemod $ blocksToOpenXML opts hs diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index ab0cf940c..a4b841efd 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -504,13 +504,13 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do let chapterHeaderLevel = writerEpubChapterLevel opts let isChapterHeader (Header n _ _) = n <= chapterHeaderLevel - isChapterHeader (Div ("",["references"],[]) (Header n _ _:_)) = + isChapterHeader (Div ("refs",_,_) (Header n _ _:_)) = n <= chapterHeaderLevel isChapterHeader _ = False let toChapters :: [Block] -> State [Int] [Chapter] toChapters [] = return [] - toChapters (Div ("",["references"],[]) bs@(Header 1 _ _:_) : rest) = + toChapters (Div ("refs",_,_) bs@(Header 1 _ _:_) : rest) = toChapters (bs ++ rest) toChapters (Header n attr@(_,classes,_) ils : bs) = do nums <- get diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 57ef589e3..ca8295f0a 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -138,8 +138,8 @@ pandocToLaTeX options (Pandoc meta blocks) = do let method = writerCiteMethod options let blocks' = if method == Biblatex || method == Natbib then case reverse blocks of - Div (_,["references"],_) _:xs -> reverse xs - _ -> blocks + Div ("refs",_,_) _:xs -> reverse xs + _ -> blocks else blocks -- see if there are internal links let isInternalLink (Link _ _ ('#':xs,_)) = [xs] diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index cba57a93b..6f3160ed2 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -217,8 +217,8 @@ pandocToMarkdown opts (Pandoc meta blocks) = do -- Strip off final 'references' header if markdown citations enabled let blocks' = if isEnabled Ext_citations opts then case reverse blocks of - (Div (_,["references"],_) _):xs -> reverse xs - _ -> blocks + (Div ("refs",_,_) _):xs -> reverse xs + _ -> blocks else blocks body <- blockListToMarkdown opts blocks' notesAndRefs' <- notesAndRefs opts |