xref: /unit/docs/changes.xsls (revision 1734:3b4f1cc3117f)
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'";
8*1734Sdefan@nginx.comX:param curdate;
9*1734Sdefan@nginx.comX:param curtime;
10369Sdefan@nginx.com
11369Sdefan@nginx.comX:var conf = "document($configuration)/configuration";
12369Sdefan@nginx.com
13369Sdefan@nginx.comX:var start = {
14369Sdefan@nginx.com    X:choose {
15369Sdefan@nginx.com        X:when "$format='rpm'" {
16369Sdefan@nginx.com            !{$conf/rpm/start}
17369Sdefan@nginx.com        }
18369Sdefan@nginx.com        X:when "$format='deb'" {
19369Sdefan@nginx.com            !{$conf/deb/start}
20369Sdefan@nginx.com        }
21369Sdefan@nginx.com        X:when "$format='generic'" {
22369Sdefan@nginx.com            !{$conf/generic/start}
23369Sdefan@nginx.com        }
24369Sdefan@nginx.com    }
25369Sdefan@nginx.com}
26369Sdefan@nginx.com
27369Sdefan@nginx.comX:var indent = {
28369Sdefan@nginx.com    X:choose {
29369Sdefan@nginx.com        X:when "$format='rpm'" {
30369Sdefan@nginx.com            !{$conf/rpm/indent}
31369Sdefan@nginx.com        }
32369Sdefan@nginx.com        X:when "$format='deb'" {
33369Sdefan@nginx.com            !{$conf/deb/indent}
34369Sdefan@nginx.com        }
35369Sdefan@nginx.com        X:when "$format='generic'" {
36369Sdefan@nginx.com            !{$conf/generic/indent}
37369Sdefan@nginx.com        }
38369Sdefan@nginx.com    }
39369Sdefan@nginx.com}
40369Sdefan@nginx.com
41369Sdefan@nginx.comX:var max = {
42369Sdefan@nginx.com    X:choose {
43369Sdefan@nginx.com        X:when "$format='rpm'" {
44369Sdefan@nginx.com            !{$conf/rpm/length}
45369Sdefan@nginx.com        }
46369Sdefan@nginx.com        X:when "$format='deb'" {
47369Sdefan@nginx.com            !{$conf/deb/length}
48369Sdefan@nginx.com        }
49369Sdefan@nginx.com        X:when "$format='generic'" {
50369Sdefan@nginx.com            !{$conf/generic/length}
51369Sdefan@nginx.com        }
52369Sdefan@nginx.com    }
53369Sdefan@nginx.com}
54369Sdefan@nginx.com
55369Sdefan@nginx.comX:var br = {<br>}
56369Sdefan@nginx.com
57369Sdefan@nginx.com
58369Sdefan@nginx.comX:template = "/" { !! "change_log"; }
59369Sdefan@nginx.comX:template = "change_log" { !! "changes"; }
60369Sdefan@nginx.com
61369Sdefan@nginx.com
62369Sdefan@nginx.comX:template = "changes" {
63*1734Sdefan@nginx.com    X:var date_ = { !getdate(date="@date", curdate="$curdate") }
64*1734Sdefan@nginx.com    X:var time_ = { !gettime(time="@time", curtime="$curtime") }
65*1734Sdefan@nginx.com    X:var pday = { !padded_day(date="$date_") }
66*1734Sdefan@nginx.com    X:var dow = { !day_of_week(date="$date_") }
67369Sdefan@nginx.com    X:var apply = { !string_in_list(list="@apply", string="$pkgname") }
68369Sdefan@nginx.com    X:var pkgname_ = { !beautify(pkgname="$pkgname") }
69369Sdefan@nginx.com
70794Sdefan@nginx.com    X:choose {
71794Sdefan@nginx.com    X:when "$pkgname='unit' and $format='generic' and @rev!=1" {}
72794Sdefan@nginx.com    X:otherwise {
73369Sdefan@nginx.com    X:if "$apply=$pkgname" {
74369Sdefan@nginx.com
75369Sdefan@nginx.com    X:if "$format='generic'" {
76369Sdefan@nginx.com        X:text {
}
77369Sdefan@nginx.com
78369Sdefan@nginx.com        !{substring(concat($conf/changes/title,
79369Sdefan@nginx.com                           $pkgname_,
80369Sdefan@nginx.com                           ' ', @ver,
81369Sdefan@nginx.com                           '                                                    '),
82369Sdefan@nginx.com                    1, $conf/changes/length)}
83369Sdefan@nginx.com
84*1734Sdefan@nginx.com        !{substring($date_, 9, 2)}
85*1734Sdefan@nginx.com        !{$conf/changes/month[number(substring($date_, 6, 2))]}
86*1734Sdefan@nginx.com        !{substring($date_, 1, 4)}
87369Sdefan@nginx.com    }
88369Sdefan@nginx.com
89369Sdefan@nginx.com    X:if "$format='rpm'" {
90369Sdefan@nginx.com        !{concat('* ', $conf/changes/day[number($dow)],
91*1734Sdefan@nginx.com                 $conf/changes/month[number(substring($date_, 6, 2))],
92369Sdefan@nginx.com                 $pday, ' ',
93*1734Sdefan@nginx.com                 substring($date_, 1, 4), ' ', @packager, ' - ',
94369Sdefan@nginx.com                 @ver, '-', @rev, '%{?dist}.ngx')}
95369Sdefan@nginx.com    }
96369Sdefan@nginx.com
97369Sdefan@nginx.com    X:if "$format='deb'" {
98369Sdefan@nginx.com        !{concat($pkgname, ' (', @ver, '-', @rev,
99369Sdefan@nginx.com                 '~%%CODENAME%%) %%CODENAME%%; urgency=low')}
100369Sdefan@nginx.com
101369Sdefan@nginx.com        X:text {
}
102369Sdefan@nginx.com    }
103369Sdefan@nginx.com
104369Sdefan@nginx.com    X:text {
}
105369Sdefan@nginx.com
106369Sdefan@nginx.com    !! "change";
107369Sdefan@nginx.com
108369Sdefan@nginx.com    X:text {
}
109369Sdefan@nginx.com
110369Sdefan@nginx.com    X:if "$format='deb'" {
111369Sdefan@nginx.com        !{concat(' -- ', @packager, '  ',
112369Sdefan@nginx.com                 $conf/changes/day[number($dow)], ', ',
113369Sdefan@nginx.com                 $pday,
114*1734Sdefan@nginx.com                 $conf/changes/month[number(substring($date_, 6, 2))],
115*1734Sdefan@nginx.com                 substring($date_, 1, 4), ' ', $time_)}
116369Sdefan@nginx.com
117369Sdefan@nginx.com        X:text {
}
118369Sdefan@nginx.com        X:text {
}
119369Sdefan@nginx.com    }
120369Sdefan@nginx.com    }
121794Sdefan@nginx.com    }
122794Sdefan@nginx.com    }
123369Sdefan@nginx.com}
124369Sdefan@nginx.com
125369Sdefan@nginx.com
126369Sdefan@nginx.comX:template = "change" {
127369Sdefan@nginx.com    X:var prefix = "$conf/changes/*[local-name(.)=current()/@type]"
128369Sdefan@nginx.com
129369Sdefan@nginx.com    X:var postfix = { X:if "$prefix" { X:text {: } } }
130369Sdefan@nginx.com
131369Sdefan@nginx.com    !! "para" (prefix = "concat($start, $prefix, $postfix)");
132369Sdefan@nginx.com}
133369Sdefan@nginx.com
134369Sdefan@nginx.com
135369Sdefan@nginx.comX:template para(prefix) = "para" {
136369Sdefan@nginx.com    X:var text = { !!; }
137369Sdefan@nginx.com
138369Sdefan@nginx.com    X:if "$format='generic'" {
139369Sdefan@nginx.com        X:text {
}
140369Sdefan@nginx.com    }
141369Sdefan@nginx.com
142369Sdefan@nginx.com    !wrap(text = "normalize-space($text)",
143369Sdefan@nginx.com          prefix = { X:if "position() = 1" { !{$prefix} } else { !{$indent} } })
144369Sdefan@nginx.com}
145369Sdefan@nginx.com
146369Sdefan@nginx.com
147369Sdefan@nginx.comX:template wrap(text, prefix) {
148369Sdefan@nginx.com    X:if "$text" {
149369Sdefan@nginx.com        X:var offset = {
150369Sdefan@nginx.com            X:choose {
151369Sdefan@nginx.com                X:when "starts-with($text, concat($br, ' '))" {
152369Sdefan@nginx.com                    !{string-length($br) + 2}
153369Sdefan@nginx.com                }
154369Sdefan@nginx.com                X:when "starts-with($text, $br)" {
155369Sdefan@nginx.com                    !{string-length($br) + 1}
156369Sdefan@nginx.com                }
157369Sdefan@nginx.com                X:otherwise {
158369Sdefan@nginx.com                    1
159369Sdefan@nginx.com                }
160369Sdefan@nginx.com            }
161369Sdefan@nginx.com        }
162369Sdefan@nginx.com
163369Sdefan@nginx.com        X:var length = {
164369Sdefan@nginx.com            !length(text = "substring($text, $offset)",
165369Sdefan@nginx.com                    prefix = "string-length($prefix)",
166369Sdefan@nginx.com                    length = "$max")
167369Sdefan@nginx.com        }
168369Sdefan@nginx.com
169369Sdefan@nginx.com        !{$prefix}
170369Sdefan@nginx.com
171369Sdefan@nginx.com        !{normalize-space(translate(substring($text, $offset, $length),
172369Sdefan@nginx.com                                    ' ', ' '))}
173369Sdefan@nginx.com
174369Sdefan@nginx.com        X:text {
}
175369Sdefan@nginx.com
176369Sdefan@nginx.com        !wrap(text = "substring($text, $length + $offset)", prefix = "$indent")
177369Sdefan@nginx.com    }
178369Sdefan@nginx.com}
179369Sdefan@nginx.com
180369Sdefan@nginx.com
181369Sdefan@nginx.comX:template length(text, prefix, length) {
182369Sdefan@nginx.com    X:var break = "substring-before(substring($text, 1,
183369Sdefan@nginx.com                                    $length - $prefix + string-length($br)),
184369Sdefan@nginx.com                                    $br)"
185369Sdefan@nginx.com
186369Sdefan@nginx.com    X:choose {
187369Sdefan@nginx.com        X:when "$break" { !{string-length($break)} }
188369Sdefan@nginx.com
189369Sdefan@nginx.com        X:when "$length = 0" { !{$max - $prefix} }
190369Sdefan@nginx.com
191369Sdefan@nginx.com        X:when "string-length($text) + $prefix <= $length" {
192369Sdefan@nginx.com            !{$length - $prefix}
193369Sdefan@nginx.com        }
194369Sdefan@nginx.com
195369Sdefan@nginx.com        X:when "substring($text, $length - $prefix + 1, 1) = ' '" {
196369Sdefan@nginx.com            !{$length - $prefix + 1}
197369Sdefan@nginx.com        }
198369Sdefan@nginx.com
199369Sdefan@nginx.com        X:otherwise {
200369Sdefan@nginx.com            !length(text = "$text", prefix = "$prefix", length = "$length - 1")
201369Sdefan@nginx.com        }
202369Sdefan@nginx.com    }
203369Sdefan@nginx.com}
204369Sdefan@nginx.com
205369Sdefan@nginx.com
206369Sdefan@nginx.comX:template day_of_week(date) {
207369Sdefan@nginx.com    X:param year = "substring-before($date, '-')";
208369Sdefan@nginx.com    X:param month = "substring-before(substring-after($date, '-'), '-')";
209369Sdefan@nginx.com    X:param day = "substring-after(substring-after($date, '-'), '-')";
210369Sdefan@nginx.com
211369Sdefan@nginx.com    X:var a = "floor((14 - $month) div 12)";
212369Sdefan@nginx.com
213369Sdefan@nginx.com    X:var y = "$year - $a";
214369Sdefan@nginx.com
215369Sdefan@nginx.com    X:var m = "$month + 12 * $a - 2";
216369Sdefan@nginx.com
217369Sdefan@nginx.com    !{($day + $y + floor($y div 4) - floor($y div 100)
218369Sdefan@nginx.com    + floor($y div 400) + floor((31 * $m) div 12)) mod 7 + 1}
219369Sdefan@nginx.com}
220369Sdefan@nginx.com
221369Sdefan@nginx.com
222369Sdefan@nginx.comX:template padded_day(date) {
223369Sdefan@nginx.com    !{substring(concat('  ', format-number(substring($date, 9, 2), '##')),
224369Sdefan@nginx.com           1 + string-length(format-number(substring($date, 9, 2), '##')))}
225369Sdefan@nginx.com}
226369Sdefan@nginx.com
227369Sdefan@nginx.com
228369Sdefan@nginx.comX:template string_in_list(list, string) {
229369Sdefan@nginx.com    X:choose {
230547Sdefan@nginx.com        X:when "contains($list, ' ')" {
231547Sdefan@nginx.com            X:var str = "substring-before($list, ' ')";
232547Sdefan@nginx.com            X:choose {
233547Sdefan@nginx.com                X:when "$str=$string" {
234547Sdefan@nginx.com                    !{$string}
235547Sdefan@nginx.com                }
236547Sdefan@nginx.com                X:otherwise {
237547Sdefan@nginx.com                    !string_in_list(list="substring-after($list, ' ')",
238547Sdefan@nginx.com                                    string="$string")
239547Sdefan@nginx.com                }
240547Sdefan@nginx.com            }
241369Sdefan@nginx.com        }
242369Sdefan@nginx.com        X:otherwise {
243369Sdefan@nginx.com            X:if "$list=$string" { !{$string} }
244369Sdefan@nginx.com            X:if "$list='*'" { !{$string} }
245369Sdefan@nginx.com        }
246369Sdefan@nginx.com    }
247369Sdefan@nginx.com}
248369Sdefan@nginx.com
249369Sdefan@nginx.com
250369Sdefan@nginx.comX:template beautify(pkgname) {
251369Sdefan@nginx.com    X:choose {
252369Sdefan@nginx.com        X:when "$pkgname='unit'" {Unit}
253369Sdefan@nginx.com        X:otherwise {
254369Sdefan@nginx.com            !{$pkgname}
255369Sdefan@nginx.com        }
256369Sdefan@nginx.com    }
257369Sdefan@nginx.com}
258369Sdefan@nginx.com
259369Sdefan@nginx.com
260*1734Sdefan@nginx.comX:template getdate(date, curdate) {
261*1734Sdefan@nginx.com    X:choose {
262*1734Sdefan@nginx.com        X:when "$date=''" {
263*1734Sdefan@nginx.com            !{$curdate}
264*1734Sdefan@nginx.com        }
265*1734Sdefan@nginx.com        X:otherwise {
266*1734Sdefan@nginx.com            !{$date}
267*1734Sdefan@nginx.com        }
268*1734Sdefan@nginx.com    }
269*1734Sdefan@nginx.com}
270*1734Sdefan@nginx.com
271*1734Sdefan@nginx.com
272*1734Sdefan@nginx.comX:template gettime(time, curtime) {
273*1734Sdefan@nginx.com    X:choose {
274*1734Sdefan@nginx.com        X:when "$time=''" {
275*1734Sdefan@nginx.com            !{$curtime}
276*1734Sdefan@nginx.com        }
277*1734Sdefan@nginx.com        X:otherwise {
278*1734Sdefan@nginx.com            !{$time}
279*1734Sdefan@nginx.com        }
280*1734Sdefan@nginx.com    }
281*1734Sdefan@nginx.com}
282*1734Sdefan@nginx.com
283*1734Sdefan@nginx.com
284369Sdefan@nginx.comX:template = "at" {@}
285369Sdefan@nginx.comX:template = "br" { !{$br} }
286369Sdefan@nginx.comX:template = "nobr" { !{translate(., ' ', ' ')} }
287369Sdefan@nginx.com
288369Sdefan@nginx.com
289369Sdefan@nginx.com}
290