Mercurial > hg > nginx-site
annotate xsls/menu.xsls @ 693:095d1972dad9
Added ability to switch languages without context change.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 28 Sep 2012 11:14:47 +0000 |
parents | 6c0532e6982f |
children | cd0d1f0130db |
rev | line source |
---|---|
580
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
408
diff
changeset
|
1 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
408
diff
changeset
|
2 Copyright (C) Igor Sysoev |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
408
diff
changeset
|
3 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
408
diff
changeset
|
4 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
408
diff
changeset
|
5 |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
6 X:stylesheet { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 X:template = "menu/item" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 <!-- |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 -- variables are not allowed in a template match predicate, |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 -- therefore, we have to use ugly "if"s instead of elegant |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 -- "menu/item[@href = $LINK]", etc. |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 --> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 X:if "@href = $LINK" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 X:if "$YEAR and @href='/'" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 <a href="./"> news </a> <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 } else { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 !{ normalize-space(text()) }<br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 } else { |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
24 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
25 <!-- |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
26 -- If a menu item has the switchlang attribute, then it will point |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
27 -- to the same document in the specified language. |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
28 -- The document will be taken from $NOLANGORIGIN variable. |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
29 --> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
30 X:if "@switchlang != ''" { |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
32 <!-- |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
33 -- Check if list of available translations ($TRANS) contains |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
34 -- the language we are going to generate link to. |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
35 -- If yes - generate link, otherwise just name the language. |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
36 --> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
37 X:if "contains($TRANS, @switchlang)" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
38 <a> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
39 X:attribute "href" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
40 X:if "$ROOT != '' " { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
41 !{ concat($ROOT, '/', @switchlang, '/', $NOLANGORIGIN) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
42 } else { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
43 !{ concat(@switchlang, '/', $NOLANGORIGIN) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
44 } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
45 } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
46 !{ normalize-space(text()) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
47 </a> |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 } else { |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
50 <a class="notrans"> !{ normalize-space(text()) } </a> |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 } |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
52 } else { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
53 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
54 <a> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
55 X:attribute "href" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
56 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
57 X:if "starts-with(@href, $DIRNAME)" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
58 X:if "substring-after(@href, $DIRNAME) = ''" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
59 ./ |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
60 } else { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
61 !{ substring-after(@href, $DIRNAME) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
62 } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
63 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
64 } else { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
65 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
66 !{ concat($ROOT, @href) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
67 } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
68 } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
69 !{ normalize-space(text()) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
70 </a> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
71 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
72 X:if "@lang" { X:text { [} !{@lang} X:text {]}} |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
80 X:template = "menu/item[@year]" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 X:if "$YEAR or $LINK='/'" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 X:if "$YEAR=@year" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 !{@year} <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 } else { |
648
6c0532e6982f
Visual improvements of the main menu.
Valentin Bartenev <vbart@nginx.com>
parents:
580
diff
changeset
|
85 X:if "@href" { <a href="{@href}"> !{@year} </a> } |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
87 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
88 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 |
408 | 92 X:template = "menu/item[starts-with(@href, 'http://') or starts-with(@href, 'https://')]" { |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
93 <a href="{@href}"> !{ normalize-space(text()) } </a> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
94 X:if "@lang" { X:text { [} !{@lang} X:text {]}} |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
95 <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
96 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
97 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
98 |
648
6c0532e6982f
Visual improvements of the main menu.
Valentin Bartenev <vbart@nginx.com>
parents:
580
diff
changeset
|
99 X:template = "menu/item[not(@href) and not(@year)]" { |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
100 !{ normalize-space(text()) } <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
101 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
102 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
103 } |