aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-06-16 12:22:03 -0700
committerJohn MacFarlane <[email protected]>2025-06-16 12:44:24 -0700
commit3d124e5d39f72b50e6a9c71446a40ae17471d90d (patch)
treece7ea2f18cf22ba1149f781368abf25383be76d1
parent621839369865fb731da435786d654f639ff5ce70 (diff)
DocBook reader: be sensitive to startingnumber attribute...
on ordered lists. Closes #10912.
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs6
-rw-r--r--test/command/10912.md16
2 files changed, 20 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index c84064f4b..d1e815ab8 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -15,6 +15,7 @@ Conversion of DocBook XML to 'Pandoc' document.
-}
module Text.Pandoc.Readers.DocBook ( readDocBook ) where
import Control.Monad (MonadPlus(mplus))
+import Control.Applicative ((<|>))
import Control.Monad.State.Strict
( MonadTrans(lift),
StateT(runStateT),
@@ -932,8 +933,9 @@ parseBlock (Elem e) =
"upperroman" -> UpperRoman
_ -> Decimal
let start = fromMaybe 1 $
- filterElement (named "listitem") e
- >>= safeRead . attrValue "override"
+ (safeRead $ attrValue "startingnumber" e)
+ <|> (filterElement (named "listitem") e
+ >>= safeRead . attrValue "override")
orderedListWith (start,listStyle,DefaultDelim) . handleCompact
<$> listitems
"variablelist" -> definitionList <$> deflistitems
diff --git a/test/command/10912.md b/test/command/10912.md
new file mode 100644
index 000000000..048f179ab
--- /dev/null
+++ b/test/command/10912.md
@@ -0,0 +1,16 @@
+```
+% pandoc -f docbook -t native
+<orderedlist numeration="arabic" startingnumber="4">
+<listitem>
+<simpara>Para1</simpara>
+</listitem>
+<listitem>
+<simpara>Para2</simpara>
+</listitem>
+</orderedlist>
+^D
+[ OrderedList
+ ( 4 , Decimal , DefaultDelim )
+ [ [ Para [ Str "Para1" ] ] , [ Para [ Str "Para2" ] ] ]
+]
+```