Mercurial > hg > nginx-site
annotate xsls/menu.xsls @ 2658:81a7c9980db8
Updated Cookbook promo added.
author | Maxim Konovalov <maxim@nginx.com> |
---|---|
date | Thu, 25 Feb 2021 12:05:11 +0300 |
parents | c3a1cf38f19e |
children |
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 --> |
706 | 29 X:if "$TRANS and @switchlang" { |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
31 <!-- |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
32 -- 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
|
33 -- 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
|
34 -- 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
|
35 --> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
36 X:if "contains($TRANS, @switchlang)" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
37 <a> |
706 | 38 X:attribute "href" { |
39 !{ concat($ROOT, '/', @switchlang, '/', | |
40 substring-after($LINK, concat('/', $LANG, '/'))) } | |
41 } | |
42 !{ normalize-space(text()) } | |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
43 </a> |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 } else { |
706 | 46 <a class="notrans"> !{ normalize-space(text()) } </a> |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 } |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
48 } else { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
49 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
50 <a> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
51 X:attribute "href" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
52 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
53 X:if "starts-with(@href, $DIRNAME)" { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
54 X:if "substring-after(@href, $DIRNAME) = ''" { |
1082
c3a1cf38f19e
Added explicit X:text to avoid spurious whitespaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
706
diff
changeset
|
55 X:text {./} |
693
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
56 } else { |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
57 !{ substring-after(@href, $DIRNAME) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
58 } |
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 !{ concat($ROOT, @href) } |
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 !{ normalize-space(text()) } |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
65 </a> |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
66 |
095d1972dad9
Added ability to switch languages without context change.
Vladimir Homutov <vl@nginx.com>
parents:
648
diff
changeset
|
67 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
|
68 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
70 <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 } |
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 X:template = "menu/item[@year]" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 X:if "$YEAR or $LINK='/'" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 X:if "$YEAR=@year" { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 !{@year} <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 } else { |
648
6c0532e6982f
Visual improvements of the main menu.
Valentin Bartenev <vbart@nginx.com>
parents:
580
diff
changeset
|
80 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
|
81 <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 |
408 | 87 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
|
88 <a href="{@href}"> !{ normalize-space(text()) } </a> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 X:if "@lang" { X:text { [} !{@lang} X:text {]}} |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 <br/> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
92 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
93 |
648
6c0532e6982f
Visual improvements of the main menu.
Valentin Bartenev <vbart@nginx.com>
parents:
580
diff
changeset
|
94 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
|
95 !{ normalize-space(text()) } <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 } |