Changeset 4d4915a


Ignore:
Timestamp:
10/09/2013 11:46:50 PM (11 years ago)
Author:
Matthew Burgess <matthew@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 7.5, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
2971a56
Parents:
58675ce
Message:

Fix the formatting of the index in HTML output.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10357 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • general.ent

    r58675ce r4d4915a  
    1 <!ENTITY version         "SVN-20131009">
    2 <!ENTITY releasedate     "October 9, 2013">
     1<!ENTITY version         "SVN-20131010">
     2<!ENTITY releasedate     "October 10, 2013">
    33<!ENTITY copyrightdate   "1999-2013"><!-- jhalfs needs a literal dash, not &ndash; -->
    44<!ENTITY milestone       "7.5">
  • stylesheets/lfs-xsl/xhtml/lfs-index.xsl

    r58675ce r4d4915a  
    1 <?xml version='1.0' encoding='ISO-8859-1'?>
     1<?xml version="1.0" encoding="ISO-8859-1"?>
    22
    33<!--
     
    2121                version="1.0">
    2222
    23   <!-- This stylesheet controls how the Index is generated.
    24        Due how they are created, the original XHTML stylesheets don't make
    25        use of the entities from {docbook-xsl}/common/entities.ent.
    26        We add the relevant ones in the DOCTYPE to have more readable templates.
    27        Also, we remove support for @role and @type based Index due that it is
    28        broken when used with @zone based cross-references. -->
    29 
    30     <!-- The file name of the Index page.
    31          There is no upstream template with match="index", only a global
    32          match="*", thus the next template is enought to force the Index
    33          filename. -->
     23  <!-- Change the file name of the index page from the default ix01.html.
     24       There is no upstream template with match="index", only a global
     25       match="*", thus the following is enough to override the index
     26       filename. -->
     27
    3428  <xsl:template match="index" mode="recursive-chunk-filename">
    3529    <xsl:text>longindex.html</xsl:text>
    3630  </xsl:template>
    3731
    38     <!-- The Index title in the longindex.html page:
    39            Removed a lot of code not useful for us.
    40            Forced h1 title size. -->
    41     <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
    42   <xsl:template name="index.titlepage">
    43     <h1 class="index">
    44       <xsl:call-template name="gentext">
    45         <xsl:with-param name="key" select="$index-title"/>
    46       </xsl:call-template>
    47     </h1>
    48   </xsl:template>
    49 
    50     <!--Divisions:
    51           Translate alphabetical divisions titles to by-type titles.
    52           Added gentext support to divisions titles.
    53           Using h2 for divisions titles.
    54           Changed output from dl format to ul format. -->
    55     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     32  <!-- Divisions:
     33       Override the default division titles, translating them from the default
     34       'A', 'B', etc. to 'Packages', 'Programs', etc.
     35       Add gentext support to division titles.
     36       Use h2 for division titles instead of the default h3.
     37       Change main listings from dl to ul format.
     38       The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     39
    5640  <xsl:template match="indexterm" mode="index-div-basic">
    5741    <xsl:param name="scope" select="."/>
    5842    <xsl:variable name="key" select="translate(substring(&primary;, 1, 1),&lowercase;,&uppercase;)"/>
    5943    <xsl:variable name="divtitle" select="translate($key, &lowercase;, &uppercase;)"/>
    60       <!-- Make sure that we don't generate a div if there are no terms in scope -->
     44    <!-- Make sure that we don't generate a div if there are no terms in scope
     45   -->
    6146    <xsl:if test="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1]) = 1]">
    6247      <xsl:if test="contains(concat(&lowercase;, &uppercase;), $key)">
     
    132117      </xsl:if>
    133118      <ul>
    134         <xsl:apply-templates select="key('letter', $key)[&scope;] [count(.|key('primary', &primary;)[&scope;][1])=1]"
    135                               mode="index-primary">
    136           <xsl:with-param name="scope" select="$scope"/>
    137           <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
    138         </xsl:apply-templates>
     119      <xsl:apply-templates select="key('letter', $key)[count(ancestor::node()|$scope) = count(ancestor::node())][count(.|key('primary', normalize-space(concat(primary/@sortas, &quot; &quot;, primary)))[count(ancestor::node()|$scope) = count(ancestor::node())][1])=1]" mode="index-primary">
     120        <xsl:with-param name="scope" select="$scope"/>
     121        <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
     122      </xsl:apply-templates>
    139123      </ul>
    140124    </xsl:if>
    141125  </xsl:template>
    142126
    143     <!-- Dropping $term.separator and $number.separator from here.
    144          We add our customized ones in the output flow.
    145          As all our indexterm have @zone attributes, removed a lot of
    146          unused code. -->
    147     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
    148   <xsl:template match="indexterm" mode="reference">
    149     <xsl:param name="scope" select="."/>
    150     <xsl:call-template name="reference">
    151       <xsl:with-param name="zones" select="normalize-space(@zone)"/>
    152       <xsl:with-param name="scope" select="$scope"/>
    153     </xsl:call-template>
    154   </xsl:template>
    155 
    156     <!-- Primary items:
    157            Changed the output format from dl to ul.
    158            Placed the term and separator into strong tags.
    159            Placed the target links into a div.
    160            Removed code for unused see and sealso childs. -->
    161     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     127  <!-- Primary items:
     128       Place term and separator into strong tags.
     129       Place target links into a div.
     130       Change main listings from dl to ul format.
     131       Removed code for unused see and sealso children.
     132       The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
    162133  <xsl:template match="indexterm" mode="index-primary">
    163134    <xsl:param name="scope" select="."/>
    164     <xsl:variable name="key" select="&primary;"/>
    165     <xsl:variable name="refs" select="key('primary', $key)[&scope;]"/>
     135    <xsl:variable name="key" select="normalize-space(concat(primary/@sortas, &quot; &quot;, primary))"/>
     136    <xsl:variable name="refs" select="key('primary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())]"/>
    166137    <li>
    167138      <strong class="item">
     
    171142      <span class='indexref'>
    172143        <xsl:for-each select="$refs[generate-id() = generate-id(key('primary-section',concat($key, &sep;, &section.id;))[&scope;][1])]">
     144        <!--<xsl:for-each select="$refs[not(see) and not(secondary)][count(ancestor::node()|$scope) = count(ancestor::node()) = 0]">-->
    173145          <xsl:apply-templates select="." mode="reference">
    174146            <xsl:with-param name="scope" select="$scope"/>
     
    178150      <xsl:if test="$refs/secondary">
    179151        <ul>
    180           <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &sep;, &secondary;))[&scope;][1]) = 1]"
    181                                mode="index-secondary">
     152          <xsl:apply-templates select="$refs[secondary and count(.|key('secondary', concat($key, &quot; &quot;, normalize-space(concat(secondary/@sortas, &quot; &quot;, secondary))))[count(ancestor::node()|$scope) = count(ancestor::node()) ][1]) = 1]" mode="index-secondary">
    182153            <xsl:with-param name="scope" select="$scope"/>
    183154            <xsl:sort select="translate(&secondary;, &lowercase;, &uppercase;)"/>
     
    188159  </xsl:template>
    189160
    190     <!-- Secondary items:
    191            Changed the output format from dl to ul.
    192            Placed the term and separator into strong tags.
    193            Placed the target links into a div.
    194            Removed code for unused tertiary, see, and sealso childs. -->
    195     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     161  <!-- Secondary items:
     162       Place term and separator into strong tags.
     163       Place target links into a div.
     164       Change main listings from dl to ul format.
     165       Removed code for unused tertiary, see and sealso children.
     166      The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
    196167  <xsl:template match="indexterm" mode="index-secondary">
    197168    <xsl:param name="scope" select="."/>
    198     <xsl:variable name="key" select="concat(&primary;, &sep;, &secondary;)"/>
    199     <xsl:variable name="refs" select="key('secondary', $key)[&scope;]"/>
     169    <xsl:variable name="key" select="concat(normalize-space(concat(primary/@sortas, &quot; &quot;, primary)), &quot; &quot;, normalize-space(concat(secondary/@sortas, &quot; &quot;, secondary)))"/>
     170    <xsl:variable name="refs" select="key('secondary', $key)[count(ancestor::node()|$scope) = count(ancestor::node())]"/>
    200171    <li>
    201172      <strong class="secitem">
     
    213184  </xsl:template>
    214185
    215     <!-- The target links:
    216            Changed links separator.
    217            On the second @zone link, we use a fixed string for the text
    218            with gentext support.
    219            Assume that there is no more than 2 @zone in a indexterm.
    220            Use href.target.uri named template to resolve the links. It is faster
    221            than the default href.target named template. -->
    222     <!-- The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     186  <!-- Drop $term.separator and $number.separator from here as customized ones
     187       are added in the output flow.
     188       As all the indexterms in the book have @zone attributes, removed a lot of
     189       unused code.
     190       The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
     191  <xsl:template match="indexterm" mode="reference">
     192    <xsl:param name="scope" select="."/>
     193    <xsl:call-template name="reference">
     194      <xsl:with-param name="zones" select="normalize-space(@zone)"/>
     195      <xsl:with-param name="scope" select="$scope"/>
     196    </xsl:call-template>
     197  </xsl:template>
     198
     199  <!-- The target links:
     200       Changed link separator
     201       On the second @zone link, we use a fixed string for the text with gentext
     202       support.
     203       Assume that there are no more than 2 @zone in a indexterm.
     204       Use href.target.uri named template to resolve the links. It is faster
     205       than the default href.target named template.
     206       The original template is in {docbook-xsl}/xhtml/autoidx.xsl -->
    223207  <xsl:template name="reference">
    224208    <xsl:param name="scope" select="."/>
Note: See TracChangeset for help on using the changeset viewer.