forked from NixOS/nixos-homepage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.tt
98 lines (86 loc) · 2.46 KB
/
common.tt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
[%
nixManual = "/manual/nix/stable"
nixpkgsManual = "/manual/nixpkgs/stable"
nixosManual = "/manual/nixos/stable"
nixopsManual = "https://hydra.nixos.org/job/nixops/master/tarball/latest/download-by-type/doc/manual"
nixPills = "/guides/nix-pills"
latestNixMirror = "https://nixos.org/releases/nix/nix-$latestNixVersion"
latestNixOSBranch = "release-" _ latestNixOSSeries
;
# Collects tags to be appended at the end of the document.
documentEndTags = [];
# Collects tags to be appended at the end of the head tag.
documentHeadTags = [];
# Allows adding tags just before </head>.
# Note that it has to be used *before or within* the layout.tt WRAPPER.
BLOCK atHead;
# The assignation here ensures the BLOCK outputs nothing
_ignore = documentHeadTags.import([content]);
END;
# Allows adding tags just before </body>.
# Note that it has to be used *before or within* the layout.tt WRAPPER.
BLOCK atEnd;
# The assignation here ensures the BLOCK outputs nothing
_ignore = documentEndTags.import([content]);
END;
# SVG
# ===
# PROCESS svg path="relative/path.svg"
BLOCK svg ;
PERL %]
my $path = $stash->get("path");
my $content = $context->include($path);
# Skip the `<?xml ...>` line
$content =~ s/^<\?xml[^>]+>//;
# Insert in-place
print $content
[% END;
END;
# Demos
# =====
# PROCESS demoPreview demo="cover"
BLOCK demoPreview %]
<div class="demo-preview">
<div class="thumbnail">
[% INSERT "demos/${demo}.svg" %]
</div>
<a href="#asciinema-demo-[% demo %]" data-fullscreen-pane="-demo-[% demo %]"></a>
</div>
[% END;
# Either:
#
# PROCESS demoPane demo="cover"
#
# or
#
# WRAPPER demoPane demo="cover"
# <h1>Cover demo title</h1>
# <p>
# Some more details if needed.
# </p>
# END
BLOCK demoPane %]
[%# display: none; here is how jQuery toggles the element. %]
<aside class="fullscreen-pane pane-asciinemaplayer -demo-[% demo %]" id="asciinema-demo-[% demo %]" style="display: none;">
<div>
[%- IF content -%]
<header>
[% content %]
</header>
[%- END -%]
<asciinema-player cols="80" rows="24" src="/demos/[% demo %].cast">
<div class="demo-nojs">
<p>
This demo requires JavaScript to work properly.
</p>
[%# If we wanted to provide a user-friendly version
<p>
You can read <a href="[ %root% ]demos/[ % demo % ].transcript.html">its transcript</a> instead.
</p>
%]
</div>
</asciinema-player>
</div>
</aside>
[% END;
-%]