aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2024-02-08 11:29:50 +0100
committerUlrich Müller <ulm@gentoo.org>2024-02-08 11:29:50 +0100
commitbd474970728035c6286f1071162efefd6f8d63e9 (patch)
treea85b29842a64f66a977cb014c95c76b41a2a6a5c
parentMakefile: Drop obsolete test for xmllint --quiet (diff)
downloaddevmanual-bd474970728035c6286f1071162efefd6f8d63e9.tar.gz
devmanual-bd474970728035c6286f1071162efefd6f8d63e9.tar.bz2
devmanual-bd474970728035c6286f1071162efefd6f8d63e9.zip
devbook.xsl: Add sub and sup elements
These were present in GuideXML: https://gitweb.gentoo.org/proj/devmanual.git/tree/appendices/contributing/devbook-guide/text.xml?id=8be0d382fb82dc4cfe73b1b85bb7fc3c923a21c7#n397 Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r--appendices/devbook-guide/text.xml7
-rw-r--r--devbook.rnc6
-rw-r--r--devbook.rng14
-rw-r--r--devbook.xsl8
4 files changed, 31 insertions, 4 deletions
diff --git a/appendices/devbook-guide/text.xml b/appendices/devbook-guide/text.xml
index 5015f0b..8301b0a 100644
--- a/appendices/devbook-guide/text.xml
+++ b/appendices/devbook-guide/text.xml
@@ -465,7 +465,7 @@ together:
<section>
<title>Inline elements</title>
<subsection>
-<title>&lt;c&gt;, &lt;b&gt;, and &lt;e&gt;</title>
+<title>&lt;c&gt;, &lt;b&gt;, &lt;e&gt;, &lt;sub&gt; and &lt;sup&gt;</title>
<body>
<p>
@@ -495,6 +495,11 @@ offset from the regular paragraph type for emphasis. This helps to give your
prose more <e>punch</e>!
</p>
+<p>
+The <c>&lt;sub&gt;</c> and <c>&lt;sup&gt;</c> elements are used to specify
+<sub>subscript</sub> and <sup>superscript</sup>.
+</p>
+
</body>
</subsection>
<subsection>
diff --git a/devbook.rnc b/devbook.rnc
index 158f372..22f7c09 100644
--- a/devbook.rnc
+++ b/devbook.rnc
@@ -1,4 +1,4 @@
-# Copyright 2022-2023 Gentoo Authors
+# Copyright 2022-2024 Gentoo Authors
# Distributed under the terms of the MIT license
# or the CC-BY-SA-4.0 license (dual-licensed)
@@ -7,7 +7,7 @@
block.class = p | pre | codesample | note | important | warning | todo
| figure | table | ul | ol | dl
-attrib.class = text | b | c | e
+attrib.class = text | b | c | e | sub | sup
inline.class = attrib.class | d | uri
attrib = attrib.class*
@@ -112,6 +112,8 @@ dd = element dd { all }
b = element b { inline }
c = element c { inline }
e = element e { inline }
+sub = element sub { inline }
+sup = element sup { inline }
d = element d { empty }
uri = element uri {
diff --git a/devbook.rng b/devbook.rng
index c3c616f..3963ab1 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-2023 Gentoo Authors
+ Copyright 2022-2024 Gentoo Authors
Distributed under the terms of the MIT license
or the CC-BY-SA-4.0 license (dual-licensed)
-->
@@ -32,6 +32,8 @@
<ref name="b"/>
<ref name="c"/>
<ref name="e"/>
+ <ref name="sub"/>
+ <ref name="sup"/>
</choice>
</define>
<define name="inline.class">
@@ -382,6 +384,16 @@
<ref name="inline"/>
</element>
</define>
+ <define name="sub">
+ <element name="sub">
+ <ref name="inline"/>
+ </element>
+ </define>
+ <define name="sup">
+ <element name="sup">
+ <ref name="inline"/>
+ </element>
+ </define>
<define name="d">
<element name="d">
<empty/>
diff --git a/devbook.xsl b/devbook.xsl
index 71a74dd..6f2e4e9 100644
--- a/devbook.xsl
+++ b/devbook.xsl
@@ -280,6 +280,14 @@
<code class="docutils literal"><span class="pre"><xsl:apply-templates/></span></code>
</xsl:template>
+<xsl:template match="sub">
+ <sub><xsl:apply-templates/></sub>
+</xsl:template>
+
+<xsl:template match="sup">
+ <sup><xsl:apply-templates/></sup>
+</xsl:template>
+
<xsl:template name="convert-to-anchor">
<xsl:param name="data"/>
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz-</xsl:variable>