Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 82199 | Differences between
and this patch

Collapse All | Expand All

(-)guide.xsl (-2 / +59 lines)
Lines 1192-1198 Link Here
1192
    <xsl:choose>
1192
    <xsl:choose>
1193
      <xsl:when test="($TTOP = 'book') and ($full = 0) and (starts-with(@link, '?'))">
1193
      <xsl:when test="($TTOP = 'book') and ($full = 0) and (starts-with(@link, '?'))">
1194
        <!-- Handbook link pointing to another part/chapter, normal case -->
1194
        <!-- Handbook link pointing to another part/chapter, normal case -->
1195
        <a href="{$LINK}{@link}"><xsl:apply-templates/></a>
1195
        <xsl:choose>
1196
          <xsl:when test="$style != 'printable'">
1197
            <a href="{$LINK}{@link}"><xsl:apply-templates/></a>
1198
          </xsl:when>
1199
          <xsl:otherwise>
1200
            <a href="{$LINK}{@link}&amp;style=printable"><xsl:apply-templates/></a>
1201
          </xsl:otherwise>
1202
        </xsl:choose>
1196
      </xsl:when>
1203
      </xsl:when>
1197
      <xsl:when test="($TTOP = 'book') and ($full = 1) and (starts-with(@link, '?'))">
1204
      <xsl:when test="($TTOP = 'book') and ($full = 1) and (starts-with(@link, '?'))">
1198
        <!-- Handbook link pointing to another part/chapter
1205
        <!-- Handbook link pointing to another part/chapter
Lines 1240-1246 Link Here
1240
        </xsl:choose>
1247
        </xsl:choose>
1241
      </xsl:when>
1248
      </xsl:when>
1242
      <xsl:otherwise>
1249
      <xsl:otherwise>
1243
        <a href="{@link}"><xsl:apply-templates/></a>
1250
        <!-- Strip http://www.gentoo.org from links but leave links to viewcvs intact
1251
             Has no effect on actual www.g.o but helps when surfing on a local copy -->
1252
        <xsl:variable name="llink">
1253
          <xsl:choose>
1254
          <xsl:when test="starts-with(@link, 'http://www.gentoo.org/cgi-bin/')"><xsl:value-of select="@link" /></xsl:when>
1255
          <xsl:when test="starts-with(@link, 'http://www.gentoo.org/')"><xsl:value-of select="substring-after(@link, 'http://www.gentoo.org')" /></xsl:when>
1256
          <xsl:otherwise><xsl:value-of select="@link" /></xsl:otherwise>
1257
          </xsl:choose>
1258
        </xsl:variable>
1259
1260
        <!-- Now, insert style=printable in the URL if necessary -->
1261
        <xsl:variable name="alink">
1262
          <xsl:choose>
1263
          <xsl:when test="$style != 'printable'  or  contains($llink, 'style=printable')">
1264
            <!-- Not printable style or style=printable already in URL, copy link -->
1265
            <xsl:value-of select="$llink" />
1266
          </xsl:when>
1267
          <xsl:when test="contains($llink, '://')">
1268
            <!-- External link, copy link -->
1269
            <xsl:value-of select="$llink" />
1270
          </xsl:when>
1271
          <xsl:when test="starts-with($llink, '#')">
1272
            <!-- Anchor, copy link -->
1273
            <xsl:value-of select="$llink" />
1274
          </xsl:when>
1275
          <xsl:otherwise>
1276
            <!--  We should have eliminated all other cases,
1277
                  style printable, local link, then insert ?style=printable -->
1278
            <xsl:choose>
1279
              <xsl:when test="starts-with($llink, '?')">
1280
                <xsl:value-of select="concat( '?style=printable&amp;', substring-after($llink, '?'))" />
1281
              </xsl:when>
1282
              <xsl:when test="contains($llink, '.xml?')">
1283
                <xsl:value-of select="concat(substring-before($llink, '.xml?'), '.xml?style=printable&amp;', substring-after($llink, '.xml?'))" />
1284
              </xsl:when>
1285
              <xsl:when test="contains($llink, '.xml#')">
1286
                <xsl:value-of select="concat(substring-before($llink, '.xml#'), '.xml?style=printable#', substring-after($llink, '.xml#'))" />
1287
              </xsl:when>
