git.iko.soy/typeable/pandoc
on master help sign in
DocBook reader: Handle menuchoice elements better.

They are now rendered with a `>` between them. Closes #1817.

commit269b33d24bba08a98ff4572f1537f0473bbae7dd authorJohn MacFarlane <jgm@berkeley.edu> dateSun 14 Dec 2014, 23:37 (12 years ago) parentc350847
1 file changed+11−4
src/Text/Pandoc/Readers/DocBook.hs+11−4
src/Text/Pandoc/Readers/DocBook.hs+11−4
@@ -169,9 +169,9 @@ List of all DocBook tags, with [x] indicating implemented,
169169[ ] guibutton - The text on a button in a GUI
170170[ ] guiicon - Graphic and/or text appearing as a icon in a GUI
171171[ ] guilabel - The text of a label in a GUI
172−[ ] guimenu - The name of a menu in a GUI
173−[ ] guimenuitem - The name of a terminal menu item in a GUI
174−[ ] guisubmenu - The name of a submenu in a GUI
172+[x] guimenu - The name of a menu in a GUI
173+[x] guimenuitem - The name of a terminal menu item in a GUI
174+[x] guisubmenu - The name of a submenu in a GUI
175175[ ] hardware - A physical part of a computer system
176176[ ] highlights - A summary of the main points of the discussed component
177177[ ] holder - The name of the individual or organization that holds a copyright
@@ -237,7 +237,7 @@ List of all DocBook tags, with [x] indicating implemented,
237237[x] mediaobject - A displayed media object (video, audio, image, etc.)
238238[ ] mediaobjectco - A media object that contains callouts
239239[x] member - An element of a simple list
240−[ ] menuchoice - A selection or series of selections from a menu
240+[x] menuchoice - A selection or series of selections from a menu
241241[ ] methodname - The name of a method
242242[ ] methodparam - Parameters to a method
243243[ ] methodsynopsis - A syntax summary for a method
@@ -928,6 +928,8 @@ parseInline (Elem e) =
928928 "varargs" -> return $ code "(...)"
929929 "keycap" -> return (str $ strContent e)
930930 "keycombo" -> keycombo <$> (mapM parseInline $ elContent e)
931+ "menuchoice" -> menuchoice <$> (mapM parseInline $
932+ filter isGuiMenu $ elContent e)
931933 "xref" -> return $ str "?" -- so at least you know something is there
932934 "email" -> return $ link ("mailto:" ++ strContent e) ""
933935 $ str $ strContent e
@@ -984,3 +986,8 @@ parseInline (Elem e) =
984986 return $ linebreak <> tit' <> segs
985987 keycombo = spanWith ("",["keycombo"],[]) .
986988 mconcat . intersperse (str "+")
989+ menuchoice = spanWith ("",["menuchoice"],[]) .
990+ mconcat . intersperse (text " > ")
991+ isGuiMenu (Elem x) = named "guimenu" x || named "guisubmenu" x ||
992+ named "guimenuitem" x
993+ isGuiMenu _ = False