~ubuntu-branches/ubuntu/saucy/yelp/saucy-proposed

« back to all changes in this revision

Viewing changes to stylesheets/man2html.xsl.in

  • Committer: Bazaar Package Importer
  • Author(s): Michael Terry
  • Date: 2011-06-28 04:56:30 UTC
  • mfrom: (1.1.48 upstream)
  • Revision ID: james.westby@ubuntu.com-20110628045630-55mwg7p3nhp4fmwb
Tags: 3.1.1-0ubuntu1
* New upstream release.
* Resync with Debian packaging, remaining Ubuntu changes:
  - Use source format 3
  - Add apport hook
  - Watch for unstable releases too
  - Suggest ttf-dejavu, instead of Recommend
  - Use autoreconf
  - debian/patches/00_no_am_gnu_gettext.patch
  - debian/patches/01_lpi.patch
  - debian/patches/05_menu_tooltip.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
2
 
 
3
 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
 
                xmlns:yelp="http://www.gnome.org/yelp/ns"
5
 
                xmlns="http://www.w3.org/1999/xhtml"
6
 
                extension-element-prefixes="yelp"
7
 
                version="1.0">
8
 
 
9
 
<xsl:import href="@XSL_GETTEXT@"/>
10
 
<xsl:import href="@XSL_COLOR@"/>
11
 
<xsl:import href="@XSL_ICONS@"/>
12
 
<xsl:import href="@XSL_HTML@"/>
13
 
<xsl:include href="yelp-common.xsl"/>
14
 
 
15
 
<xsl:param name="html.basename" select="'//index'"/>
16
 
 
17
 
<xsl:param name="linktrail" select="''"/>
18
 
 
19
 
<xsl:template mode="html.title.mode" match="Man">
20
 
  <xsl:value-of select="header/title"/>
21
 
</xsl:template>
22
 
 
23
 
<xsl:template mode="html.body.mode" match="Man">
24
 
  <!-- Invisible div that we use to calculate the indent width. -->
25
 
  <xsl:element name="div">
26
 
    <xsl:attribute name="id">invisible-char</xsl:attribute>
27
 
    <xsl:attribute name="style">
28
 
      position: absolute;
29
 
      font-family: monospace;
30
 
      visibility: hidden;
31
 
      height: auto;
32
 
      width: auto;
33
 
    </xsl:attribute>
34
 
    <xsl:text>X</xsl:text>
35
 
  </xsl:element>
36
 
  <xsl:apply-templates select="header"/>
37
 
  <xsl:apply-templates select="section"/>
38
 
</xsl:template>
39
 
 
40
 
<!-- ======================================================================= -->
41
 
 
42
 
<xsl:template match="header">
43
 
  <div class="hgroup">
44
 
    <h1 class="title">
45
 
      <xsl:value-of select="title"/>
46
 
      <xsl:text> (</xsl:text>
47
 
      <xsl:value-of select="section"/>
48
 
      <xsl:text>)</xsl:text>
49
 
    </h1>
50
 
    <h3 style="text-align: right;">
51
 
      <xsl:value-of select="collection"/>
52
 
    </h3>
53
 
    <xsl:if test="@version or @date">
54
 
      <p style="text-align: right">
55
 
        <xsl:if test="@version">
56
 
          Version: <xsl:value-of select="@version"/>
57
 
        </xsl:if>
58
 
        <xsl:if test="@version and @date"><br/></xsl:if>
59
 
        <xsl:if test="@date">
60
 
          Date: <xsl:value-of select="@date"/>
61
 
        </xsl:if>
62
 
      </p>
63
 
    </xsl:if>
64
 
  </div>
65
 
</xsl:template>
66
 
 
67
 
<xsl:template match="br">
68
 
  <br/>
69
 
</xsl:template>
70
 
 
71
 
<xsl:template match="section">
72
 
  <div class="section" style="padding-top: 1em;">
73
 
    <h2>
74
 
      <xsl:value-of select="title"/>
75
 
    </h2>
76
 
 
77
 
    <div class="section-contents" style="font-family: monospace;">
78
 
      <xsl:apply-templates select="sheet"/>
79
 
    </div>
80
 
  </div>
81
 
</xsl:template>
82
 
 
83
 
<xsl:template match="sheet">
84
 
  <xsl:element name="div">
85
 
    <xsl:attribute name="style">
86
 
      margin-bottom: 0px;
87
 
      margin-top: <xsl:value-of select="@jump"/>em;
88
 
      margin-left: <xsl:value-of select="@indent"/>ex;
89
 
    </xsl:attribute>
90
 
    <xsl:attribute name="class">sheet</xsl:attribute>
91
 
    <p><xsl:apply-templates select="span|br|a"/></p>
92
 
  </xsl:element>
93
 
</xsl:template>
94
 
 
95
 
<xsl:template match="span">
96
 
  <xsl:element name="span">
97
 
    <xsl:choose>
98
 
      <xsl:when test="@class = 'B'">
99
 
        <xsl:attribute name="style">
100
 
          font-weight: 700;
101
 
        </xsl:attribute>
102
 
      </xsl:when>
103
 
      <xsl:when test="@class = 'I'">
104
 
        <xsl:attribute name="style">
105
 
          font-style: italic;
106
 
        </xsl:attribute>
107
 
      </xsl:when>
108
 
    </xsl:choose>
109
 
 
110
 
    <xsl:value-of select="."/>
111
 
  </xsl:element>
112
 
</xsl:template>
113
 
 
114
 
<xsl:template match="a">
115
 
  <xsl:element name="a">
116
 
    <xsl:attribute name="href">
117
 
      <xsl:value-of select="@href"/>
118
 
    </xsl:attribute>
119
 
 
120
 
    <xsl:apply-templates select="span|br"/>
121
 
  </xsl:element>
122
 
</xsl:template>
123
 
 
124
 
<xsl:template name="html.head.custom">
125
 
<!--
126
 
  The following javascript function fixes up the indent of sheets
127
 
  correctly. The indent should be some number of character widths, but
128
 
  you can't do that in CSS, so we have something like "7ex" as a
129
 
  stand-in (but ex is too thin here). There's an invisible div with
130
 
  the correct styling and a single character which we measure the
131
 
  width of and update each sheet as required.
132
 
-->
133
 
<script type="text/javascript" language="javascript">
134
 
<xsl:text>
135
 
$(document).ready (function () {
136
 
  var div = document.getElementById("invisible-char");
137
 
  var width = div.clientWidth;
138
 
 
139
 
  var all_divs = document.getElementsByTagName("div");
140
 
  for (var i=0; i &lt; all_divs.length; i++) {
141
 
    var elt = all_divs[i];
142
 
    if (elt.getAttribute("class") == "sheet") {
143
 
      var indent_str = elt.style.marginLeft;
144
 
      var indent = indent_str.substr (0, indent_str.length - 2);
145
 
 
146
 
      elt.style.marginLeft = width * indent + "px";
147
 
    }
148
 
  }
149
 
});
150
 
</xsl:text>
151
 
</script>
152
 
</xsl:template>
153
 
 
154
 
 
155
 
</xsl:stylesheet>