Debian Codegraph @

debian/rsthelp2man.xsl

raw symbols SCIP
1 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:str="http://exslt.org/strings"
3 extension-element-prefixes="str">
4
5 <!--
6 Copyright © 2007 Simon McVittie <http://smcv.pseudorandom.co.uk/>
7
8 Copying and distribution of this file, with or without modification,
9 are permitted in any medium without royalty provided the copyright
10 notice and this notice are preserved.
11 -->
12
13 <xsl:output method="text" indent="no" encoding="ascii"/>
14
15 <xsl:param name="name" select="'rst2html'"/>
16 <xsl:param name="date" select="'October 2007'"/>
17 <xsl:param name="source" select="'docutils'"/>
18 <xsl:param name="section" select="'1'"/>
19 <xsl:param name="section_name" select="'User Commands'"/>
20 <xsl:param name="oneliner" select="'convert reST documents to HTML'"/>
21
22 <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
23 <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
24
25 <xsl:template match="section[@names='usage']">
26 <xsl:text>.SH SYNOPSIS&#10;</xsl:text>
27
28 <xsl:text>.IP&#10;</xsl:text>
29 <xsl:value-of select="block_quote/paragraph" />
30 <xsl:text>&#10;</xsl:text>
31
32 <xsl:text>.SH DESCRIPTION&#10;</xsl:text>
33 <xsl:value-of select="paragraph" />
34 <xsl:text>&#10;</xsl:text>
35 </xsl:template>
36
37 <xsl:template match="option_string">
38 <xsl:text>\fB</xsl:text>
39 <xsl:value-of select="str:replace(., '-', '\-')"/>
40 <xsl:text>\fR</xsl:text>
41 </xsl:template>
42
43 <xsl:template match="option">
44 <xsl:apply-templates/>
45 <xsl:if test="not(position() = last())">
46 <xsl:text>, </xsl:text>
47 </xsl:if>
48 </xsl:template>
49
50 <xsl:template match="option_argument">
51 <xsl:value-of select="@delimiter"/>
52 <xsl:text>\fI</xsl:text>
53 <xsl:value-of select="."/>
54 <xsl:text>\fR</xsl:text>
55 </xsl:template>
56
57 <xsl:template match="option_list_item">
58 <xsl:text>.TP&#10;</xsl:text>
59 <xsl:apply-templates select="option_group"/>
60 <xsl:text>&#10;</xsl:text>
61 <xsl:apply-templates select="description"/>
62 <xsl:text>&#10;</xsl:text>
63 </xsl:template>
64
65 <xsl:template match="section[@names='options']/section">
66 <xsl:text>&#10;.SS&#10;\fB</xsl:text>
67 <xsl:value-of select="title"/>
68 <xsl:text>\fR&#10;</xsl:text>
69 <xsl:apply-templates select="option_list"/>
70 </xsl:template>
71
72 <xsl:template match="section[@names='options']">
73 <xsl:text>.SH OPTIONS&#10;</xsl:text>
74 <xsl:apply-templates select="section"/>
75 </xsl:template>
76
77 <xsl:template match="/">
78 <xsl:text>.TH </xsl:text>
79 <xsl:value-of select="translate($name, $lower, $upper)"/>
80 <xsl:text> "</xsl:text>
81 <xsl:value-of select="$section"/>
82 <xsl:text>" "</xsl:text>
83 <xsl:value-of select="$date"/>
84 <xsl:text>" "</xsl:text>
85 <xsl:value-of select="$source"/>
86 <xsl:text>" "</xsl:text>
87 <xsl:value-of select="$section_name"/>
88 <xsl:text>"&#10;</xsl:text>
89 <xsl:text>.SH NAME&#10;</xsl:text>
90 <xsl:value-of select="$name"/>
91 <xsl:text> \- </xsl:text>
92 <xsl:value-of select="$oneliner"/>
93 <xsl:text>&#10;</xsl:text>
94 <xsl:apply-templates select="/document/section[@names='usage']"/>
95 <xsl:apply-templates select="/document/section[@names='options']"/>
96 <xsl:text>.SH AUTHOR&#10;</xsl:text>
97 <xsl:text>This man page was generated from the \-\-help output </xsl:text>
98 <xsl:text>of the tool it documents, using a script written by </xsl:text>
99 <xsl:text>Simon McVittie for the Debian GNU/Linux system. </xsl:text>
100 <xsl:text>The script may be used by others: please see the </xsl:text>
101 <xsl:text>Debian source package if you're interested.</xsl:text>
102 </xsl:template>
103
104 </xsl:stylesheet>
105
106 <!-- vim:set sw=2 sts=2 et noai noci: -->