1288
              <xsl:when test="substring-after($llink, '.xml') = ''">
1289
                <xsl:value-of select="concat($llink, '?style=printable')" />
1290
              </xsl:when>
1291
              <xsl:otherwise>
1292
                <!-- Have I forgotten anything?
1293
                     Copy link -->
1294
                <xsl:value-of select="$llink" />
1295
              </xsl:otherwise>
1296
            </xsl:choose>
1297
          </xsl:otherwise>
1298
          </xsl:choose>
1299
        </xsl:variable>
1300
        <a href="{$alink}"><xsl:apply-templates/></a>
1244
      </xsl:otherwise>
1301
      </xsl:otherwise>
1245
    </xsl:choose>
1302
    </xsl:choose>
1246
  </xsl:when>
1303
  </xsl:when>
(-)handbook.xsl (-12 / +30 lines)
Lines 49-60 Link Here
49
    <xsl:for-each select="part">
49
    <xsl:for-each select="part">
50
      <xsl:variable name="curpart" select="position()" />
50
      <xsl:variable name="curpart" select="position()" />
51
      <li>
51
      <li>
52
        <xsl:if test="$full = 0">
52
        <xsl:choose>
53
          <b><a href="{/book/@link}?part={$curpart}&amp;chap=0"><xsl:value-of select="title" /></a></b>
53
          <xsl:when test="$full = 0">
54
        </xsl:if>
54
            <xsl:choose>
55
        <xsl:if test="$full = 1">
55
              <xsl:when test="$style != 'printable'">
56
          <b><a href="#book_part{$curpart}"><xsl:value-of select="title" /></a></b>
56
                <b><a href="{/book/@link}?part={$curpart}&amp;chap=0"><xsl:value-of select="title" /></a></b>
57
        </xsl:if>
57
              </xsl:when>
58
              <xsl:otherwise>
59
                <b><a href="{/book/@link}?part={$curpart}&amp;chap=0&amp;style=printable"><xsl:value-of select="title" /></a></b>
60
              </xsl:otherwise>
61
            </xsl:choose>
62
          </xsl:when>
63
          <xsl:otherwise>
64
            <b><a href="#book_part{$curpart}"><xsl:value-of select="title" /></a></b>
65
          </xsl:otherwise>
66
        </xsl:choose>
58
        <xsl:if test="abstract">
67
        <xsl:if test="abstract">
59
          <br />
68
          <br />
60
          <xsl:value-of select="abstract" />
69
          <xsl:value-of select="abstract" />
Lines 63-74 Link Here
63
          <xsl:for-each select="chapter">
72
          <xsl:for-each select="chapter">
64
            <xsl:variable name="curchap" select="position()" />
73
            <xsl:variable name="curchap" select="position()" />
65
            <li>
74
            <li>
66
              <xsl:if test="$full = 0">
75
              <xsl:choose>
67
                <b><a href="{/book/@link}?part={$curpart}&amp;chap={$curchap}"><xsl:value-of select="title" /></a></b>
76
                <xsl:when test="$full = 0">
68
              </xsl:if>
77
                  <xsl:choose>
69
              <xsl:if test="$full = 1">
78
                    <xsl:when test="$style != 'printable'">
70
                <b><a href="#book_part{$curpart}_chap{$curchap}"><xsl:value-of select="title" /></a></b>
79
                      <b><a href="{/book/@link}?part={$curpart}&amp;chap={$curchap}"><xsl:value-of select="title" /></a></b>
71
              </xsl:if>
80
                    </xsl:when>
81
                    <xsl:otherwise>
82
                      <b><a href="{/book/@link}?part={$curpart}&amp;chap={$curchap}&amp;style=printable"><xsl:value-of select="title" /></a></b>
83
                    </xsl:otherwise>
84
                  </xsl:choose>
85
                </xsl:when>
86
                <xsl:otherwise>
87
                  <b><a href="#book_part{$curpart}_chap{$curchap}"><xsl:value-of select="title" /></a></b>
88
                </xsl:otherwise>
89
              </xsl:choose>
72
              <xsl:if test="abstract">
90
              <xsl:if test="abstract">
73
                <br/>
91
                <br/>
74
                <xsl:value-of select="abstract" />
92
                <xsl:value-of select="abstract" />

Return to bug 82199