@@ -492,7 +492,7 @@ List of all DocBook tags, with [x] indicating implemented,
492492 anything else
493493[ ] xref - A cross reference to another part of the document
494494[ ] year - The year of publication of a document
495−
495+[x] ?asciidoc-br? - line break from asciidoc docbook output
496496-}
497497
498498type DB = State DBState
@@ -507,7 +507,7 @@ data DBState = DBState{ dbSectionLevel :: Int
507507
508508readDocBook :: ReaderOptions -> String -> Pandoc
509509readDocBook _ inp = Pandoc (dbMeta st') (toList $ mconcat bs)
510− where (bs, st') = runState (mapM parseBlock $ normalizeTree $ parseXML inp)
510+ where (bs, st') = runState (mapM parseBlock $ normalizeTree $ parseXML inp')
511511 DBState{ dbSectionLevel = 0
512512 , dbQuoteType = DoubleQuote
513513 , dbMeta = mempty
@@ -515,6 +515,17 @@ readDocBook _ inp = Pandoc (dbMeta st') (toList $ mconcat bs)
515515 , dbBook = False
516516 , dbFigureTitle = mempty
517517 }
518+ inp' = handleInstructions inp
519+
520+-- We treat <?asciidoc-br?> specially (issue #1236), converting it
521+-- to <br/>, since xml-light doesn't parse the instruction correctly.
522+-- Other xml instructions are simply removed from the input stream.
523+handleInstructions :: String -> String
524+handleInstructions ('<':'?':'a':'s':'c':'i':'i':'d':'o':'c':'-':'b':'r':'?':'>':xs) = '<':'b':'r':'/':'>': handleInstructions xs
525+handleInstructions xs = case break (=='<') xs of
526+ (ys, []) -> ys
527+ ([], '<':zs) -> '<' : handleInstructions zs
528+ (ys, zs) -> ys ++ handleInstructions zs
518529
519530getFigure :: Element -> DB Blocks
520531getFigure e = do
@@ -920,6 +931,10 @@ parseInline (Elem e) =
920931 "footnote" -> (note . mconcat) <$> (mapM parseBlock $ elContent e)
921932 "title" -> return mempty
922933 "affiliation" -> return mempty
934+ -- Note: this isn't a real docbook tag; it's what we convert
935+ -- <?asciidor-br?> to in handleInstructions, above. A kludge to
936+ -- work around xml-light's inability to parse an instruction.
937+ "br" -> return linebreak
923938 _ -> innerInlines
924939 where innerInlines = (trimInlines . mconcat) <$>
925940 (mapM parseInline $ elContent e)