xref: /unit/docs/changes.xsls (revision 547)
1369Sdefan@nginx.comX:stylesheet {
2369Sdefan@nginx.com
3369Sdefan@nginx.comX:output method="text";
4369Sdefan@nginx.com
5369Sdefan@nginx.comX:param format="'generic'";
6369Sdefan@nginx.comX:param pkgname="'unit'";
7369Sdefan@nginx.comX:param configuration="'change_log_conf.xml'";
8369Sdefan@nginx.com
9369Sdefan@nginx.comX:var conf = "document($configuration)/configuration";
10369Sdefan@nginx.com
11369Sdefan@nginx.comX:var start = {
12369Sdefan@nginx.com    X:choose {
13369Sdefan@nginx.com        X:when "$format='rpm'" {
14369Sdefan@nginx.com            !{$conf/rpm/start}
15369Sdefan@nginx.com        }
16369Sdefan@nginx.com        X:when "$format='deb'" {
17369Sdefan@nginx.com            !{$conf/deb/start}
18369Sdefan@nginx.com        }
19369Sdefan@nginx.com        X:when "$format='generic'" {
20369Sdefan@nginx.com            !{$conf/generic/start}
21369Sdefan@nginx.com        }
22369Sdefan@nginx.com    }
23369Sdefan@nginx.com}
24369Sdefan@nginx.com
25369Sdefan@nginx.comX:var indent = {
26369Sdefan@nginx.com    X:choose {
27369Sdefan@nginx.com        X:when "$format='rpm'" {
28369Sdefan@nginx.com            !{$conf/rpm/indent}
29369Sdefan@nginx.com        }
30369Sdefan@nginx.com        X:when "$format='deb'" {
31369Sdefan@nginx.com            !{$conf/deb/indent}
32369Sdefan@nginx.com        }
33369Sdefan@nginx.com        X:when "$format='generic'" {
34369Sdefan@nginx.com            !{$conf/generic/indent}
35369Sdefan@nginx.com        }
36369Sdefan@nginx.com    }
37369Sdefan@nginx.com}
38369Sdefan@nginx.com
39369Sdefan@nginx.comX:var max = {
40369Sdefan@nginx.com    X:choose {
41369Sdefan@nginx.com        X:when "$format='rpm'" {
42369Sdefan@nginx.com            !{$conf/rpm/length}
43369Sdefan@nginx.com        }
44369Sdefan@nginx.com        X:when "$format='deb'" {
45369Sdefan@nginx.com            !{$conf/deb/length}
46369Sdefan@nginx.com        }
47369Sdefan@nginx.com        X:when "$format='generic'" {
48369Sdefan@nginx.com            !{$conf/generic/length}
49369Sdefan@nginx.com        }
50369Sdefan@nginx.com    }
51369Sdefan@nginx.com}
52369Sdefan@nginx.com
53369Sdefan@nginx.comX:var br = {<br>}
54369Sdefan@nginx.com
55369Sdefan@nginx.com
56369Sdefan@nginx.comX:template = "/" { !! "change_log"; }
57369Sdefan@nginx.comX:template = "change_log" { !! "changes"; }
58369Sdefan@nginx.com
59369Sdefan@nginx.com
60369Sdefan@nginx.comX:template = "changes" {
61369Sdefan@nginx.com    X:var pday = { !padded_day(date="@date") }
62369Sdefan@nginx.com    X:var dow = { !day_of_week(date="@date") }
63369Sdefan@nginx.com    X:var apply = { !string_in_list(list="@apply", string="$pkgname") }
64369Sdefan@nginx.com    X:var pkgname_ = { !beautify(pkgname="$pkgname") }
65369Sdefan@nginx.com
66369Sdefan@nginx.com    X:if "$apply=$pkgname" {
67369Sdefan@nginx.com
68369Sdefan@nginx.com    X:if "$format='generic'" {
69369Sdefan@nginx.com        X:text {
}
70369Sdefan@nginx.com
71369Sdefan@nginx.com        !{substring(concat($conf/changes/title,
72369Sdefan@nginx.com                           $pkgname_,
73369Sdefan@nginx.com                           ' ', @ver,
74369Sdefan@nginx.com                           '                                                    '),
75369Sdefan@nginx.com                    1, $conf/changes/length)}
76369Sdefan@nginx.com
77369Sdefan@nginx.com        !{substring(@date, 9, 2)}
78369Sdefan@nginx.com        !{$conf/changes/month[number(substring(current()/@date,
79369Sdefan@nginx.com                                                            6, 2))]}
80369Sdefan@nginx.com        !{substring(@date, 1, 4)}
81369Sdefan@nginx.com    }
82369Sdefan@nginx.com
83369Sdefan@nginx.com    X:if "$format='rpm'" {
84369Sdefan@nginx.com        !{concat('* ', $conf/changes/day[number($dow)],
85369Sdefan@nginx.com                 $conf/changes/month[number(substring(current()/@date, 6, 2))],
86369Sdefan@nginx.com                 $pday, ' ',
87369Sdefan@nginx.com                 substring(@date, 1, 4), ' ', @packager, ' - ',
88369Sdefan@nginx.com                 @ver, '-', @rev, '%{?dist}.ngx')}
89369Sdefan@nginx.com    }
90369Sdefan@nginx.com
91369Sdefan@nginx.com    X:if "$format='deb'" {
92369Sdefan@nginx.com        !{concat($pkgname, ' (', @ver, '-', @rev,
93369Sdefan@nginx.com                 '~%%CODENAME%%) %%CODENAME%%; urgency=low')}
94369Sdefan@nginx.com
95369Sdefan@nginx.com        X:text {
}
96369Sdefan@nginx.com    }
97369Sdefan@nginx.com
98369Sdefan@nginx.com    X:text {
}
99369Sdefan@nginx.com
100369Sdefan@nginx.com    !! "change";
101369Sdefan@nginx.com
102369Sdefan@nginx.com    X:text {
}
103369Sdefan@nginx.com
104369Sdefan@nginx.com    X:if "$format='deb'" {
105369Sdefan@nginx.com        !{concat(' -- ', @packager, '  ',
106369Sdefan@nginx.com                 $conf/changes/day[number($dow)], ', ',
107369Sdefan@nginx.com                 $pday,
108369Sdefan@nginx.com                 $conf/changes/month[number(substring(current()/@date, 6, 2))],
109369Sdefan@nginx.com                 substring(@date, 1, 4), ' ', @time)}
110369Sdefan@nginx.com
111369Sdefan@nginx.com        X:text {
}
112369Sdefan@nginx.com        X:text {
}
113369Sdefan@nginx.com    }
114369Sdefan@nginx.com    }
115369Sdefan@nginx.com}
116369Sdefan@nginx.com
117369Sdefan@nginx.com
118369Sdefan@nginx.comX:template = "change" {
119369Sdefan@nginx.com    X:var prefix = "$conf/changes/*[local-name(.)=current()/@type]"
120369Sdefan@nginx.com
121369Sdefan@nginx.com    X:var postfix = { X:if "$prefix" { X:text {: } } }
122369Sdefan@nginx.com
123369Sdefan@nginx.com    !! "para" (prefix = "concat($start, $prefix, $postfix)");
124369Sdefan@nginx.com}
125369Sdefan@nginx.com
126369Sdefan@nginx.com
127369Sdefan@nginx.comX:template para(prefix) = "para" {
128369Sdefan@nginx.com    X:var text = { !!; }
129369Sdefan@nginx.com
130369Sdefan@nginx.com    X:if "$format='generic'" {
131369Sdefan@nginx.com        X:text {
}
132369Sdefan@nginx.com    }
133369Sdefan@nginx.com
134369Sdefan@nginx.com    !wrap(text = "normalize-space($text)",
135369Sdefan@nginx.com          prefix = { X:if "position() = 1" { !{$prefix} } else { !{$indent} } })
136369Sdefan@nginx.com}
137369Sdefan@nginx.com
138369Sdefan@nginx.com
139369Sdefan@nginx.comX:template wrap(text, prefix) {
140369Sdefan@nginx.com    X:if "$text" {
141369Sdefan@nginx.com        X:var offset = {
142369Sdefan@nginx.com            X:choose {
143369Sdefan@nginx.com                X:when "starts-with($text, concat($br, ' '))" {
144369Sdefan@nginx.com                    !{string-length($br) + 2}
145369Sdefan@nginx.com                }
146369Sdefan@nginx.com                X:when "starts-with($text, $br)" {
147369Sdefan@nginx.com                    !{string-length($br) + 1}
148369Sdefan@nginx.com                }
149369Sdefan@nginx.com                X:otherwise {
150369Sdefan@nginx.com                    1
151369Sdefan@nginx.com                }
152369Sdefan@nginx.com            }
153369Sdefan@nginx.com        }
154369Sdefan@nginx.com
155369Sdefan@nginx.com        X:var length = {
156369Sdefan@nginx.com            !length(text = "substring($text, $offset)",
157369Sdefan@nginx.com                    prefix = "string-length($prefix)",
158369Sdefan@nginx.com                    length = "$max")
159369Sdefan@nginx.com        }
160369Sdefan@nginx.com
161369Sdefan@nginx.com        !{$prefix}
162369Sdefan@nginx.com
163369Sdefan@nginx.com        !{normalize-space(translate(substring($text, $offset, $length),
164369Sdefan@nginx.com                                    ' ', ' '))}
165369Sdefan@nginx.com
166369Sdefan@nginx.com        X:text {
}
167369Sdefan@nginx.com
168369Sdefan@nginx.com        !wrap(text = "substring($text, $length + $offset)", prefix = "$indent")
169369Sdefan@nginx.com    }
170369Sdefan@nginx.com}
171369Sdefan@nginx.com
172369Sdefan@nginx.com
173369Sdefan@nginx.comX:template length(text, prefix, length) {
174369Sdefan@nginx.com    X:var break = "substring-before(substring($text, 1,
175369Sdefan@nginx.com                                    $length - $prefix + string-length($br)),
176369Sdefan@nginx.com                                    $br)"
177369Sdefan@nginx.com
178369Sdefan@nginx.com    X:choose {
179369Sdefan@nginx.com        X:when "$break" { !{string-length($break)} }
180369Sdefan@nginx.com
181369Sdefan@nginx.com        X:when "$length = 0" { !{$max - $prefix} }
182369Sdefan@nginx.com
183369Sdefan@nginx.com        X:when "string-length($text) + $prefix <= $length" {
184369Sdefan@nginx.com            !{$length - $prefix}
185369Sdefan@nginx.com        }
186369Sdefan@nginx.com
187369Sdefan@nginx.com        X:when "substring($text, $length - $prefix + 1, 1) = ' '" {
188369Sdefan@nginx.com            !{$length - $prefix + 1}
189369Sdefan@nginx.com        }
190369Sdefan@nginx.com
191369Sdefan@nginx.com        X:otherwise {
192369Sdefan@nginx.com            !length(text = "$text", prefix = "$prefix", length = "$length - 1")
193369Sdefan@nginx.com        }
194369Sdefan@nginx.com    }
195369Sdefan@nginx.com}
196369Sdefan@nginx.com
197369Sdefan@nginx.com
198369Sdefan@nginx.comX:template day_of_week(date) {
199369Sdefan@nginx.com    X:param year = "substring-before($date, '-')";
200369Sdefan@nginx.com    X:param month = "substring-before(substring-after($date, '-'), '-')";
201369Sdefan@nginx.com    X:param day = "substring-after(substring-after($date, '-'), '-')";
202369Sdefan@nginx.com
203369Sdefan@nginx.com    X:var a = "floor((14 - $month) div 12)";
204369Sdefan@nginx.com
205369Sdefan@nginx.com    X:var y = "$year - $a";
206369Sdefan@nginx.com
207369Sdefan@nginx.com    X:var m = "$month + 12 * $a - 2";
208369Sdefan@nginx.com
209369Sdefan@nginx.com    !{($day + $y + floor($y div 4) - floor($y div 100)
210369Sdefan@nginx.com    + floor($y div 400) + floor((31 * $m) div 12)) mod 7 + 1}
211369Sdefan@nginx.com}
212369Sdefan@nginx.com
213369Sdefan@nginx.com
214369Sdefan@nginx.comX:template padded_day(date) {
215369Sdefan@nginx.com    !{substring(concat('  ', format-number(substring($date, 9, 2), '##')),
216369Sdefan@nginx.com           1 + string-length(format-number(substring($date, 9, 2), '##')))}
217369Sdefan@nginx.com}
218369Sdefan@nginx.com
219369Sdefan@nginx.com
220369Sdefan@nginx.comX:template string_in_list(list, string) {
221369Sdefan@nginx.com    X:choose {
222*547Sdefan@nginx.com        X:when "contains($list, ' ')" {
223*547Sdefan@nginx.com            X:var str = "substring-before($list, ' ')";
224*547Sdefan@nginx.com            X:choose {
225*547Sdefan@nginx.com                X:when "$str=$string" {
226*547Sdefan@nginx.com                    !{$string}
227*547Sdefan@nginx.com                }
228*547Sdefan@nginx.com                X:otherwise {
229*547Sdefan@nginx.com                    !string_in_list(list="substring-after($list, ' ')",
230*547Sdefan@nginx.com                                    string="$string")
231*547Sdefan@nginx.com                }
232*547Sdefan@nginx.com            }
233369Sdefan@nginx.com        }
234369Sdefan@nginx.com        X:otherwise {
235369Sdefan@nginx.com            X:if "$list=$string" { !{$string} }
236369Sdefan@nginx.com            X:if "$list='*'" { !{$string} }
237369Sdefan@nginx.com        }
238369Sdefan@nginx.com    }
239369Sdefan@nginx.com}
240369Sdefan@nginx.com
241369Sdefan@nginx.com
242369Sdefan@nginx.comX:template beautify(pkgname) {
243369Sdefan@nginx.com    X:choose {
244369Sdefan@nginx.com        X:when "$pkgname='unit'" {Unit}
245369Sdefan@nginx.com        X:otherwise {
246369Sdefan@nginx.com            !{$pkgname}
247369Sdefan@nginx.com        }
248369Sdefan@nginx.com    }
249369Sdefan@nginx.com}
250369Sdefan@nginx.com
251369Sdefan@nginx.com
252369Sdefan@nginx.comX:template = "at" {@}
253369Sdefan@nginx.comX:template = "br" { !{$br} }
254369Sdefan@nginx.comX:template = "nobr" { !{translate(., ' ', ' ')} }
255369Sdefan@nginx.com
256369Sdefan@nginx.com
257369Sdefan@nginx.com}
258