git.iko.soy/typeable/pandoc
on master help sign in
DocBook Reader: fix duplicate bibliography bug (#6773)
dd3d920Nils Carlson
src/Text/Pandoc/Readers/DocBook.hs+4−5
@@ -794,11 +794,10 @@ parseBlock (Elem e) =
794 "titleabbrev" -> skip
794 "titleabbrev" -> skip
795 "authorinitials" -> skip
795 "authorinitials" -> skip
796 "bibliography" -> sect 0
796 "bibliography" -> sect 0
797− "bibliodiv" -> do
797+ "bibliodiv" ->
798− tit <- case filterChild (named "title") e of
798+ case filterChild (named "title") e of
799− Just _ -> sect 1
799+ Just _ -> sect 1
800− Nothing -> return mempty
800+ Nothing -> return mempty
801− (tit <>) <$> parseMixed para (elContent e)
802 "biblioentry" -> parseMixed para (elContent e)
801 "biblioentry" -> parseMixed para (elContent e)
803 "bibliomisc" -> parseMixed para (elContent e)
802 "bibliomisc" -> parseMixed para (elContent e)
804 "bibliomixed" -> parseMixed para (elContent e)
803 "bibliomixed" -> parseMixed para (elContent e)
test/command/docbook-bibliography.mdnew file+20
@@ -0,0 +1,20 @@
1+```
2+% pandoc -f docbook -t native --quiet
3+<bibliodiv>
4+<title>Document References</title>
5+<bibliomixed>
6+<bibliomisc><anchor xml:id="refTheFirst" xreflabel="[1]"/>[1] First reference</bibliomisc>
7+</bibliomixed>
8+<bibliomixed>
9+<bibliomisc><anchor xml:id="refTheSecond" xreflabel="[2]"/>[2] Second reference</bibliomisc>
10+</bibliomixed>
11+<bibliomixed>
12+<bibliomisc><anchor xml:id="refTheThird" xreflabel="[3]"/>[3] Third reference</bibliomisc>
13+</bibliomixed>
14+</bibliodiv>
15+^D
16+[Header 1 ("",[],[]) [Str "Document",Space,Str "References"]
17+,Para [Span ("refTheFirst",[],[]) [],Str "[1]",Space,Str "First",Space,Str "reference"]
18+,Para [Span ("refTheSecond",[],[]) [],Str "[2]",Space,Str "Second",Space,Str "reference"]
19+,Para [Span ("refTheThird",[],[]) [],Str "[3]",Space,Str "Third",Space,Str "reference"]]
20+```