Debian Codegraph @

inst/doc/auxiliary-templates.html

raw symbols SCIP
1 <!DOCTYPE html>
2
3 <html>
4
5 <head>
6
7 <meta charset="utf-8" />
8 <meta name="generator" content="pandoc" />
9 <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
11 <meta name="viewport" content="width=device-width, initial-scale=1" />
12
13
14
15 <title>Auxiliary Templates</title>
16
17 <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18 // be compatible with the behavior of Pandoc < 2.8).
19 document.addEventListener('DOMContentLoaded', function(e) {
20 var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21 var i, h, a;
22 for (i = 0; i < hs.length; i++) {
23 h = hs[i];
24 if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25 a = h.attributes;
26 while (a.length > 0) h.removeAttribute(a[0].name);
27 }
28 });
29 </script>
30
31 <style type="text/css">
32 code{white-space: pre-wrap;}
33 span.smallcaps{font-variant: small-caps;}
34 span.underline{text-decoration: underline;}
35 div.column{display: inline-block; vertical-align: top; width: 50%;}
36 div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37 ul.task-list{list-style: none;}
38 </style>
39
40
41
42 <style type="text/css">
43 code {
44 white-space: pre;
45 }
46 .sourceCode {
47 overflow: visible;
48 }
49 </style>
50 <style type="text/css" data-origin="pandoc">
51 pre > code.sourceCode { white-space: pre; position: relative; }
52 pre > code.sourceCode > span { line-height: 1.25; }
53 pre > code.sourceCode > span:empty { height: 1.2em; }
54 .sourceCode { overflow: visible; }
55 code.sourceCode > span { color: inherit; text-decoration: inherit; }
56 div.sourceCode { margin: 1em 0; }
57 pre.sourceCode { margin: 0; }
58 @media screen {
59 div.sourceCode { overflow: auto; }
60 }
61 @media print {
62 pre > code.sourceCode { white-space: pre-wrap; }
63 pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
64 }
65 pre.numberSource code
66 { counter-reset: source-line 0; }
67 pre.numberSource code > span
68 { position: relative; left: -4em; counter-increment: source-line; }
69 pre.numberSource code > span > a:first-child::before
70 { content: counter(source-line);
71 position: relative; left: -1em; text-align: right; vertical-align: baseline;
72 border: none; display: inline-block;
73 -webkit-touch-callout: none; -webkit-user-select: none;
74 -khtml-user-select: none; -moz-user-select: none;
75 -ms-user-select: none; user-select: none;
76 padding: 0 4px; width: 4em;
77 color: #aaaaaa;
78 }
79 pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
80 div.sourceCode
81 { }
82 @media screen {
83 pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
84 }
85 code span.al { color: #ff0000; font-weight: bold; }
86 code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
87 code span.at { color: #7d9029; }
88 code span.bn { color: #40a070; }
89 code span.bu { color: #008000; }
90 code span.cf { color: #007020; font-weight: bold; }
91 code span.ch { color: #4070a0; }
92 code span.cn { color: #880000; }
93 code span.co { color: #60a0b0; font-style: italic; }
94 code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
95 code span.do { color: #ba2121; font-style: italic; }
96 code span.dt { color: #902000; }
97 code span.dv { color: #40a070; }
98 code span.er { color: #ff0000; font-weight: bold; }
99 code span.ex { }
100 code span.fl { color: #40a070; }
101 code span.fu { color: #06287e; }
102 code span.im { color: #008000; font-weight: bold; }
103 code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
104 code span.kw { color: #007020; font-weight: bold; }
105 code span.op { color: #666666; }
106 code span.ot { color: #007020; }
107 code span.pp { color: #bc7a00; }
108 code span.sc { color: #4070a0; }
109 code span.ss { color: #bb6688; }
110 code span.st { color: #4070a0; }
111 code span.va { color: #19177c; }
112 code span.vs { color: #4070a0; }
113 code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
114 </style>
115 <script>
116 // apply pandoc div.sourceCode style to pre.sourceCode instead
117 (function() {
118 var sheets = document.styleSheets;
119 for (var i = 0; i < sheets.length; i++) {
120 if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
121 try { var rules = sheets[i].cssRules; } catch (e) { continue; }
122 var j = 0;
123 while (j < rules.length) {
124 var rule = rules[j];
125 // check if there is a div.sourceCode rule
126 if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
127 j++;
128 continue;
129 }
130 var style = rule.style.cssText;
131 // check if color or background-color is set
132 if (rule.style.color === '' && rule.style.backgroundColor === '') {
133 j++;
134 continue;
135 }
136 // replace div.sourceCode by a pre.sourceCode rule
137 sheets[i].deleteRule(j);
138 sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
139 }
140 }
141 })();
142 </script>
143
144
145
146
147 <style type="text/css">body {
148 background-color: #fff;
149 margin: 1em auto;
150 max-width: 700px;
151 overflow: visible;
152 padding-left: 2em;
153 padding-right: 2em;
154 font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
155 font-size: 14px;
156 line-height: 1.35;
157 }
158 #TOC {
159 clear: both;
160 margin: 0 0 10px 10px;
161 padding: 4px;
162 width: 400px;
163 border: 1px solid #CCCCCC;
164 border-radius: 5px;
165 background-color: #f6f6f6;
166 font-size: 13px;
167 line-height: 1.3;
168 }
169 #TOC .toctitle {
170 font-weight: bold;
171 font-size: 15px;
172 margin-left: 5px;
173 }
174 #TOC ul {
175 padding-left: 40px;
176 margin-left: -1.5em;
177 margin-top: 5px;
178 margin-bottom: 5px;
179 }
180 #TOC ul ul {
181 margin-left: -2em;
182 }
183 #TOC li {
184 line-height: 16px;
185 }
186 table {
187 margin: 1em auto;
188 border-width: 1px;
189 border-color: #DDDDDD;
190 border-style: outset;
191 border-collapse: collapse;
192 }
193 table th {
194 border-width: 2px;
195 padding: 5px;
196 border-style: inset;
197 }
198 table td {
199 border-width: 1px;
200 border-style: inset;
201 line-height: 18px;
202 padding: 5px 5px;
203 }
204 table, table th, table td {
205 border-left-style: none;
206 border-right-style: none;
207 }
208 table thead, table tr.even {
209 background-color: #f7f7f7;
210 }
211 p {
212 margin: 0.5em 0;
213 }
214 blockquote {
215 background-color: #f6f6f6;
216 padding: 0.25em 0.75em;
217 }
218 hr {
219 border-style: solid;
220 border: none;
221 border-top: 1px solid #777;
222 margin: 28px 0;
223 }
224 dl {
225 margin-left: 0;
226 }
227 dl dd {
228 margin-bottom: 13px;
229 margin-left: 13px;
230 }
231 dl dt {
232 font-weight: bold;
233 }
234 ul {
235 margin-top: 0;
236 }
237 ul li {
238 list-style: circle outside;
239 }
240 ul ul {
241 margin-bottom: 0;
242 }
243 pre, code {
244 background-color: #f7f7f7;
245 border-radius: 3px;
246 color: #333;
247 white-space: pre-wrap;
248 }
249 pre {
250 border-radius: 3px;
251 margin: 5px 0px 10px 0px;
252 padding: 10px;
253 }
254 pre:not([class]) {
255 background-color: #f7f7f7;
256 }
257 code {
258 font-family: Consolas, Monaco, 'Courier New', monospace;
259 font-size: 85%;
260 }
261 p > code, li > code {
262 padding: 2px 0px;
263 }
264 div.figure {
265 text-align: center;
266 }
267 img {
268 background-color: #FFFFFF;
269 padding: 2px;
270 border: 1px solid #DDDDDD;
271 border-radius: 3px;
272 border: 1px solid #CCCCCC;
273 margin: 0 5px;
274 }
275 h1 {
276 margin-top: 0;
277 font-size: 35px;
278 line-height: 40px;
279 }
280 h2 {
281 border-bottom: 4px solid #f7f7f7;
282 padding-top: 10px;
283 padding-bottom: 2px;
284 font-size: 145%;
285 }
286 h3 {
287 border-bottom: 2px solid #f7f7f7;
288 padding-top: 10px;
289 font-size: 120%;
290 }
291 h4 {
292 border-bottom: 1px solid #f7f7f7;
293 margin-left: 8px;
294 font-size: 105%;
295 }
296 h5, h6 {
297 border-bottom: 1px solid #ccc;
298 font-size: 105%;
299 }
300 a {
301 color: #0033dd;
302 text-decoration: none;
303 }
304 a:hover {
305 color: #6666ff; }
306 a:visited {
307 color: #800080; }
308 a:visited:hover {
309 color: #BB00BB; }
310 a[href^="http:"] {
311 text-decoration: underline; }
312 a[href^="https:"] {
313 text-decoration: underline; }
314
315 code > span.kw { color: #555; font-weight: bold; }
316 code > span.dt { color: #902000; }
317 code > span.dv { color: #40a070; }
318 code > span.bn { color: #d14; }
319 code > span.fl { color: #d14; }
320 code > span.ch { color: #d14; }
321 code > span.st { color: #d14; }
322 code > span.co { color: #888888; font-style: italic; }
323 code > span.ot { color: #007020; }
324 code > span.al { color: #ff0000; font-weight: bold; }
325 code > span.fu { color: #900; font-weight: bold; }
326 code > span.er { color: #a61717; background-color: #e3d2d2; }
327 </style>
328
329
330
331
332 </head>
333
334 <body>
335
336
337
338
339 <h1 class="title toc-ignore">Auxiliary Templates</h1>
340
341
342
343 <p>As the complexity of your templating project grows, it can be helpful
344 to refactor common pieces into auxiliary templates so they can be
345 reused. The <a href="#include"><code>{% include %}</code></a> and <a href="#extends"><code>{% extends %}</code></a> tags support two very
346 different approaches to this, described below.</p>
347 <div id="loading-auxiliary-templates" class="section level2">
348 <h2>Loading Auxiliary Templates</h2>
349 <p>When your main template makes reference to auxiliary templates,
350 you’ll need to specify how the templating engine can find these
351 auxiliary templates. This is achieved using a template loader (see
352 <code>help(&quot;loader&quot;)</code>).</p>
353 <p>There are different types of loader, but <code>path_loader()</code>
354 is the most commonly used. This allows you to specify the directory
355 where auxiliary templates are stored in files.</p>
356 <p>Imagine you have a main template that uses nested template
357 inheritance (<code>content</code> inherits from
358 <code>blog_post.html</code>, which in turns inherits from
359 <code>base.html</code>). You might store these two auxiliary templates
360 in a templates directory:</p>
361 <pre class="shell"><code>/path/to/templates/
362 |-- base.html
363 |-- blog_post.html</code></pre>
364 <p>When rendering the main template, you create the loader object as
365 part of the engine configuration:</p>
366 <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a>config <span class="ot">&lt;-</span> <span class="fu">jinjar_config</span>(<span class="at">loader =</span> <span class="fu">path_loader</span>(<span class="st">&quot;path&quot;</span>, <span class="st">&quot;to&quot;</span>, <span class="st">&quot;templates&quot;</span>))</span>
367 <span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a>output <span class="ot">&lt;-</span> <span class="fu">render</span>(content, <span class="sc">!!!</span>data, <span class="at">.config =</span> config)</span></code></pre></div>
368 </div>
369 <div id="include" class="section level2">
370 <h2>Template Inclusion</h2>
371 <p>The <code>include</code> tag can be used to include an auxiliary
372 template and return the rendered contents of that file into the main
373 document. Included templates have access to the same variables as the
374 main template.</p>
375 <p>By default, an error is raised if the included template cannot be
376 found. You can ignore these errors by setting the
377 <code>ignore_missing_files</code> argument in
378 <code>jinjar_config()</code>.</p>
379 <p>As an example, we create an auxiliary file <code>header.html</code>
380 with contents:</p>
381 <div class="sourceCode" id="cb3"><pre class="sourceCode html"><code class="sourceCode html"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="dt">&lt;!DOCTYPE</span> html<span class="dt">&gt;</span></span>
382 <span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">html</span><span class="ot"> lang</span><span class="op">=</span><span class="st">&quot;en&quot;</span><span class="dt">&gt;</span></span>
383 <span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">head</span><span class="dt">&gt;</span></span>
384 <span id="cb3-4"><a href="#cb3-4" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">title</span><span class="dt">&gt;</span>My webpage<span class="dt">&lt;/</span><span class="kw">title</span><span class="dt">&gt;</span></span>
385 <span id="cb3-5"><a href="#cb3-5" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">head</span><span class="dt">&gt;</span></span></code></pre></div>
386 <p>and an auxiliary file <code>footer.html</code> with contents:</p>
387 <div class="sourceCode" id="cb4"><pre class="sourceCode html"><code class="sourceCode html"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">html</span><span class="dt">&gt;</span></span></code></pre></div>
388 <p>And then the main template is rendered as:</p>
389 <div class="sourceCode" id="cb5"><pre class="sourceCode jinjar html bg-info"><code class="sourceCode html"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a>{% include &quot;header.html&quot; %}</span>
390 <span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">body</span><span class="dt">&gt;</span></span>
391 <span id="cb5-3"><a href="#cb5-3" tabindex="-1"></a>Body</span>
392 <span id="cb5-4"><a href="#cb5-4" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">body</span><span class="dt">&gt;</span></span>
393 <span id="cb5-5"><a href="#cb5-5" tabindex="-1"></a>{% include &quot;footer.html&quot; %}</span></code></pre></div>
394 <div class="sourceCode" id="cb6"><pre class="sourceCode html bg-success"><code class="sourceCode html"><span id="cb6-1"><a href="#cb6-1" tabindex="-1"></a><span class="dt">&lt;!DOCTYPE</span> html<span class="dt">&gt;</span></span>
395 <span id="cb6-2"><a href="#cb6-2" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">html</span><span class="ot"> lang</span><span class="op">=</span><span class="st">&quot;en&quot;</span><span class="dt">&gt;</span></span>
396 <span id="cb6-3"><a href="#cb6-3" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">head</span><span class="dt">&gt;</span></span>
397 <span id="cb6-4"><a href="#cb6-4" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">title</span><span class="dt">&gt;</span>My webpage<span class="dt">&lt;/</span><span class="kw">title</span><span class="dt">&gt;</span></span>
398 <span id="cb6-5"><a href="#cb6-5" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">head</span><span class="dt">&gt;</span></span>
399 <span id="cb6-6"><a href="#cb6-6" tabindex="-1"></a></span>
400 <span id="cb6-7"><a href="#cb6-7" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">body</span><span class="dt">&gt;</span></span>
401 <span id="cb6-8"><a href="#cb6-8" tabindex="-1"></a>Body</span>
402 <span id="cb6-9"><a href="#cb6-9" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">body</span><span class="dt">&gt;</span></span>
403 <span id="cb6-10"><a href="#cb6-10" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">html</span><span class="dt">&gt;</span></span></code></pre></div>
404 </div>
405 <div id="extends" class="section level2">
406 <h2>Template Inheritance</h2>
407 <p>Template inheritance allows you to build a base “skeleton” template
408 that contains all the common elements of your document and defines
409 <em>blocks</em> that child templates can override. This is a very
410 powerful technique.</p>
411 <p>As an example, consider the following base template stored in
412 <code>base.html</code>:</p>
413 <div class="sourceCode" id="cb7"><pre class="sourceCode html"><code class="sourceCode html"><span id="cb7-1"><a href="#cb7-1" tabindex="-1"></a><span class="dt">&lt;!DOCTYPE</span> html<span class="dt">&gt;</span></span>
414 <span id="cb7-2"><a href="#cb7-2" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">html</span><span class="dt">&gt;</span></span>
415 <span id="cb7-3"><a href="#cb7-3" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">head</span><span class="dt">&gt;</span></span>
416 <span id="cb7-4"><a href="#cb7-4" tabindex="-1"></a> {% block head -%}</span>
417 <span id="cb7-5"><a href="#cb7-5" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">link</span><span class="ot"> rel</span><span class="op">=</span><span class="st">&quot;stylesheet&quot;</span><span class="ot"> href</span><span class="op">=</span><span class="st">&quot;style.css&quot;</span><span class="ot"> </span><span class="dt">/&gt;</span></span>
418 <span id="cb7-6"><a href="#cb7-6" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">title</span><span class="dt">&gt;</span>{% block title %}{% endblock %} - My Webpage<span class="dt">&lt;/</span><span class="kw">title</span><span class="dt">&gt;</span></span>
419 <span id="cb7-7"><a href="#cb7-7" tabindex="-1"></a> {% endblock %}</span>
420 <span id="cb7-8"><a href="#cb7-8" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">head</span><span class="dt">&gt;</span></span>
421 <span id="cb7-9"><a href="#cb7-9" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">body</span><span class="dt">&gt;</span></span>
422 <span id="cb7-10"><a href="#cb7-10" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">div</span><span class="ot"> id</span><span class="op">=</span><span class="st">&quot;content&quot;</span><span class="dt">&gt;</span>{% block content %}{% endblock %}<span class="dt">&lt;/</span><span class="kw">div</span><span class="dt">&gt;</span></span>
423 <span id="cb7-11"><a href="#cb7-11" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">body</span><span class="dt">&gt;</span></span>
424 <span id="cb7-12"><a href="#cb7-12" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">html</span><span class="dt">&gt;</span></span></code></pre></div>
425 <p>This base template declares three <code>{% block %}</code> tags that
426 child templates can fill in: <code>head</code>, <code>title</code> and
427 <code>content</code>. Note that the base template itself defines some
428 content for the <code>head</code> block – we’ll show how a child
429 template can use this below.</p>
430 <p>A child template uses the <code>{% extends %}</code> tag to declare
431 which parent template it builds upon. This should be the first tag in
432 the child template, so the templating engine knows it must locate the
433 parent template when rendering.</p>
434 <p>Building upon the base template example above, a child template might
435 look like this:</p>
436 <div class="sourceCode" id="cb8"><pre class="sourceCode jinjar html bg-info"><code class="sourceCode html"><span id="cb8-1"><a href="#cb8-1" tabindex="-1"></a>{% extends &quot;base.html&quot; %}</span>
437 <span id="cb8-2"><a href="#cb8-2" tabindex="-1"></a>{% block title %}Index{% endblock %}</span>
438 <span id="cb8-3"><a href="#cb8-3" tabindex="-1"></a>{% block head %}</span>
439 <span id="cb8-4"><a href="#cb8-4" tabindex="-1"></a> {{ super() }}</span>
440 <span id="cb8-5"><a href="#cb8-5" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">style</span><span class="ot"> type</span><span class="op">=</span><span class="st">&quot;text/css&quot;</span><span class="dt">&gt;</span></span>
441 <span id="cb8-6"><a href="#cb8-6" tabindex="-1"></a> <span class="fu">.important</span> { <span class="kw">color</span><span class="ch">:</span> <span class="cn">#336699</span><span class="op">;</span> }</span>
442 <span id="cb8-7"><a href="#cb8-7" tabindex="-1"></a> <span class="dt">&lt;/</span><span class="kw">style</span><span class="dt">&gt;</span></span>
443 <span id="cb8-8"><a href="#cb8-8" tabindex="-1"></a>{% endblock %}</span>
444 <span id="cb8-9"><a href="#cb8-9" tabindex="-1"></a>{% block content %}</span>
445 <span id="cb8-10"><a href="#cb8-10" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">h1</span><span class="dt">&gt;</span>Index<span class="dt">&lt;/</span><span class="kw">h1</span><span class="dt">&gt;</span></span>
446 <span id="cb8-11"><a href="#cb8-11" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">p</span><span class="ot"> class</span><span class="op">=</span><span class="st">&quot;important&quot;</span><span class="dt">&gt;</span></span>
447 <span id="cb8-12"><a href="#cb8-12" tabindex="-1"></a> Welcome to my blog!</span>
448 <span id="cb8-13"><a href="#cb8-13" tabindex="-1"></a> <span class="dt">&lt;/</span><span class="kw">p</span><span class="dt">&gt;</span></span>
449 <span id="cb8-14"><a href="#cb8-14" tabindex="-1"></a>{% endblock %}</span></code></pre></div>
450 <div class="sourceCode" id="cb9"><pre class="sourceCode html bg-success"><code class="sourceCode html"><span id="cb9-1"><a href="#cb9-1" tabindex="-1"></a><span class="dt">&lt;!DOCTYPE</span> html<span class="dt">&gt;</span></span>
451 <span id="cb9-2"><a href="#cb9-2" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">html</span><span class="dt">&gt;</span></span>
452 <span id="cb9-3"><a href="#cb9-3" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">head</span><span class="dt">&gt;</span></span>
453 <span id="cb9-4"><a href="#cb9-4" tabindex="-1"></a> </span>
454 <span id="cb9-5"><a href="#cb9-5" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">link</span><span class="ot"> rel</span><span class="op">=</span><span class="st">&quot;stylesheet&quot;</span><span class="ot"> href</span><span class="op">=</span><span class="st">&quot;style.css&quot;</span><span class="ot"> </span><span class="dt">/&gt;</span></span>
455 <span id="cb9-6"><a href="#cb9-6" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">title</span><span class="dt">&gt;</span>Index - My Webpage<span class="dt">&lt;/</span><span class="kw">title</span><span class="dt">&gt;</span></span>
456 <span id="cb9-7"><a href="#cb9-7" tabindex="-1"></a> </span>
457 <span id="cb9-8"><a href="#cb9-8" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">style</span><span class="ot"> type</span><span class="op">=</span><span class="st">&quot;text/css&quot;</span><span class="dt">&gt;</span></span>
458 <span id="cb9-9"><a href="#cb9-9" tabindex="-1"></a> <span class="fu">.important</span> { <span class="kw">color</span><span class="ch">:</span> <span class="cn">#336699</span><span class="op">;</span> }</span>
459 <span id="cb9-10"><a href="#cb9-10" tabindex="-1"></a> <span class="dt">&lt;/</span><span class="kw">style</span><span class="dt">&gt;</span></span>
460 <span id="cb9-11"><a href="#cb9-11" tabindex="-1"></a></span>
461 <span id="cb9-12"><a href="#cb9-12" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">head</span><span class="dt">&gt;</span></span>
462 <span id="cb9-13"><a href="#cb9-13" tabindex="-1"></a><span class="dt">&lt;</span><span class="kw">body</span><span class="dt">&gt;</span></span>
463 <span id="cb9-14"><a href="#cb9-14" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">div</span><span class="ot"> id</span><span class="op">=</span><span class="st">&quot;content&quot;</span><span class="dt">&gt;</span></span>
464 <span id="cb9-15"><a href="#cb9-15" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">h1</span><span class="dt">&gt;</span>Index<span class="dt">&lt;/</span><span class="kw">h1</span><span class="dt">&gt;</span></span>
465 <span id="cb9-16"><a href="#cb9-16" tabindex="-1"></a> <span class="dt">&lt;</span><span class="kw">p</span><span class="ot"> class</span><span class="op">=</span><span class="st">&quot;important&quot;</span><span class="dt">&gt;</span></span>
466 <span id="cb9-17"><a href="#cb9-17" tabindex="-1"></a> Welcome to my blog!</span>
467 <span id="cb9-18"><a href="#cb9-18" tabindex="-1"></a> <span class="dt">&lt;/</span><span class="kw">p</span><span class="dt">&gt;</span></span>
468 <span id="cb9-19"><a href="#cb9-19" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">div</span><span class="dt">&gt;</span></span>
469 <span id="cb9-20"><a href="#cb9-20" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">body</span><span class="dt">&gt;</span></span>
470 <span id="cb9-21"><a href="#cb9-21" tabindex="-1"></a><span class="dt">&lt;/</span><span class="kw">html</span><span class="dt">&gt;</span></span></code></pre></div>
471 <p>This child template defines the three blocks declared by the parent
472 template: <code>head</code>, <code>title</code> and
473 <code>content</code>. In the case of the <code>head</code> block, it
474 uses <code>{{ super() }}</code> to render the contents of the
475 <code>head</code> block defined by the parent template. If we were using
476 nested <code>extends</code> tags, we could pass an argument to skip
477 levels in the inheritance tree (e.g. <code>{{ super(2) }}</code>).</p>
478 </div>
479
480
481
482 <!-- code folding -->
483
484
485 <!-- dynamically load mathjax for compatibility with self-contained -->
486 <script>
487 (function () {
488 var script = document.createElement("script");
489 script.type = "text/javascript";
490 script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
491 document.getElementsByTagName("head")[0].appendChild(script);
492 })();
493 </script>
494
495 </body>
496 </html>