summaryrefslogtreecommitdiff
path: root/man/html.xsl
blob: 1c811bf7b90ad3bc4093ec3ecc890d72ef797474 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
  <xsl:include href="common.xsl"/>

  <xsl:output
      method="html"
      encoding="UTF-8"
      indent="yes"/>

  <xsl:param name="citerefentry.link">1</xsl:param>
  <xsl:param name="funcsynopsis.style">ansi</xsl:param>
  <xsl:param name="html.stylesheet">manpage.css</xsl:param>

  <!--
   ! Generate urls for citations.
   !-->
  <xsl:template name="generate.citerefentry.link">
    <xsl:choose>

      <!--
       ! Link EGL citations to
       !   href="http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/$refentrytitle.html".
       !-->
      <xsl:when test="starts-with(refentrytitle, 'egl')">
        <xsl:text>http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/</xsl:text>
        <xsl:value-of select="refentrytitle"/>
        <xsl:text>.html</xsl:text>
      </xsl:when>

      <!--
       ! Link GLX citations to
       ! href="http://www.opengl.org/sdk/docs/man2/xhtml/$refentrytitle.xml".
       !-->
      <xsl:when test="starts-with(refentrytitle, 'glX')">
        <xsl:text>http://www.opengl.org/sdk/docs/man2/xhtml/</xsl:text>
        <xsl:value-of select="refentrytitle"/>
        <xsl:text>.xml</xsl:text>
      </xsl:when>

      <!--
       ! If a citation's title begins with "waffle_$x", then link it with
       ! href="waffle_$x.$manvolnum.html". For example, link a citation
       ! to waffle_context_create(3) with href="waffle_context.3.html".
       !-->

      <!-- sorted alphabetically -->
      <xsl:when test="starts-with(refentrytitle, 'waffle_attrib_list')">
        <xsl:text>waffle_attrib_list.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_config')">
        <xsl:text>waffle_config.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_context')">
        <xsl:text>waffle_context.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_display')">
        <xsl:text>waffle_display.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_dl')">
        <xsl:text>waffle_dl.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_enum')">
        <xsl:text>waffle_enum.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_error')">
        <xsl:text>waffle_error.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_gbm')">
        <xsl:text>waffle_gbm.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_glx')">
        <xsl:text>waffle_glx.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_native')">
        <xsl:text>waffle_native.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_wayland')">
        <xsl:text>waffle_wayland.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_window')">
        <xsl:text>waffle_window.3.html</xsl:text>
      </xsl:when>
      <xsl:when test="starts-with(refentrytitle, 'waffle_xegl')">
        <xsl:text>waffle_xegl.3.html</xsl:text>
      </xsl:when>

      <!--
       ! If a citation's title begins with "wflinfo", then link it with
       ! href="wflinfo.$manvolnum.html".
       !-->
      <xsl:when test="starts-with(refentrytitle, 'wflinfo')">
        <xsl:text>wflinfo.1.html</xsl:text>
      </xsl:when>

      <!--
       ! For citations that begin with "waffle" but were not matched above,
       ! we assume that the citation title is the refentrytitle of a
       ! manpage. Link with href="$refentrytitle.$manvolnum.html".
       !-->
      <xsl:when test="starts-with(refentrytitle, 'waffle')">
        <xsl:value-of select="refentrytitle"/>
        <xsl:text>.</xsl:text>
        <xsl:value-of select="manvolnum"/>
        <xsl:text>.html</xsl:text>
      </xsl:when>

      <!--
       ! Link all unmatched citations with
       ! href="http://linuxmanpages.net/manpages/fedora17/man/$manvolnum/$refentrytitle.html".
       !-->
      <xsl:otherwise>
        <xsl:text>http://linuxmanpages.net/manpages/fedora17/man</xsl:text>
        <xsl:value-of select="manvolnum"/>
        <xsl:text>/</xsl:text>
        <xsl:value-of select="refentrytitle"/>
        <xsl:text>.</xsl:text>
        <xsl:value-of select="manvolnum"/>
        <xsl:text>.html</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

</xsl:stylesheet>

<!--
  vim:sw=2 ts=2 et:
-->