commit:     534ad84860ac80c3984bf96a8b31a3c8c495b403
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 22 18:12:47 2019 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Fri Mar 22 18:12:47 2019 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=534ad848

Add list-group attributes to some items

Signed-off-by: Brian Evans <grknight <AT> gentoo.org>

 bin/gen-eclass-html.sh |  6 +++---
 devbook.xsl            | 21 +++++++++++++++------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/bin/gen-eclass-html.sh b/bin/gen-eclass-html.sh
index e87f60f..f97f2c7 100755
--- a/bin/gen-eclass-html.sh
+++ b/bin/gen-eclass-html.sh
@@ -119,16 +119,16 @@ installed by emerging <code class="docutils 
literal"><span class="pre">app-porta
 <section>
 <title>Contents</title>
 <body>
-<ul>
+<list-group-d>
 EOF
 
 for i in $(find $OUTPUTDIR/ -maxdepth 1 -mindepth 1 -type d | sort); do
-       echo "<li><uri link=\"::eclass-reference/$(basename 
$i)/index.html\">$(basename $i) Reference</uri></li>" >> ${OUTPUTDIR}/text.xml
+       echo "<uri link=\"$(basename $i)/index.html\">$(basename $i) 
Reference</uri>" >> ${OUTPUTDIR}/text.xml
 done
 
 cat << EOF >> ${OUTPUTDIR}/text.xml
 
-</ul></body>
+</list-group-d></body>
 </section>
 </chapter>
 </guide>

diff --git a/devbook.xsl b/devbook.xsl
index 2c8e506..4a47b6b 100644
--- a/devbook.xsl
+++ b/devbook.xsl
@@ -205,6 +205,14 @@
     <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:template>
+
   <!-- Definition Lists -->
   <xsl:template match="dl">
     <dl><xsl:apply-templates/></dl>
@@ -279,6 +287,7 @@
   </xsl:template>
 
   <xsl:template match="uri">
+    <xsl:param name="class" />
     <xsl:choose>
       <xsl:when test="starts-with(@link, '::')">
       <!-- Ideally we would work out how many levels to nest down to save a 
few bytes but
@@ -292,7 +301,7 @@
        </xsl:variable>
         <xsl:choose>
           <xsl:when test="contains(@link, '##')">
-            <a href="{concat($relative_path_depth_recursion, 
substring-after(substring-before(@link, '##'), '::'), '/index.html#', 
substring-after(@link, '##'))}"><xsl:value-of select="."/></a>
+            <a class="{$class}" href="{concat($relative_path_depth_recursion, 
substring-after(substring-before(@link, '##'), '::'), '/index.html#', 
substring-after(@link, '##'))}"><xsl:value-of select="."/></a>
           </xsl:when>
           <xsl:when test="contains(@link, '#')">
             <xsl:variable name="anchor">
@@ -305,10 +314,10 @@
             </xsl:variable>
             <xsl:choose>
               <xsl:when test=". != ''">
-                <a href="{concat($relative_path_depth_recursion, 
substring-after(substring-before(@link, '#'), '::'), $slash, 'index.html#', 
$anchor)}"><xsl:value-of select="."/></a>
+                <a class="{$class}" 
href="{concat($relative_path_depth_recursion, 
substring-after(substring-before(@link, '#'), '::'), $slash, 'index.html#', 
$anchor)}"><xsl:value-of select="."/></a>
               </xsl:when>
               <xsl:otherwise>
-                <a href="{concat($relative_path_depth_recursion, 
substring-after(substring-before(@link, '#'), '::'), $slash, 'index.html#', 
$anchor)}"><xsl:value-of select="substring-after(@link, '#')"/></a>
+                <a class="{$class}" 
href="{concat($relative_path_depth_recursion, 
substring-after(substring-before(@link, '#'), '::'), $slash, 'index.html#', 
$anchor)}"><xsl:value-of select="substring-after(@link, '#')"/></a>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:when>
@@ -318,17 +327,17 @@
             </xsl:variable>
             <xsl:choose>
               <xsl:when test=". != ''">
-                <a href="{concat($relative_path_depth_recursion, 
substring-after(@link, '::'), $slash, 'index.html')}"><xsl:value-of 
select="."/></a>
+                <a class="{$class}" 
href="{concat($relative_path_depth_recursion, substring-after(@link, '::'), 
$slash, 'index.html')}"><xsl:value-of select="."/></a>
               </xsl:when>
               <xsl:otherwise>
-                <a href="{concat($relative_path_depth_recursion, 
substring-after(@link, '::'), $slash, 'index.html')}"><xsl:value-of 
select="document(concat(/guide/@self, $relative_path_depth_recursion, 
substring-after(@link, '::'), '/text.xml'))/guide/chapter[1]/title"/></a>
+                <a class="{$class}" 
href="{concat($relative_path_depth_recursion, substring-after(@link, '::'), 
$slash, 'index.html')}"><xsl:value-of select="document(concat(/guide/@self, 
$relative_path_depth_recursion, substring-after(@link, '::'), 
'/text.xml'))/guide/chapter[1]/title"/></a>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:when>
       <xsl:otherwise>
-        <a href="{@link}"><xsl:value-of select="."/></a>
+        <a class="{$class}" href="{@link}"><xsl:value-of select="."/></a>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>

Reply via email to