-
Notifications
You must be signed in to change notification settings - Fork 0
/
package2html.xsl
164 lines (153 loc) · 3.86 KB
/
package2html.xsl
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?xml version="1.0" encoding="utf-8"?>
<!-- -*- mode: xsl; coding: utf8; -*- -->
<!-- Author: pajas@ufal.ms.mff.cuni.cz -->
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:p="http://ufal.mff.cuni.cz/pdt/pml/"
version='1.0'>
<xsl:output method="html" encoding="utf-8"/>
<xsl:param name="doc" select="1"/>
<xsl:template match="/">
<html>
<head>
<style type="text/css">
/* <xsl:comment> */
* {
font-family: sans;
}
.package {
background-color: #ffffff;
border: solid 1px #aaf;
/* padding: 0 12pt 6pt 12pt; */
margin: 10pt 10pt 10pt 10pt;
}
.pkghead {
background-color: #eeeeff;
padding: 3pt 3pt 3pt 3pt;
}
.pkgtitle {
font-weight: bold;
padding: 3pt 3pt 3pt 3pt;
}
.desc {
padding: 3pt 3pt 3pt 3pt;
}
.size, .copyright, .moreinfo {
float: right;
clear: right;
padding: 3pt 6pt 0pt 3pt;
text-align: right;
}
.size {
font-size: 7pt;
}
.copyright {
font-size: 7pt;
font-style: italic;
color: #666;
}
.moreinfo {
font-size: 10pt;
}
.version {
text-align: right;
}
.pkgicon {
float: left;
padding: 6pt 6pt 6pt 6pt
}
/* </xsl:comment> */
</style>
<link href="style.css" rel="stylesheet"/>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="p:tred_extension">
<div class="package">
<div class="pkghead">
<span class="pkgtitle">
<xsl:apply-templates select="p:title"/>
</span>
<span class="version">
(<xsl:apply-templates select="p:pkgname"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="p:version"/>)
</span>
</div>
<div class="desc">
<xsl:call-template name="icon"/>
<xsl:apply-templates select="p:description"/>
<xsl:if test="$doc">
<div class="moreinfo"><small><a href="{string(p:pkgname)}/documentation/index.html">More info...</a></small>
</div>
</xsl:if>
</div>
<xsl:if test="@package_size|@install_size">
<div class="size">
<xsl:text>Size: </xsl:text>
<xsl:if test="@package_size">
<xsl:call-template name="format_size">
<xsl:with-param name="size" select="@package_size"/>
</xsl:call-template>
<xsl:text> package </xsl:text>
<xsl:if test="@install_size">
<xsl:text>/ </xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="@install_size">
<xsl:call-template name="format_size">
<xsl:with-param name="size" select="@install_size"/>
</xsl:call-template>
<xsl:text> installed</xsl:text>
</xsl:if>
</div>
</xsl:if>
<div class="copyright">
<xsl:apply-templates select="p:copyright"/>
</div>
<div style="clear:both"></div>
</div>
</xsl:template>
<xsl:template name="format_size">
<xsl:param name="size"/>
<xsl:choose>
<xsl:when test="1024 > $size">
<xsl:value-of select="$size"/>
<xsl:text> B</xsl:text>
</xsl:when>
<xsl:when test="1024*1024 > $size">
<xsl:value-of select="round($size div 1024)"/>
<xsl:text> KiB</xsl:text>
</xsl:when>
<xsl:when test="1024*1024*1024 > $size">
<xsl:value-of select="round($size div (1024*1024))"/>
<xsl:text> MiB</xsl:text>
</xsl:when>
<xsl:when test="1024*1024*1024*1024 > $size">
<xsl:value-of select="round($size div (1024*1024*1024))"/>
<xsl:text> GiB</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template match="p:copyright">
<xsl:text>Copyright (c) </xsl:text>
<xsl:apply-templates select="@year"/>
<xsl:text> by </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template name="icon">
<!-- <span class="icon"> -->
<xsl:choose>
<xsl:when test="p:icon">
<img src="{concat(string(p:pkgname),'/',string(p:icon))}" class="pkgicon"/>
</xsl:when>
<xsl:otherwise>
<img src="extension.png" style="float: left; padding: 6pt 6pt 0pt 6pt" />
</xsl:otherwise>
</xsl:choose>
<!-- </span> -->
</xsl:template>
</xsl:stylesheet>