Changeset c40c526


Ignore:
Timestamp:
01/17/2024 06:43:51 PM (3 months ago)
Author:
Pierre Labastie <pierre.labastie@…>
Branches:
12.1, ken/TL2024, lazarus, plabs/newcss, rahul/power-profiles-daemon, trunk, xry111/llvm18
Children:
ab6c309
Parents:
d4919db
Message:

Style sheets: fix docbook-xsl bug in autoidx

The template named generate-basic-index in
{docbook-xsl}/xhtml/autoidx.xsl has a bug that generates a div element
with a wrong xmlns:xlink attribute. See
https://github.com/docbook/xslt10-stylesheets/issues/239.
Rather than fixing docbook-xsl, which would work only in LFS (but we
want to be able to render on other distros), copy the faulty template
to our customization files (lfs-index.xsl), so that this one is used.
We can also simplify it a lot since we don't need all the cases
covered in general docbook-xsl.
Also remove the sed for this bug in the Makefile.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rd4919db rc40c526  
    4848endif
    4949
    50 
    5150blfs: html wget-list
    5251
     
    109108                stylesheets/blfs-chunked.xsl               \
    110109                $(RENDERTMP)/$(BLFSHTML)
    111         $(Q)sed -i 's/xmlns:xlink.*xlink"//' $(BASEDIR)/longindex.html
    112110
    113111        @echo "Copying CSS code and images..."
     
    143141                stylesheets/blfs-nochunks.xsl          \
    144142                $(RENDERTMP)/$(BLFSHTML)
    145         $(Q)sed -i 's/xmlns:xlink.*xlink"//' $(BASEDIR)/$(NOCHUNKS_OUTPUT)
    146143
    147144        @echo "Running Tidy and obfuscate.sh on non-chunked XHTML..."
  • stylesheets/lfs-xsl/xhtml/lfs-index.xsl

    rd4919db rc40c526  
    1 <?xml version='1.0' encoding='ISO-8859-1'?>
     1<?xml version="1.0" encoding="ISO-8859-1"?>
    22
    33<!DOCTYPE xsl:stylesheet [
     
    1616                version="1.0">
    1717
    18   <!-- This stylesheet controls how the Index is generated.
    19        Due how they are created, the original XHTML stylesheets don't make
    20        use of the entities from {docbook-xsl}/common/entities.ent.
    21        We add the relevant ones in the DOCTYPE to have more readable templates.
    22        Also, we remove support for @role and @type based Index due that it is
    23        broken when used with @zone based cross-references. -->
    24 
    25     <!-- The file name of the Index page.
    26          There is no upstream template with match="index", only a global
    27          match="*", thus the next template is enought to force the Index
    28          filename. -->
     18  <!-- Change the file name of the index page from the default ix01.html.
     19       There is no upstream template with match="index", only a global
     20       match="*", thus the following is enough to override the index
     21       filename. -->
     22
    2923  <xsl:template match="index" mode="recursive-chunk-filename">
    3024    <xsl:text>longindex.html</xsl:text>
    3125  </xsl:template>
    3226
    33   <!-- The Index title in the longindex.html page:
    34          Removed a lot of code not useful for us.
    35          Forced h1 title size.
    36        The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl
    37   Use the original template now (as in LFS)
    38   <xsl:template name="index.titlepage">
    39     <h1 class="index">
    40       <xsl:call-template name="gentext">
    41         <xsl:with-param name="key" select="$index-title"/>
    42       </xsl:call-template>
    43     </h1>
    44   </xsl:template>-->
    45 
    46     <!--Divisions:
    47           Translate alphabetical divisions titles to by-type titles.
    48           Added gentext support to divisions titles.
    49           Using h2 for divisions titles.
    50           Changed output from dl format to ul format. -->
    51     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     27  <!-- The original template in {docbook-xsl}/xhtml/autoidx.xsl has
     28  a bug (https://github.com/docbook/xslt10-stylesheets/issues/239)
     29  that generates a <div> with a wrong xmlns:xlink attribute. So copy it
     30  here where the bug does not occur, (and simplify it a lot).-->
     31
     32  <xsl:template name="generate-basic-index">
     33    <xsl:param name="scope" select="NOTANODE"/>
     34
     35    <xsl:variable name="terms" select="//indexterm
     36      [count(.|key('letter',
     37                   translate(substring(&primary;, 1, 1),
     38                             &lowercase;,
     39                             &uppercase;
     40                            )
     41                  ) [&scope;][1]) = 1]"/>
     42    <div class="index">
     43      <xsl:apply-templates select="$terms" mode="index-div-basic">
     44        <xsl:with-param name="position" select="position()"/>
     45        <xsl:with-param name="scope" select="$scope"/>
     46        <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
     47      </xsl:apply-templates>
     48    </div>
     49  </xsl:template>
     50
     51  <!-- Divisions:
     52       Override the default division titles, translating them from the default
     53       'A', 'B', etc. to 'Packages', 'Programs', etc.
     54       Add gentext support to division titles.
     55       Use h2 for division titles instead of the default h3.
     56       Change main listings from dl to ul format.
     57       The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     58
    5259  <xsl:template match="indexterm" mode="index-div-basic">
    5360    <xsl:param name="scope" select="."/>
    5461    <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
    5562    <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
    56       <!-- Make sure that we don't generate a div if there are no terms in scope -->
     63    <!-- Make sure that we don't generate a div if there are no terms in scope
     64   -->
    5765    <xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
    5866      <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
     
    136144  </xsl:template>
    137145
    138     <!-- Primary items:
    139            Changed the output format from dl to ul.
    140            Placed the term and separator into strong tags.
    141            Placed the target links into a div.
    142            Removed code for unused see and sealso childs. -->
    143     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     146  <!-- Primary items:
     147       Place term and separator into strong tags.
     148       Place target links into a div.
     149       Change main listings from dl to ul format.
     150       Removed code for unused see and sealso children.
     151      The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
    144152  <xsl:template match="indexterm" mode="index-primary">
    145153    <xsl:param name="scope" select="."/>
     
    153161      <span class='indexref'>
    154162        <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',concat($key, &sep;, &section.id;))[&scope;][1])]">
     163        <!--<xsl:for-each select="$refs[not(see) and not(secondary)][count(ancestor::node()|$scope) = count(ancestor::node()) = 0]">-->
    155164          <xsl:apply-templates select="." mode="reference">
    156165            <xsl:with-param name="scope" select="$scope"/>
     
    169178  </xsl:template>
    170179
    171     <!-- Secondary items:
    172            Changed the output format from dl to ul.
    173            Placed the term and separator into strong tags.
    174            Placed the target links into a div.
    175            Removed code for unused tertiary, see, and sealso childs. -->
    176     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     180  <!-- Secondary items:
     181       Place term and separator into strong tags.
     182       Place target links into a div.
     183       Change main listings from dl to ul format.
     184       Removed code for unused tertiary, see and sealso children.
     185      The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
    177186  <xsl:template match="indexterm" mode="index-secondary">
    178187    <xsl:param name="scope" select="."/>
Note: See TracChangeset for help on using the changeset viewer.