aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2023-10-21 18:27:05 +0200
committerUlrich Müller <ulm@gentoo.org>2023-10-22 10:53:33 +0200
commit5fb4841a76b2dcfc5ec0e464f6aec698eb21a5ac (patch)
tree7045d8ad55297b629dcfcde62f8de117142cc62c
parentdevbook.xsl: Force end tag for empty li elements (diff)
downloaddevmanual-5fb4841a76b2dcfc5ec0e464f6aec698eb21a5ac.tar.gz
devmanual-5fb4841a76b2dcfc5ec0e464f6aec698eb21a5ac.tar.bz2
devmanual-5fb4841a76b2dcfc5ec0e464f6aec698eb21a5ac.zip
devbook.xsl: Support type and start attributes for ordered lists
Simply copy them to the HTML output. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--devbook.rnc14
-rw-r--r--devbook.rng13
-rw-r--r--devbook.xsl7
3 files changed, 29 insertions, 5 deletions
diff --git a/devbook.rnc b/devbook.rnc
index 9fe44b8..158f372 100644
--- a/devbook.rnc
+++ b/devbook.rnc
@@ -1,4 +1,4 @@
-# Copyright 2022 Gentoo Authors
+# Copyright 2022-2023 Gentoo Authors
# Distributed under the terms of the MIT license
# or the CC-BY-SA-4.0 license (dual-licensed)
@@ -93,8 +93,16 @@ ti = element ti {
all
}
-ul = element ul { attribute class { "list-group" }?, li+ }
-ol = element ol { li+ }
+ul = element ul {
+ attribute class { "list-group" }?,
+ li+
+}
+
+ol = element ol {
+ attribute type { "1" | "A" | "a" | "I" | "i" }?,
+ li+
+}
+
li = element li { all }
dl = element dl { (dt | dd)+ }
diff --git a/devbook.rng b/devbook.rng
index cfca2b4..c3c616f 100644
--- a/devbook.rng
+++ b/devbook.rng
@@ -2,7 +2,7 @@
<!-- Auto-generated from devbook.rnc; do not edit! -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!--
- Copyright 2022 Gentoo Authors
+ Copyright 2022-2023 Gentoo Authors
Distributed under the terms of the MIT license
or the CC-BY-SA-4.0 license (dual-licensed)
-->
@@ -326,6 +326,17 @@
</define>
<define name="ol">
<element name="ol">
+ <optional>
+ <attribute name="type">
+ <choice>
+ <value>1</value>
+ <value>A</value>
+ <value>a</value>
+ <value>I</value>
+ <value>i</value>
+ </choice>
+ </attribute>
+ </optional>
<oneOrMore>
<ref name="li"/>
</oneOrMore>
diff --git a/devbook.xsl b/devbook.xsl
index 9289eab..426b2fd 100644
--- a/devbook.xsl
+++ b/devbook.xsl
@@ -186,7 +186,12 @@
</xsl:template>
<xsl:template match="ol">
- <ol><xsl:apply-templates/></ol>
+ <ol>
+ <xsl:if test="@type">
+ <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates/>
+ </ol>
</xsl:template>
<xsl:template match="ul">