commit:     91ee1bae83604a11bd5b8d7a04ab978c88040184
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 26 19:24:16 2019 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu Dec 26 20:40:27 2019 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=91ee1bae

More conventional syntax of definition lists.

Definition lists required only "p" elements as children of "dd".
Change to a more conventional syntax where each "dt" element can be
followed by one _or_more_ "dd" elements. This agrees with both
GuideXML and HTML.

Vertical spacing for "dd" should really be done in the CSS style
sheet, instead of complicated XSL processing.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 devbook.dtd   |  5 ++---
 devbook.xsl   | 11 +----------
 devmanual.css |  5 +----
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/devbook.dtd b/devbook.dtd
index 946a7f1..455397b 100644
--- a/devbook.dtd
+++ b/devbook.dtd
@@ -80,10 +80,9 @@
 
 <!ELEMENT li            (#PCDATA|%all.class;)*>
 
-<!ELEMENT dl            (dt, dd)+>
+<!ELEMENT dl            (dt, dd+)+>
 <!ELEMENT dt            (#PCDATA|%inline.class;)*>
-<!-- The following is strange, but devbook.xsl expects only p elements -->
-<!ELEMENT dd            (p)+>
+<!ELEMENT dd            (#PCDATA|%inline.class;)*>
 
 <!ELEMENT b             (#PCDATA|%inline.class;)*>
 <!ELEMENT c             (#PCDATA|%inline.class;)*>

diff --git a/devbook.xsl b/devbook.xsl
index da60097..a8a11f1 100644
--- a/devbook.xsl
+++ b/devbook.xsl
@@ -231,16 +231,7 @@
   </xsl:template>
 
   <xsl:template match="dd">
-    <dd>
-      <xsl:for-each select="p">
-        <xsl:choose>
-        <xsl:when test="count(../p) = 1"><xsl:apply-templates/></xsl:when>
-        <xsl:when test="position() = 1"><p 
class="first"><xsl:apply-templates/></p></xsl:when>
-        <xsl:when test="position() = last()"><p 
class="last"><xsl:apply-templates/></p></xsl:when>
-        <xsl:otherwise><p><xsl:apply-templates/></p></xsl:otherwise>
-        </xsl:choose>
-      </xsl:for-each>
-    </dd>
+    <dd><xsl:apply-templates/></dd>
   </xsl:template>
 
   <xsl:template match="important">

diff --git a/devmanual.css b/devmanual.css
index 1507558..414ad1e 100644
--- a/devmanual.css
+++ b/devmanual.css
@@ -139,11 +139,8 @@ dt {
     font-weight: bold;
 }
 
-dd p.first {
+dd {
     margin-top: 0.2em;
-}
-
-dd p.last {
     margin-bottom: 0.2em;
 }
 

Reply via email to