xref: /unit/docs/changes.xsls (revision 794)
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
66*794Sdefan@nginx.com    X:choose {
67*794Sdefan@nginx.com    X:when "$pkgname='unit' and $format='generic' and @rev!=1" {}
68*794Sdefan@nginx.com    X:otherwise {
69369Sdefan@nginx.com    X:if "$apply=$pkgname" {
70369Sdefan@nginx.com
71369Sdefan@nginx.com    X:if "$format='generic'" {
72369Sdefan@nginx.com        X:text {
}
73369Sdefan@nginx.com
74369Sdefan@nginx.com        !{substring(concat($conf/changes/title,
75369Sdefan@nginx.com                           $pkgname_,
76369Sdefan@nginx.com                           ' ', @ver,
77369Sdefan@nginx.com                           '                                                    '),
78369Sdefan@nginx.com                    1, $conf/changes/length)}
79369Sdefan@nginx.com
80369Sdefan@nginx.com        !{substring(@date, 9, 2)}
81369Sdefan@nginx.com        !{$conf/changes/month[number(substring(current()/@date,
82369Sdefan@nginx.com                                                            6, 2))]}
83369Sdefan@nginx.com        !{substring(@date, 1, 4)}
84369Sdefan@nginx.com    }
85369Sdefan@nginx.com
86369Sdefan@nginx.com    X:if "$format='rpm'" {
87369Sdefan@nginx.com        !{concat('* ', $conf/changes/day[number($dow)],
88369Sdefan@nginx.com                 $conf/changes/month[number(substring(current()/@date, 6, 2))],
89369Sdefan@nginx.com                 $pday, ' ',
90369Sdefan@nginx.com                 substring(@date, 1, 4), ' ', @packager, ' - ',
91369Sdefan@nginx.com                 @ver, '-', @rev, '%{?dist}.ngx')}
92369Sdefan@nginx.com    }
93369Sdefan@nginx.com
94369Sdefan@nginx.com    X:if "$format='deb'" {
95369Sdefan@nginx.com        !{concat($pkgname, ' (', @ver, '-', @rev,
96369Sdefan@nginx.com                 '~%%CODENAME%%) %%CODENAME%%; urgency=low')}
97369Sdefan@nginx.com
98369Sdefan@nginx.com        X:text {
}
99369Sdefan@nginx.com    }
100369Sdefan@nginx.com
101369Sdefan@nginx.com    X:text {
}
102369Sdefan@nginx.com
103369Sdefan@nginx.com    !! "change";
104369Sdefan@nginx.com
105369Sdefan@nginx.com    X:text {
}
106369Sdefan@nginx.com
107369Sdefan@nginx.com    X:if "$format='deb'" {
108369Sdefan@nginx.com        !{concat(' -- ', @packager, '  ',
109369Sdefan@nginx.com                 $conf/changes/day[number($dow)], ', ',
110369Sdefan@nginx.com                 $pday,
111369Sdefan@nginx.com                 $conf/changes/month[number(substring(current()/@date, 6, 2))],
112369Sdefan@nginx.com                 substring(@date, 1, 4), ' ', @time)}
113369Sdefan@nginx.com
114369Sdefan@nginx.com        X:text {
}
115369Sdefan@nginx.com        X:text {
}
116369Sdefan@nginx.com    }
117369Sdefan@nginx.com    }
118*794Sdefan@nginx.com    }
119*794Sdefan@nginx.com    }
120369Sdefan@nginx.com}
121369Sdefan@nginx.com
122369Sdefan@nginx.com
123369Sdefan@nginx.comX:template = "change" {
124369Sdefan@nginx.com    X:var prefix = "$conf/changes/*[local-name(.)=current()/@type]"
125369Sdefan@nginx.com
126369Sdefan@nginx.com    X:var postfix = { X:if "$prefix" { X:text {: } } }
127369Sdefan@nginx.com
128369Sdefan@nginx.com    !! "para" (prefix = "concat($start, $prefix, $postfix)");
129369Sdefan@nginx.com}
130369Sdefan@nginx.com
131369Sdefan@nginx.com
132369Sdefan@nginx.comX:template para(prefix) = "para" {
133369Sdefan@nginx.com    X:var text = { !!; }
134369Sdefan@nginx.com
135369Sdefan@nginx.com    X:if "$format='generic'" {
136369Sdefan@nginx.com        X:text {
}
137369Sdefan@nginx.com    }
138369Sdefan@nginx.com
139369Sdefan@nginx.com    !wrap(text = "normalize-space($text)",
140369Sdefan@nginx.com          prefix = { X:if "position() = 1" { !{$prefix} } else { !{$indent} } })
141369Sdefan@nginx.com}
142369Sdefan@nginx.com
143369Sdefan@nginx.com
144369Sdefan@nginx.comX:template wrap(text, prefix) {
145369Sdefan@nginx.com    X:if "$text" {
146369Sdefan@nginx.com        X:var offset = {
147369Sdefan@nginx.com            X:choose {
148369Sdefan@nginx.com                X:when "starts-with($text, concat($br, ' '))" {
149369Sdefan@nginx.com                    !{string-length($br) + 2}
150369Sdefan@nginx.com                }
151369Sdefan@nginx.com                X:when "starts-with($text, $br)" {
152369Sdefan@nginx.com                    !{string-length($br) + 1}
153369Sdefan@nginx.com                }
154369Sdefan@nginx.com                X:otherwise {
155369Sdefan@nginx.com                    1
156369Sdefan@nginx.com                }
157369Sdefan@nginx.com            }
158369Sdefan@nginx.com        }
159369Sdefan@nginx.com
160369Sdefan@nginx.com        X:var length = {
161369Sdefan@nginx.com            !length(text = "substring($text, $offset)",
162369Sdefan@nginx.com                    prefix = "string-length($prefix)",
163369Sdefan@nginx.com                    length = "$max")
164369Sdefan@nginx.com        }
165369Sdefan@nginx.com
166369Sdefan@nginx.com        !{$prefix}
167369Sdefan@nginx.com
168369Sdefan@nginx.com        !{normalize-space(translate(substring($text, $offset, $length),
169369Sdefan@nginx.com                                    ' ', ' '))}
170369Sdefan@nginx.com
171369Sdefan@nginx.com        X:text {
}
172369Sdefan@nginx.com
173369Sdefan@nginx.com        !wrap(text = "substring($text, $length + $offset)", prefix = "$indent")
174369Sdefan@nginx.com    }
175369Sdefan@nginx.com}
176369Sdefan@nginx.com
177369Sdefan@nginx.com
178369Sdefan@nginx.comX:template length(text, prefix, length) {
179369Sdefan@nginx.com    X:var break = "substring-before(substring($text, 1,
180369Sdefan@nginx.com                                    $length - $prefix + string-length($br)),
181369Sdefan@nginx.com                                    $br)"
182369Sdefan@nginx.com
183369Sdefan@nginx.com    X:choose {
184369Sdefan@nginx.com        X:when "$break" { !{string-length($break)} }
185369Sdefan@nginx.com
186369Sdefan@nginx.com        X:when "$length = 0" { !{$max - $prefix} }
187369Sdefan@nginx.com
188369Sdefan@nginx.com        X:when "string-length($text) + $prefix <= $length" {
189369Sdefan@nginx.com            !{$length - $prefix}
190369Sdefan@nginx.com        }
191369Sdefan@nginx.com
192369Sdefan@nginx.com        X:when "substring($text, $length - $prefix + 1, 1) = ' '" {
193369Sdefan@nginx.com            !{$length - $prefix + 1}
194369Sdefan@nginx.com        }
195369Sdefan@nginx.com
196369Sdefan@nginx.com        X:otherwise {
197369Sdefan@nginx.com            !length(text = "$text", prefix = "$prefix", length = "$length - 1")
198369Sdefan@nginx.com        }
199369Sdefan@nginx.com    }
200369Sdefan@nginx.com}
201369Sdefan@nginx.com
202369Sdefan@nginx.com
203369Sdefan@nginx.comX:template day_of_week(date) {
204369Sdefan@nginx.com    X:param year = "substring-before($date, '-')";
205369Sdefan@nginx.com    X:param month = "substring-before(substring-after($date, '-'), '-')";
206369Sdefan@nginx.com    X:param day = "substring-after(substring-after($date, '-'), '-')";
207369Sdefan@nginx.com
208369Sdefan@nginx.com    X:var a = "floor((14 - $month) div 12)";
209369Sdefan@nginx.com
210369Sdefan@nginx.com    X:var y = "$year - $a";
211369Sdefan@nginx.com
212369Sdefan@nginx.com    X:var m = "$month + 12 * $a - 2";
213369Sdefan@nginx.com
214369Sdefan@nginx.com    !{($day + $y + floor($y div 4) - floor($y div 100)
215369Sdefan@nginx.com    + floor($y div 400) + floor((31 * $m) div 12)) mod 7 + 1}
216369Sdefan@nginx.com}
217369Sdefan@nginx.com
218369Sdefan@nginx.com
219369Sdefan@nginx.comX:template padded_day(date) {
220369Sdefan@nginx.com    !{substring(concat('  ', format-number(substring($date, 9, 2), '##')),
221369Sdefan@nginx.com           1 + string-length(format-number(substring($date, 9, 2), '##')))}
222369Sdefan@nginx.com}
223369Sdefan@nginx.com
224369Sdefan@nginx.com
225369Sdefan@nginx.comX:template string_in_list(list, string) {
226369Sdefan@nginx.com    X:choose {
227547Sdefan@nginx.com        X:when "contains($list, ' ')" {
228547Sdefan@nginx.com            X:var str = "substring-before($list, ' ')";
229547Sdefan@nginx.com            X:choose {
230547Sdefan@nginx.com                X:when "$str=$string" {
231547Sdefan@nginx.com                    !{$string}
232547Sdefan@nginx.com                }
233547Sdefan@nginx.com                X:otherwise {
234547Sdefan@nginx.com                    !string_in_list(list="substring-after($list, ' ')",
235547Sdefan@nginx.com                                    string="$string")
236547Sdefan@nginx.com                }
237547Sdefan@nginx.com            }
238369Sdefan@nginx.com        }
239369Sdefan@nginx.com        X:otherwise {
240369Sdefan@nginx.com            X:if "$list=$string" { !{$string} }
241369Sdefan@nginx.com            X:if "$list='*'" { !{$string} }
242369Sdefan@nginx.com        }
243369Sdefan@nginx.com    }
244369Sdefan@nginx.com}
245369Sdefan@nginx.com
246369Sdefan@nginx.com
247369Sdefan@nginx.comX:template beautify(pkgname) {
248369Sdefan@nginx.com    X:choose {
249369Sdefan@nginx.com        X:when "$pkgname='unit'" {Unit}
250369Sdefan@nginx.com        X:otherwise {
251369Sdefan@nginx.com            !{$pkgname}
252369Sdefan@nginx.com        }
253369Sdefan@nginx.com    }
254369Sdefan@nginx.com}
255369Sdefan@nginx.com
256369Sdefan@nginx.com
257369Sdefan@nginx.comX:template = "at" {@}
258369Sdefan@nginx.comX:template = "br" { !{$br} }
259369Sdefan@nginx.comX:template = "nobr" { !{translate(., ' ', ' ')} }
260369Sdefan@nginx.com
261369Sdefan@nginx.com
262369Sdefan@nginx.com}
263