-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplates.html
More file actions
445 lines (442 loc) · 26.2 KB
/
templates.html
File metadata and controls
445 lines (442 loc) · 26.2 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="images/favicon.svg" type="image/svg+xml">
<title>LibreBlog - A tool for independent journalism</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="horizontal-bar">
<div id="horizontal-bar-contents">
<div id="horizontal-bar-logo">
<a href="https://libreblog.org"><img src="images/logo.svg" alt="Logo" height="24px" /></a>
</div>
<div id="dropdown-menu">
<img id="dropdown-menu-icon" class="icon" src="images/menu.svg"/>
<ul id="dropdown-menu-list">
<li><a href="index.html"><img class="icon" src="images/dashboard.svg"/>Dashboard</a></li>
<li><a href="articles.html"><img class="icon" src="images/articles.svg"/>Articles</a></li>
<li><a href="series.html"><img class="icon" src="images/series.svg"/>Series</a></li>
<li><a href="sections.html"><img class="icon" src="images/sections.svg"/>Sections</a></li>
<li><a href="relations.html"><img class="icon" src="images/relations.svg"/>Relations</a></li>
<li><a href="sources.html"><img class="icon" src="images/sources.svg"/>Sources</a></li>
<li><a href="navbar.html"><img class="icon" src="images/navbar.svg"/>Navigation</a></li>
<li><a href="media.html"><img class="icon" src="images/media.svg"/>Media</a></li>
<li><a href="authors.html"><img class="icon" src="images/authors.svg"/>Authors</a></li>
<li><a href="appearance.html"><img class="icon" src="images/appearance.svg"/>Appearance</a></li>
<li><a href="templates.html"><img class="icon" src="images/templates.svg"/>Templates</a></li>
<li><a href="settings.html"><img class="icon" src="images/settings.svg"/>Settings</a></li>
</ul>
</div>
</div>
</div>
<div id="vertical-navbar">
<ul>
<li><a href="index.html"><img class="icon" src="images/dashboard.svg"/>Dashboard</a></li>
<li><a href="articles.html"><img class="icon" src="images/articles.svg"/>Articles</a></li>
<li><a href="series.html"><img class="icon" src="images/series.svg"/>Series</a></li>
<li><a href="sections.html"><img class="icon" src="images/sections.svg"/>Sections</a></li>
<li><a href="relations.html"><img class="icon" src="images/relations.svg"/>Relations</a></li>
<li><a href="sources.html"><img class="icon" src="images/sources.svg"/>Sources</a></li>
<li><a href="navbar.html"><img class="icon" src="images/navbar.svg"/>Navigation</a></li>
<li><a href="media.html"><img class="icon" src="images/media.svg"/>Media</a></li>
<li><a href="authors.html"><img class="icon" src="images/authors.svg"/>Authors</a></li>
<li><a href="appearance.html"><img class="icon" src="images/appearance.svg"/>Appearance</a></li>
<li class="active"><a href="templates.html"><img class="icon" src="images/templates.svg"/>Templates</a><div class="triangle"></div></li>
<li><a href="settings.html"><img class="icon" src="images/settings.svg"/>Settings</a></li>
</ul>
<div id="logo-bottom">
<a href="https://libreblog.org" target="_blank"><img src="images/logo.svg" alt="Logo" width="110px" /></a>
</div>
</div>
<div id="content">
<div class="title-div">
<span>Choose a Template</span>
<select id="select-page-type"></select>
</div>
<div id="twig-variables-info" class="details-header">
<details class="extrainfo" id="documentation-for-templates">
<summary>Documentation for template designers</summary>
<div class="infocontent">
<code>
<div>Okay, this page is a bit different from the others. It is intended to be used by template designers. For most users, the recommended action is to choose a theme on the <a href="appearance.html">Appearance</a> page without changing the templates. However, if you want to practice your web development skills, keep reading.<br/><br/>Below is a list of variables that you can insert into the templates so that some information is inserted programmatically, without you having to worry about it while you focus on the content of your website.<br/><br/>These variables must be inserted as follows: <i>{{ item.subitem }}</i>. For example, to place the name of the website somewhere on the page, simply insert <i>{{ global.website_name }}</i> in its HTML code.<br/><br/>For more advanced uses of the Twig syntax, read this <a href="https://twig.symfony.com/doc/3.x/templates.html" target="_blank">page</a>.<br/><br/>List of variables:<br/></div>
<h4>In the CSS section</h4>
<ul>
<li>global (object) [go to <a class="blue-link" href="settings.html">Settings</a> to edit its attributes]
<ul>
<li>website_name (string)</li>
<li>website_title (string)</li>
<li>website_description (string)</li>
<li>website_logo (string)</li>
<li>website_url (string)</li>
<li>website_favicon (string)</li>
<li>website_language (string) ["en", "fr" ...]</li>
<li>website_timezone (string) [... -01:00, +00:00, +01:00 ...)]</li>
<li>timezone_abbreviation (string)</li>
<li>dot_html_for_links (string) [".html" or "" if the user has decided to remove this file extension from URLs]</li>
<li>share_button (boolean)</li>
<li>article_in_feedback (boolean)</li>
<li>articles_in_author_profile (boolean)</li>
<li>feedback_uri_prefix (string)</li>
<li>img_url_prefix (string)</li>
<li>head_code_snippets (string) [HTML]</li>
<li>comment_box_snippet (string) [HTML]</li>
<li>footer_social_snippet (string) [HTML]</li>
<li>user (object) [user-defined variables. Obs.: Edit them as a JSON object]</li>
<li>strings (object) [strings for internationalization]</li>
<ul>
<li>[in the default_theme there are these strings: no_articles_found, in_section_label, series_label, timeline_label, header_search_placeholder, footer_social_header, footer_subscribe_text, footer_email_placeholder, footer_subscribe_button, previous_articles, initial_page, and next_articles]
</li>
</ul>
<li>libreblog (object)
<ul>
<li>logo (string) [data:image/svg+xml...]</li>
<li>version (string)</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>In the HTML section</h4>
<h5>For all pages and components</h5>
<ul>
<li>global (object) [same as above]</li>
<li>media (object) [used in conjunction with the media_url function]
<ul>[uri of media resource] (object):
<li>url (string)</li>
<li>uri (string)</li>
<li>file_extension (string)</li>
<li>size (string)</li>
<li>alt_text (string)</li>
<li>title (string)</li>
<li>info (string)</li>
<li>created (string)</li>
<li>updated (string)</li>
<li>type (string)</li>
<li>download_mode (boolean)</li>
<li>versions (string)</li>
</ul>
</li>
</ul>
<h5>For all HTML templates except page components</h5>
<ul>
<li>components (object)
<ul>
<li>header (string) [HTML with the rendered template]</li>
<li>footer (string) [HTML with the rendered template]</li>
<li>[other component] (string) [HTML]</li>
</ul>
</li>
<li>search_js_file (string) ["search-(random number).js"] [inside this JS file, a variable called libreblogSearch is set. It is accessible in the scope of the pages]
<ul>[contents of libreblogSearch (array)]:
<ul>items:
<li>uri (string) [link to the article or series page]</li>
<li>type (string) ['Article', 'Series']</li>
<li>title (string)</li>
<li>subtitle (string)</li>
<li>searchable (string) [title + ";" + subtitle, normalized and in lower case]</li>
<li>in_sitemap (integer) [0=no and 1=yes]</li>
<li>created (string)</li>
<li>published (string)</li>
<li>updated (string)</li>
<li>photo (object)
<ul>
<li>url (string)</li>
<li>uri (string)</li>
<li>file_extension (string)</li>
<li>size (string)</li>
<li>alt_text (string)</li>
<li>title (string)</li>
<li>info (string)</li>
<li>download_mode (boolean)</li>
<li>versions (object)
<ul>
<li>small (boolean)</li>
<li>medium (boolean)</li>
<li>large (boolean)</li>
</ul>
</li>
</ul>
</li>
</ul>
</ul>
</li>
</ul>
<h5>For the Header HTML, the Footer HTML and other page components</h5>
<ul>
<li>navbar (array)
<ul>items:
<li>uri (string)</li>
<li>label (string)</li>
<li>location (string) ['Header', 'Footer' or another page component]</li>
<li>type (string) ['Section', 'Series', 'Article', 'Author', 'External', or 'Label']</li>
<li>reference (string) [format: '/{type}/{uri}.html' or URL (if type=External)]</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
</ul>
</li>
</ul>
<h5>For the Main Page</h5>
<ul>
<li>articles (array)
<ul>items:
<li>uri (string)</li>
<li>type (string) ['Article', 'Page', or 'Analysis']</li>
<li>highlight_mainpage (integer) [0=no and 1=yes]</li>
<li>highlight_section (integer) [0=no and 1=yes]</li>
<li>enable_comments (integer) [0=no and 1=yes]</li>
<li>in_sitemap (integer) [0=no and 1=yes]</li>
<li>title (string)</li>
<li>subtitle (string)</li>
<li>label (string)</li>
<li>series_uri (string)</li>
<li>section_uri (string)</li>
<li>section_title (string)</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
<li>authors_ids (string) [uris separated by ',']</li>
<li>contents (string) [HTML]</li>
<li>declared_values (object) [see the "declare" function]</li>
<li>photo (object)
<ul>
<li>url (string)</li>
<li>uri (string)</li>
<li>file_extension (string)</li>
<li>size (string)</li>
<li>alt_text (string)</li>
<li>title (string)</li>
<li>info (string)</li>
<li>download_mode (boolean)</li>
<li>versions (object)
<ul>
<li>small (boolean)</li>
<li>medium (boolean)</li>
<li>large (boolean)</li>
</ul>
</li>
</ul>
</li>
<li>photo_info (string)</li>
<li>notes (string)</li>
<li>status (string) ['Published' or 'Unpublished']</li>
</ul>
</li>
<li>series (array)
<ul>items:
<li>uri (string)</li>
<li>highlight_mainpage (integer) [0=no and 1=yes]</li>
<li>highlight_section (integer) [0=no and 1=yes]</li>
<li>hide_search_engines (integer) [0=no and 1=yes]</li>
<li>title (string)</li>
<li>subtitle (string)</li>
<li>section_uri (string)</li>
<li>section_title (string)</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
<li>authors_ids (string) [uris separated by ',']</li>
<li>contents (string) [HTML]</li>
<li>photo (object) [as in articles]</li>
<li>photo_info (string)</li>
<li>declared_values (object) [see the "declare" function]</li>
<li>status (string)</li>
</ul>
</li>
<li>how_many_pages (number) [for pagination]</li>
<li>current_page (number) [for pagination]</li>
</ul>
<h5>For the Section Page</h5>
<ul>
<li>section (object)
<ul>
<li>uri (string)</li>
<li>title (string)</li>
<li>description (string)</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
<li>authors_ids (string) [uris separated by ',']</li>
<li>authors (array[object]) [as in Articles]</li>
<li>contents (string) [HTML]</li>
<li>declared_values (object) [see the "declare" function]</li>
</ul>
</li>
<li>articles (array) [as in the Main Page, but without the section_title]</li>
<li>series (array) [as in the Main Page, but without the section_title]</li>
<li>how_many_pages (number) [for pagination]</li>
<li>current_page (number) [for pagination]</li>
</ul>
<h5>For the Series Page</h5>
<ul>
<li>series (object) [the individual series]
<ul>
<li>uri (string)</li>
<li>highlight_mainpage (integer) [0=no and 1=yes]</li>
<li>highlight_section (integer) [0=no and 1=yes]</li>
<li>in_sitemap (integer) [0=no and 1=yes]</li>
<li>title (string)</li>
<li>subtitle (string)</li>
<li>section_uri (string)</li>
<li>section_title (string)</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
<li>published (string) [format: dd/MM/yyyy hh:mm]</li>
<li>authors_ids (string) [uris separated by ',']</li>
<li>authors (array[object]) [as in Articles]</li>
<li>contents (string) [HTML]</li>
<li>photo (object) [as in the Main Page]</li>
<li>photo_info (string)</li>
<li>declared_values (object) [see the "declare" function]</li>
<li>status (string)</li>
</ul>
</li>
<li>articles (array) [as in the Main Page]</li>
<li>how_many_pages (number) [for pagination]</li>
<li>current_page (number) [for pagination]</li>
<li>section (object) [the section of this series or an empty object, if none]</li>
</ul>
<h5>For the Author Page</h5>
<ul>
<li>author (object)
<ul>
<li>uri (string)</li>
<li>name (string)</li>
<li>contact (string)</li>
<li>location (string)</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
<li>photo (object) [as in the Main Page]</li>
<li>photo_info (string)</li>
<li>declared_values (object) [see the "declare" function]</li>
<li>contents (string) [HTML]</li>
</ul>
</li>
<li>articles (array) [as in the Main Page, but without the section_title]</li>
<li>series (array) [as in the Main Page, but without the section_title]</li>
<li>how_many_pages (number) [for pagination]</li>
<li>current_page (number) [for pagination]</li>
<li>declared_values (object) [as in Articles]</li>
</ul>
<h5>For all types of Article [Article, Page, Analysis (and custom types)]</h5>
<ul>
<li>article (object)
<ul>
<li>uri (string)</li>
<li>type (string) ['Article', 'Page', etc.]</li>
<li>highlight_mainpage (integer) [0=no and 1=yes]</li>
<li>highlight_section (integer) [0=no and 1=yes]</li>
<li>enable_comments (integer) [0=no and 1=yes]</li>
<li>in_sitemap (integer) [0=no and 1=yes]</li>
<li>title (string)</li>
<li>subtitle (string)</li>
<li>label (string)</li>
<li>series_uri (string)</li>
<li>section_uri (string)</li>
<li>section_title (string)</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
<li>published (string) [format: dd/MM/yyyy hh:mm]</li>
<li>authors_ids (string) [uris separated by ',']</li>
<li>authors (array)
<ul>items:
<li>uri (string)</li>
<li>type (string)</li>
<li>name (string)</li>
<li>email (string)</li>
<li>bio (string)</li>
<li>contact (string)</li>
<li>location (string)</li>
<li>photo (object) [as in the Main Page]</li>
<li>contents (string) [HTML]</li>
</ul>
</li>
<li>contents (string) [HTML]</li>
<li>photo (object) [as in the Main Page]</li>
<li>photo_info (string)</li>
<li>notes (string)</li>
<li>declared_values (object) [see the "declare" function]</li>
<li>status (string) ['Published' or 'Unpublished']</li>
</ul>
</li>
<li>section (object) [the section of this article or an empty object, if none]</li>
<li>series (object) [the series of this article or an empty object, if none]</li>
<li>relations (object)
<ul>
<li>first_articles (object)
<ul>
<li>[name of the relation] (array)
<ul>items:
<li> article (object)
<ul>
<li> the same attributes as the Main Page, but without the section_title </li>
<li> relation (object)
<ul>
<li>uri (string)</li>
<li>article1 (string) [uri of an article]</li>
<li>article2 (string) [uri of an article]</li>
<li>type (string)</li>
<li>place (string) [a number or a date]</li>
<li>contents (string) [HTML]</li>
<li>created (string) [format: dd/MM/yyyy hh:mm]</li>
<li>updated (string) [format: dd/MM/yyyy hh:mm]</li>
<li>photo (object) [as in the Main Page]</li>
<li>photo_info (string)</li>
<li>authors_ids (string) [uris separated by ',']</li>
<li>declared_values (object) [see the "declare" function]</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>second_articles (object) [similar to the item first_articles]</li>
</ul>
</li>
</ul>
<h4>Functions</h4>
<ul>
<li>declare(key: string, value: string, args: object): void [this function allows user-edited pages to pass information to templates]</li>
<li>escape_latex(text: string): string [escapes LaTeX special characters]</li>
<li>format_date(dateStr: string, options: object): string [formats dates in a human-readable format]</li>
<li>gen_latex(markdown: string, footnotes: array[array[string]], options: object): string [converts Markdown to LaTeX]</li>
<li>get_authors(ref: object): array[string] [returns the authors in a reference object]</li>
<li>get_py(ref: object): string [returns the publication year in a reference object]</li>
<li>get_tags(ref: object, tags: array): array[array] [it receives an array with the desired tags (note: this array may contain arrays with tags that function as synonyms. For example: [["VL", "VO", "T3"], "IS", "SP"]. If "VL" is found, the function will not search for the other tags within the internal array. The function returns an array with an array for each tag found. In this array, there are three elements (the tag itself, a label for the tag and the value found)]</li>
<li>get_title(ref: object): string [returns the title in a reference object]</li>
<li>get_type(ref: object): string [returns the type of a reference object. For example: "Journal Article"]</li>
<li>get_urls(ref: object): array[string] [returns the URLs (UR) in a reference object]</li>
<li>img(imgId: string, args: object, options: object): string [returns a string with an IMG element. The possible attributes of <i>options</i> are: width (number), height (number), version (string), title (string/boolean), caption (string/boolean), alt (string/boolean) and style (string)] </li>
<li>iso_datetime(dateStr: string): string [formats dates according to the ISO 8601 standard]</li>
<li>media_url(mediaId: string, media: object): string [returns the URL corresponding to the media ID] </li>
<li>note(noteText: string, args: object): string [inserts a note and returns a string with an HTML element with an anchor link] </li>
<li>photo_version(photo: object, version: string): string [returns the URL of the requested image version. If it does not exist, it returns the smallest version that is larger than the one requested] </li>
<li>r(refId: string, args: object): string [inserts a reference and returns a string with an HTML element with an anchor link] </li>
<li>reference(articleUri: string, pos: number): string [returns the reference ID related to a given reference position]</li>
<li>reference_loc(articleUri: string, pos: number): string [returns "Ibid." if the previous reference is equal to the given reference, "Loc. cit." if there is another reference equal to the given reference but not immediately preceding it, and "" for the other cases]</li>
<li>references_length(articleUri: string): number [returns the number of references in an article]</li>
<li>rfc822_datetime(dateStr: string, timezone: string): string [formats dates according to the RFC 822 standard]</li>
</ul>
</code>
</div>
</details>
</div>
<h4>CSS + <a class="blue-link" target="_blank" href="https://twig.symfony.com/">Twig</a></h4>
<div id="editor-css"></div>
<h4>HTML + <a class="blue-link" target="_blank" href="https://twig.symfony.com/">Twig</a></h4>
<div id="editor-html"></div>
<br/><br/>
<div class="form-div">
<form id="templates-form">
<div class="templates-submit-div">
<input id="save" type="submit" value="Save Templates">
<input id="export" type="submit" value="Export Theme">
</div>
</form>
</div>
</div>
<script type="module" src="js/script.js"></script>
</body>
</html>