git.iko.soy/typeable/pandoc
on master help sign in
Added link, code and info elements to DocBook Reader.
commit2f559597d54d9e37885333201434d586ff11bc2e authormb21 <mauro.bieg@gmail.com> dateThu 19 Apr 2012, 15:45 (14 years ago) parent8c181b5
1 file changed+12−5
src/Text/Pandoc/Readers/DocBook.hs+12−5
src/Text/Pandoc/Readers/DocBook.hs+12−5
@@ -79,7 +79,7 @@ List of all DocBook tags, with [x] indicating implemented:
7979 a ClassSynopsis
8080[ ] cmdsynopsis - A syntax summary for a software command
8181[ ] co - The location of a callout embedded in text
82−[ ] code - An inline code fragment
82+[x] code - An inline code fragment
8383[ ] col - Specifications for a column in an HTML table
8484[ ] colgroup - A group of columns in an HTML table
8585[ ] collab - Identifies a collaborator
@@ -177,6 +177,7 @@ List of all DocBook tags, with [x] indicating implemented:
177177[ ] indexentry - An entry in an index
178178[ ] indexinfo - Meta-information for an Index
179179[ ] indexterm - A wrapper for terms to be indexed
180+[ ] info - A wrapper for information about a component or other block. (DocBook v5)
180181[ ] informalequation - A displayed mathematical equation without a title
181182[ ] informalexample - A displayed example without a title
182183[ ] informalfigure - A untitled figure
@@ -209,7 +210,7 @@ List of all DocBook tags, with [x] indicating implemented:
209210[ ] lineage - The portion of a person's name indicating a relationship to
210211 ancestors
211212[ ] lineannotation - A comment on a line in a verbatim listing
212−[ ] link - A hypertext link
213+[x] link - A hypertext link
213214[ ] listitem - A wrapper for the elements of a list item
214215[x] literal - Inline text that is some literal value
215216[ ] literallayout - A block of text in which line breaks and white space are
@@ -405,10 +406,10 @@ List of all DocBook tags, with [x] indicating implemented:
405406[ ] subjectset - A set of terms describing the subject matter of a document
406407[ ] subjectterm - A term in a group of terms describing the subject matter of
407408 a document
408−[ ] subscript - A subscript (as in H2O, the molecular formula for water)
409+[x] subscript - A subscript (as in H2O, the molecular formula for water)
409410[ ] substeps - A wrapper for steps that occur within steps in a procedure
410411[ ] subtitle - The subtitle of a document
411−[ ] superscript - A superscript (as in x2, the mathematical notation for x
412+[x] superscript - A superscript (as in x2, the mathematical notation for x
412413 multiplied by itself)
413414[ ] surname - A family name; in western cultures the last name
414415[ ] svg:svg - An SVG graphic
@@ -527,6 +528,7 @@ parseBlock (Elem e) =
527528 "abstract" -> blockQuote <$> getBlocks e
528529 "itemizedlist" -> bulletList <$> listitems
529530 "orderedlist" -> orderedList <$> listitems -- TODO list attributes
531+ "info" -> getTitle >> getAuthors >> getDate >> return mempty
530532 "articleinfo" -> getTitle >> getAuthors >> getDate >> return mempty
531533 "programlisting" -> return $ codeBlock $ strContent e -- TODO attrs
532534 "?xml" -> return mempty
@@ -584,6 +586,7 @@ parseInline (Elem e) =
584586 return $ if qt == SingleQuote
585587 then singleQuoted contents
586588 else doubleQuoted contents
589+ "code" -> return $ code $ strContent e -- TODO attrs
587590 "literal" -> return $ code $ strContent e -- TODO attrs
588591 "varname" -> return $ codeWith ("",["varname"],[]) $ strContent e
589592 "function" -> return $ codeWith ("",["function"],[]) $ strContent e
@@ -595,6 +598,11 @@ parseInline (Elem e) =
595598 "ulink" -> link
596599 (fromMaybe "" (lookupAttrBy (\attr -> qName attr == "url")
597600 (elAttribs e))) "" <$> innerInlines
601+ "link" -> case findAttr (QName "href" Nothing $ Just "xlink") e of
602+ Just href -> link href "" <$> innerInlines
603+ _ -> link ("#"++(fromMaybe "" (lookupAttrBy
604+ (\attr -> qName attr == "linkend")
605+ (elAttribs e)))) "" <$> innerInlines
598606 "emphasis" -> case lookupAttrBy (\attr -> qName attr == "role")
599607 (elAttribs e) of
600608 Just "strong" -> strong <$> innerInlines
@@ -604,4 +612,3 @@ parseInline (Elem e) =
604612 where innerInlines = (trimInlines . mconcat) <$>
605613 (mapM parseInline $ elContent e)
606614parseInline (CRef _) = return mempty
607−