DocBook reader: support more elements.

This commit is contained in:
John MacFarlane 2012-05-10 23:58:13 -07:00
parent 023bb2bb45
commit b4b5642ac7

View file

@ -141,7 +141,7 @@ List of all DocBook tags, with [x] indicating implemented,
[ ] footnoteref - A cross reference to a footnote (a footnote mark)
[x] foreignphrase - A word or phrase in a language other than the primary
language of the document
[ ] formalpara - A paragraph with a title
[x] formalpara - A paragraph with a title
[ ] funcdef - A function (subroutine) name and its return type
[ ] funcparams - Parameters for a function referenced through a function
pointer in a synopsis
@ -330,13 +330,13 @@ List of all DocBook tags, with [x] indicating implemented,
[ ] refpurpose - A short (one sentence) synopsis of the topic of a reference
page
[x] refsect1 - A major subsection of a reference entry
[ ] refsect1info - Meta-information for a RefSect1
[x] refsect1info - Meta-information for a RefSect1
[x] refsect2 - A subsection of a RefSect1
[ ] refsect2info - Meta-information for a RefSect2
[x] refsect2info - Meta-information for a RefSect2
[x] refsect3 - A subsection of a RefSect2
[ ] refsect3info - Meta-information for a RefSect3
[x] refsect3info - Meta-information for a RefSect3
[x] refsection - A recursive section in a refentry
[ ] refsectioninfo - Meta-information for a refsection
[x] refsectioninfo - Meta-information for a refsection
[ ] refsynopsisdiv - A syntactic synopsis of the subject of the reference page
[ ] refsynopsisdivinfo - Meta-information for a RefSynopsisDiv
[ ] releaseinfo - Information about a particular release of a document
@ -361,20 +361,20 @@ List of all DocBook tags, with [x] indicating implemented,
[ ] secondary - A secondary word or phrase in an index term
[ ] secondaryie - A secondary term in an index entry, rather than in the text
[x] sect1 - A top-level section of document
[ ] sect1info - Meta-information for a Sect1
[x] sect1info - Meta-information for a Sect1
[x] sect2 - A subsection within a Sect1
[ ] sect2info - Meta-information for a Sect2
[x] sect2info - Meta-information for a Sect2
[x] sect3 - A subsection within a Sect2
[ ] sect3info - Meta-information for a Sect3
[x] sect3info - Meta-information for a Sect3
[x] sect4 - A subsection within a Sect3
[ ] sect4info - Meta-information for a Sect4
[x] sect4info - Meta-information for a Sect4
[x] sect5 - A subsection within a Sect4
[ ] sect5info - Meta-information for a Sect5
[x] sect5info - Meta-information for a Sect5
[x] section - A recursive section
[ ] sectioninfo - Meta-information for a recursive section
[ ] see - Part of an index term directing the reader instead to another entry
[x] sectioninfo - Meta-information for a recursive section
[x] see - Part of an index term directing the reader instead to another entry
in the index
[ ] seealso - Part of an index term directing the reader also to another entry
[x] seealso - Part of an index term directing the reader also to another entry
in the index
[ ] seealsoie - A See also entry in an index, rather than in the text
[ ] seeie - A See entry in an index, rather than in the text
@ -587,6 +587,12 @@ parseBlock (Elem e) =
"toc" -> return mempty -- skip TOC, since in pandoc it's autogenerated
"index" -> return mempty -- skip index, since page numbers meaningless
"para" -> para <$> getInlines e
"formalpara" -> do
tit <- case filterChild (named "title") e of
Just t -> (<> str "." <> linebreak) <$> emph
<$> getInlines t
Nothing -> return mempty
addToStart tit <$> para <$> getInlines e
"simpara" -> para <$> getInlines e
"ackno" -> para <$> getInlines e
"epigraph" -> parseBlockquote
@ -657,6 +663,16 @@ parseBlock (Elem e) =
"caption" -> return mempty
"info" -> getTitle >> getAuthors >> getDate >> return mempty
"articleinfo" -> getTitle >> getAuthors >> getDate >> return mempty
"sectioninfo" -> return mempty -- keywords & other metadata
"refsectioninfo" -> return mempty -- keywords & other metadata
"refsect1info" -> return mempty -- keywords & other metadata
"refsect2info" -> return mempty -- keywords & other metadata
"refsect3info" -> return mempty -- keywords & other metadata
"sect1info" -> return mempty -- keywords & other metadata
"sect2info" -> return mempty -- keywords & other metadata
"sect3info" -> return mempty -- keywords & other metadata
"sect4info" -> return mempty -- keywords & other metadata
"sect5info" -> return mempty -- keywords & other metadata
"chapterinfo" -> return mempty -- keywords & other metadata
"glossaryinfo" -> return mempty -- keywords & other metadata
"appendixinfo" -> return mempty -- keywords & other metadata
@ -830,6 +846,7 @@ parseInline (Elem e) =
"strikethrough" -> strikeout <$> innerInlines
_ -> emph <$> innerInlines
"footnote" -> (note . mconcat) <$> (mapM parseBlock $ elContent e)
"title" -> return mempty
_ -> innerInlines
where innerInlines = (trimInlines . mconcat) <$>
(mapM parseInline $ elContent e)