Mercurial > hg > nginx-quic
annotate docs/xsls/changes.xsls @ 5334:03ff14058272
Added safety belt for the case of sending header twice.
The aforementioned situation is abnormal per se and as such it now forces
request termination with appropriate error message.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 30 Jul 2013 15:04:46 +0400 |
parents | 76bc29f06168 |
children | 529f10f7757c |
rev | line source |
---|---|
450 | 1 X:stylesheet { |
2 | |
4028
76bc29f06168
CHANGES conversion from KOI8-R to UTF-8.
Igor Sysoev <igor@sysoev.ru>
parents:
4025
diff
changeset
|
3 X:output method="text"; |
450 | 4 |
5 X:param lang="'en'"; | |
6 X:param configuration="'../xml/change_log_conf.xml'"; | |
7 | |
8 X:var conf = "document($configuration)/configuration"; | |
9 X:var start = "$conf/start"; | |
10 X:var indent = "$conf/indent"; | |
11 X:var max = "$conf/length"; | |
12 X:var br = {<br>} | |
13 | |
14 | |
15 X:template = "/" { !! "change_log"; } | |
16 X:template = "change_log" { !! "changes"; } | |
17 | |
18 | |
19 X:template = "changes" { | |
20 X:text { } | |
21 | |
22 !{substring(concat($conf/changes[@lang=$lang]/title, | |
23 //change_log/@title, | |
24 ' ', @ver, | |
25 ' '), | |
26 1, $conf/changes[@lang=$lang]/length)} | |
27 | |
28 X:if "$lang='ru'" { !{@date} } | |
29 | |
30 X:if "$lang='en'" { | |
31 !{substring(@date, 1, 2)} | |
32 !{$conf/changes[@lang=$lang]/month[number(substring(current()/@date, | |
33 4, 2))]} | |
34 !{substring(@date, 7, 4)} | |
35 } | |
36 | |
37 X:text { } | |
38 | |
39 !! "change"; | |
40 | |
41 X:text { } | |
42 } | |
43 | |
44 | |
45 X:template = "change" { | |
46 X:var prefix = "$conf/changes[@lang=$lang]/*[local-name(.)=current()/@type]" | |
47 | |
48 X:var postfix = { X:if "$prefix" { X:text {: } } } | |
49 | |
50 !! "para[@lang=$lang]" (prefix = "concat($start, $prefix, $postfix)"); | |
51 } | |
52 | |
53 | |
54 X:template para(prefix) = "para" { | |
55 X:var text = { !!; } | |
56 | |
57 X:text { } | |
58 | |
59 !wrap(text = "normalize-space($text)", | |
60 prefix = { X:if "position() = 1" { !{$prefix} } else { !{$indent} } }) | |
61 } | |
62 | |
63 | |
64 X:template wrap(text, prefix) { | |
65 X:if "$text" { | |
66 X:var offset = { | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
67 X:choose { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
68 X:when "starts-with($text, concat($br, ' '))" { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
69 !{string-length($br) + 2} |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
70 } |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
71 X:when "starts-with($text, $br)" { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
72 !{string-length($br) + 1} |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
73 } |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
74 X:otherwise { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
75 1 |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
76 } |
450 | 77 } |
78 } | |
79 | |
80 X:var length = { | |
81 !length(text = "substring($text, $offset)", | |
82 prefix = "string-length($prefix)", | |
83 length = "$max") | |
84 } | |
85 | |
86 !{$prefix} | |
87 | |
4025
7b85e695600a
Traling spaces removal in text CHANGES files.
Igor Sysoev <igor@sysoev.ru>
parents:
4022
diff
changeset
|
88 !{normalize-space(translate(substring($text, $offset, $length), |
7b85e695600a
Traling spaces removal in text CHANGES files.
Igor Sysoev <igor@sysoev.ru>
parents:
4022
diff
changeset
|
89 ' ', ' '))} |
450 | 90 |
91 X:text { } | |
92 | |
93 !wrap(text = "substring($text, $length + $offset)", prefix = "$indent") | |
94 } | |
95 } | |
96 | |
97 | |
98 X:template length(text, prefix, length) { | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
99 X:var break = "substring-before(substring($text, 1, |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
100 $length - $prefix + string-length($br)), |
450 | 101 $br)" |
102 | |
103 X:choose { | |
104 X:when "$break" { !{string-length($break)} } | |
105 | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
106 X:when "$length = 0" { !{$max - $prefix} } |
450 | 107 |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
108 X:when "string-length($text) + $prefix <= $length" { |
450 | 109 !{$length - $prefix} |
110 } | |
111 | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
112 X:when "substring($text, $length - $prefix + 1, 1) = ' '" { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
113 !{$length - $prefix + 1} |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
114 } |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
115 |
450 | 116 X:otherwise { |
117 !length(text = "$text", prefix = "$prefix", length = "$length - 1") | |
118 } | |
119 } | |
120 } | |
121 | |
122 | |
123 X:template = "at" {@} | |
124 X:template = "br" { !{$br} } | |
125 X:template = "nobr" { !{translate(., ' ', ' ')} } | |
126 | |
127 | |
128 } |