DocBook reader: honor linenumbering attribute

The attribute DocBook linenumbering="numbered" attribute on code blocks
maps to "numberLines" internally.
This commit is contained in:
Samuel Tardieu 2021-10-14 15:15:25 +02:00 committed by John MacFarlane
parent ed8877bd68
commit 628cde48cf
3 changed files with 9 additions and 0 deletions

View file

@ -907,6 +907,7 @@ parseBlock (Elem e) =
let classes' = case attrValue "language" e of
"" -> []
x -> [x]
++ ["numberLines" | attrValue "linenumbering" e == "numbered"]
return $ codeBlockWith (attrValue "id" e, classes', [])
$ trimNl $ strContentRecursive e
parseBlockquote = do

View file

@ -101,6 +101,11 @@
sub status {
print "working";
}
</programlisting>
<programlisting linenumbering="numbered">
sub status {
print &quot;working with line numbers&quot;;
}
</programlisting>
<screen>
% <command>ls</command>

View file

@ -266,6 +266,9 @@ Pandoc
]
, CodeBlock
( "" , [] , [] ) "sub status {\n print \"working\";\n}"
, CodeBlock
( "" , [ "numberLines" ] , [] )
"sub status {\n print \"working with line numbers\";\n}"
, CodeBlock ( "" , [] , [] ) "% ls"
, Para [ Str "A" , Space , Str "list:" ]
, OrderedList