git.iko.soy/typeable/pandoc
on master help sign in
Docbook reader: implement <procedure> (#6442)

A `<procedure>` contains a sequence of `<step>`'s, or `<substeps>` that themselves contain `<step>`'s.

commitbbf04df900fd5de3efeefb4d1de82170193eccf0 authorMathieu Boespflug <m@tweag.io> dateSun 14 Jun 2020, 19:45 (6 years ago) parent89bbe76
3 files changed+36−5
src/Text/Pandoc/Readers/DocBook.hs+6−4 test/docbook-reader.docbook+24 test/docbook-reader.native+6−1
src/Text/Pandoc/Readers/DocBook.hs+6−4
@@ -314,7 +314,7 @@ List of all DocBook tags, with [x] indicating implemented,
314314 sorted
315315[ ] primaryie - A primary term in an index entry, not in the text
316316[ ] printhistory - The printing history of a document
317−[ ] procedure - A list of operations to be performed in a well-defined sequence
317+[x] procedure - A list of operations to be performed in a well-defined sequence
318318[ ] production - A production in a set of EBNF productions
319319[ ] productionrecap - A cross-reference to an EBNF production
320320[ ] productionset - A set of EBNF productions
@@ -422,7 +422,7 @@ List of all DocBook tags, with [x] indicating implemented,
422422[x] simplesect - A section of a document with no subdivisions
423423[ ] spanspec - Formatting information for a spanned column in a table
424424[ ] state - A state or province in an address
425−[ ] step - A unit of action in a procedure
425+[x] step - A unit of action in a procedure
426426[ ] stepalternatives - Alternative steps in a procedure
427427[ ] street - A street address in an address
428428[ ] structfield - A field in a structure (in the programming language sense)
@@ -433,7 +433,7 @@ List of all DocBook tags, with [x] indicating implemented,
433433[ ] subjectterm - A term in a group of terms describing the subject matter of
434434 a document
435435[x] subscript - A subscript (as in H2O, the molecular formula for water)
436−[ ] substeps - A wrapper for steps that occur within steps in a procedure
436+[x] substeps - A wrapper for steps that occur within steps in a procedure
437437[x] subtitle - The subtitle of a document
438438[x] superscript - A superscript (as in x2, the mathematical notation for x
439439 multiplied by itself)
@@ -635,7 +635,7 @@ blockTags = ["toc","index","para","formalpara","simpara",
635635 "refsect1","refsect2","refsect3","refsection", "qandadiv",
636636 "question","answer","abstract","itemizedlist","orderedlist",
637637 "variablelist","article","book","table","informaltable",
638− "informalexample", "linegroup",
638+ "informalexample", "linegroup","procedure","substeps",
639639 "screen","programlisting","example","calloutlist"] ++ admonitionTags
640640
641641admonitionTags :: [String]
@@ -774,6 +774,7 @@ parseBlock (Elem e) =
774774 orderedListWith (start,listStyle,DefaultDelim)
775775 <$> listitems
776776 "variablelist" -> definitionList <$> deflistitems
777+ "procedure" -> bulletList <$> steps
777778 "figure" -> getFigure e
778779 "mediaobject" -> para <$> getMediaobject e
779780 "caption" -> skip
@@ -841,6 +842,7 @@ parseBlock (Elem e) =
841842 callouts = mapM getBlocks $ filterChildren (named "callout") e
842843 deflistitems = mapM parseVarListEntry $ filterChildren
843844 (named "varlistentry") e
845+ steps = mapM getBlocks $ filterChildren (named "step") e
844846 parseVarListEntry e' = do
845847 let terms = filterChildren (named "term") e'
846848 let items = filterChildren (named "listitem") e'
test/docbook-reader.docbook+24
@@ -1563,5 +1563,29 @@ or here: &lt;http://example.com/&gt;
15631563 </tbody>
15641564 </tgroup>
15651565 </informaltable>
1566+ <procedure><title>An Example Procedure</title>
1567+ <step>
1568+ <para>
1569+ A Step
1570+ </para>
1571+ </step>
1572+ <step>
1573+ <para>
1574+ Another Step
1575+ </para>
1576+ <substeps>
1577+ <step>
1578+ <para>
1579+ Substeps can be nested indefinitely deep.
1580+ </para>
1581+ </step>
1582+ </substeps>
1583+ </step>
1584+ <step>
1585+ <para>
1586+ A Final Step
1587+ </para>
1588+ </step>
1589+ </procedure>
15661590</sect1>
15671591</article>
test/docbook-reader.native+6−1
@@ -575,4 +575,9 @@ Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "John",Sof
575575 ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
576576 [Plain [Str "Here's",Space,Str "another",Space,Str "one.",Space,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]])]
577577 (TableFoot ("",[],[])
578− [])]
578+ [])
579+,BulletList
580+ [[Para [Str "A",Space,Str "Step"]]
581+ ,[Para [Str "Another",Space,Str "Step"]
582+ ,Para [Str "Substeps",Space,Str "can",Space,Str "be",Space,Str "nested",Space,Str "indefinitely",Space,Str "deep."]]
583+ ,[Para [Str "A",Space,Str "Final",Space,Str "Step"]]]]