commit: 12fb6e610b2ed3f486ff3a6eb397f5eae0811e5d Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Wed Dec 11 10:02:20 2019 +0000 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> CommitDate: Wed Dec 11 10:02:20 2019 +0000 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=12fb6e61
devbook.xsl: Support class="list-group" in <ul> element. This replaces <list-group-d>, which was only used for the list of eclasses. Remove <list-group-u> which was unused. Update devbook.dtd and bin/gen-eclass-html.sh accordingly. Generated output in eclass-reference/index.html is identical as before, except for an (intentionally) removed empty line before the closing </div>. Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> bin/gen-eclass-html.sh | 8 ++++---- devbook.dtd | 9 ++++----- devbook.xsl | 24 +++++++++++++++--------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/bin/gen-eclass-html.sh b/bin/gen-eclass-html.sh index 9705d04..e7a72ab 100755 --- a/bin/gen-eclass-html.sh +++ b/bin/gen-eclass-html.sh @@ -135,16 +135,16 @@ installed by emerging <c>app-portage/eclass-manpages</c>. <section> <title>Contents</title> <body> -<list-group-d> +<ul class="list-group"> EOF for i in $(find $OUTPUTDIR/ -maxdepth 1 -mindepth 1 -type d | sort); do - echo "<uri link=\"$(basename $i)/index.html\">$(basename $i) Reference</uri>" >> ${OUTPUTDIR}/text.xml + echo "<li><uri link=\"$(basename $i)/index.html\">$(basename $i) Reference</uri></li>" >> ${OUTPUTDIR}/text.xml done cat << EOF >> ${OUTPUTDIR}/text.xml - -</list-group-d></body> +</ul> +</body> </section> </chapter> </guide> diff --git a/devbook.dtd b/devbook.dtd index 96d1c9d..dac1815 100644 --- a/devbook.dtd +++ b/devbook.dtd @@ -5,8 +5,7 @@ <!-- Based on common.dtd from GuideXML --> <!ENTITY % block.class "p|pre|codesample|note|important|warning|todo - |figure|table|ul|ol|dl - |list-group-u|list-group-d"> + |figure|table|ul|ol|dl"> <!ENTITY % inline.class "sup|sub|b|c|d|e|path|uri"> <!ENTITY % all.class "%block.class;|%inline.class;"> @@ -75,7 +74,10 @@ align (left|center|right) "left"> <!ELEMENT ul (li)+> +<!ATTLIST ul class CDATA #IMPLIED> + <!ELEMENT ol (li)+> + <!ELEMENT li (#PCDATA|%all.class;)*> <!ELEMENT dl (dt, dd)+> @@ -83,9 +85,6 @@ <!-- The following is strange, but devbook.xsl expects only p elements --> <!ELEMENT dd (p)+> -<!ELEMENT list-group-u (#PCDATA|%all.class;)*> -<!ELEMENT list-group-d (#PCDATA|%all.class;)*> - <!ELEMENT sup (#PCDATA|%inline.class;)*> <!ELEMENT sub (#PCDATA|%inline.class;)*> <!ELEMENT b (#PCDATA|%inline.class;)*> diff --git a/devbook.xsl b/devbook.xsl index cadd975..94cbf96 100644 --- a/devbook.xsl +++ b/devbook.xsl @@ -204,15 +204,21 @@ </xsl:template> <xsl:template match="ul"> - <ul><xsl:apply-templates/></ul> - </xsl:template> - - <xsl:template match="list-group-d"> - <div class="list-group"><xsl:apply-templates><xsl:with-param name="class">list-group-item</xsl:with-param></xsl:apply-templates></div> - </xsl:template> - - <xsl:template match="list-group-u"> - <ul class="list-group"><xsl:apply-templates><xsl:with-param name="class">list-group-item</xsl:with-param></xsl:apply-templates></ul> + <xsl:choose> + <xsl:when test="@class='list-group'"> + <div class="list-group"> + <xsl:for-each select="li"> + <xsl:apply-templates> + <xsl:with-param name="class">list-group-item</xsl:with-param> + </xsl:apply-templates> + <xsl:value-of select='$newline'/> + </xsl:for-each> + </div> + </xsl:when> + <xsl:otherwise> + <ul><xsl:apply-templates/></ul> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- Definition Lists -->