summaryrefslogtreecommitdiff
path: root/docs/xslt/yodl.xsl
blob: 96fd7184544fe29af3efd6cad316b8c577ae4769 (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
<?xml version='1.0'?>
<!-- 
	DocBook to yodl converter
	Currently only for manpages

	(C) Jelmer Vernooij 					2004
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:exsl="http://exslt.org/common"
	version="1.1">

	<xsl:output method="text" encoding="iso-8859-1" standalone="yes"/>
	<xsl:strip-space elements="*"/>

	<xsl:template match="refentry">
		<xsl:text>manpage(</xsl:text>
		<xsl:value-of select="refmeta/refentrytitle"/>
		<xsl:text>)()(</xsl:text>
		<xsl:value-of select="refmeta/manvolnum"/>
		<xsl:text>)(package)()&#10;</xsl:text>

		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="emphasis">
		<xsl:text>em(</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>)</xsl:text>
	</xsl:template>

	<xsl:template match="command">
		<xsl:text>bf(</xsl:text>
		<xsl:apply-templates/>
		<xsl:text>)</xsl:text>
	</xsl:template>

	<xsl:template match="refnamediv">
		<xsl:text>manpagename(</xsl:text>
		<xsl:value-of select="refname"/>
		<xsl:text>)(</xsl:text>
		<xsl:value-of select="refpurpose"/>
		<xsl:text>)&#10;</xsl:text>
	</xsl:template>

	<xsl:template match="refsynopsisdiv">
		manpagesynopsis()
	</xsl:template>

	<xsl:template match="refsect1">
		<xsl:choose>
			<xsl:when test="title='DESCRIPTION'">
				<xsl:text>&#10;manpagedescription()&#10;&#10;</xsl:text>
			</xsl:when>
			<xsl:when test="title='OPTIONS'">
				<xsl:text>&#10;manpageoptions()&#10;&#10;</xsl:text>
			</xsl:when>
			<xsl:when test="title='FILES'">
				<xsl:text>&#10;manpagefiles()&#10;&#10;</xsl:text>
			</xsl:when>
			<xsl:when test="title='SEE ALSO'">
				<xsl:text>&#10;manpageseealso()&#10;&#10;</xsl:text>
			</xsl:when>
			<xsl:when test="title='DIAGNOSTICS'">
				<xsl:text>&#10;manpagediagnostics()&#10;&#10;</xsl:text>
			</xsl:when>
			<xsl:when test="title='BUGS'">
				<xsl:text>&#10;manpagebugs()&#10;&#10;</xsl:text>
			</xsl:when>
			<xsl:when test="title='AUTHOR'">
				<xsl:text>&#10;manpageauthor()&#10;&#10;</xsl:text>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text>&#10;manpagesection(</xsl:text>
				<xsl:value-of select="title"/>
				<xsl:text>)&#10;&#10;</xsl:text>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:for-each select="para">
			<xsl:text>&#10;&#10;</xsl:text>
			<xsl:apply-templates/>
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="itemizedlist|orderedlist">
		<xsl:text>startdit()&#10;</xsl:text>
		<xsl:for-each select="listitem">
			<xsl:text>dit() </xsl:text>
			<xsl:apply-templates/>
			<xsl:text>&#10;</xsl:text>
		</xsl:for-each>
		<xsl:text>enddit()&#10;</xsl:text>
	</xsl:template>

	<xsl:template match="variablelist">
		<xsl:text>startdit()&#10;</xsl:text>
		<xsl:for-each select="varlistentry">
			<xsl:text>dit(</xsl:text>
			<xsl:value-of select="term"/>
			<xsl:text>) </xsl:text>
			<xsl:apply-templates select="listitem"/>
			<xsl:text>&#10;</xsl:text>
		</xsl:for-each>
		<xsl:text>enddit()&#10;</xsl:text>
	</xsl:template>

	<xsl:template match="*"/>

</xsl:stylesheet>