forked from pascalpoizat/pascalpoizat.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
feed.xml
545 lines (400 loc) · 56 KB
/
feed.xml
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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>pascal.poizat</title>
<description>Professor<br/> Université Paris Nanterre<br/> LIP6 (Sorbonne Université, CNRS)
</description>
<link>http://pascalpoizat.github.io/</link>
<atom:link href="http://pascalpoizat.github.io/feed.xml" rel="self" type="application/rss+xml" />
<pubDate>Fri, 30 Jul 2021 11:01:06 +0200</pubDate>
<lastBuildDate>Fri, 30 Jul 2021 11:01:06 +0200</lastBuildDate>
<generator>Jekyll v3.6.2</generator>
<item>
<title>Jekyll and BibTeX</title>
<description><p class="text-justify">Using <a href="http://jekyllrb.com">Jekyll</a>,
you can <a href="/blog/posts/2016/01/27/generating-a-page-using-personal-data/">generate pages based on your data</a>.<br />
With the additional help of <a href="https://github.com/inukshuk/jekyll-scholar">Jekyll-Scholar</a>,
this may include your BibTeX bibliographies.</p>
<h2 id="installing-jekyll-scholar">Installing Jekyll-Scholar</h2>
<p class="text-justify">First, if you are using GitHub Pages, you should do without the workflow,
see <a href="/blog/posts/2016/01/29/github-pages-without-the-workflow/">this post</a>,
since Jekyll-Scholar is not part of the authorized plugins.</p>
<p>Installing Jekyll-Scholar is then performed as follows:</p>
<ul>
<li>run <code class="highlighter-rouge">gem install jekyll-scholar</code> and add <code class="highlighter-rouge">gems: ['jekyll/scholar']</code> in your <code class="highlighter-rouge">_config.yml</code> configuration file</li>
<li>add <code class="highlighter-rouge">gem 'jekyll-scholar'</code> in your <code class="highlighter-rouge">Gemfile</code> file (if you are using the <a href="http://bundler.io/">Bundler</a> package manager)</li>
</ul>
<h2 id="basic-example">Basic example</h2>
<p class="text-justify">You can use a <code class="highlighter-rouge">_bibliography</code> directory to store your bibliography <code class="highlighter-rouge">.bib</code> files.
The <code class="highlighter-rouge">_</code> in the directory name means that Jekyll will not copy it in the generated site (<code class="highlighter-rouge">_site</code> by default).
If you want that your bibliography file is visible to your site visitors,
then you should take this into account and, e.g., store the file in a <code class="highlighter-rouge">bibliography</code> directory instead.
In the example we will suppose you have a <code class="highlighter-rouge">_bibliography/references.bib</code> file.</p>
<p class="text-justify">You can configure the way Jekyll-Scholar works using your <code class="highlighter-rouge">_config.yml</code> configuration file.
The default is (see <a href="https://github.com/inukshuk/jekyll-scholar">here</a> for the meaning of the contents):</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="na">scholar</span><span class="pi">:</span>
<span class="na">style</span><span class="pi">:</span> <span class="s">apa</span>
<span class="na">locale</span><span class="pi">:</span> <span class="s">en</span>
<span class="na">sort_by</span><span class="pi">:</span> <span class="s">none</span>
<span class="na">order</span><span class="pi">:</span> <span class="s">ascending</span>
<span class="na">group_by</span><span class="pi">:</span> <span class="s">none</span>
<span class="na">group_order</span><span class="pi">:</span> <span class="s">ascending</span>
<span class="na">source</span><span class="pi">:</span> <span class="s">./_bibliography</span>
<span class="na">bibliography</span><span class="pi">:</span> <span class="s">references.bib</span>
<span class="na">bibliography_template</span><span class="pi">:</span> <span class="s2">"</span><span class="s">"</span>
<span class="na">replace_strings</span><span class="pi">:</span> <span class="no">true</span>
<span class="na">join_strings</span><span class="pi">:</span> <span class="no">true</span>
<span class="na">use_raw_bibtex_entry</span><span class="pi">:</span> <span class="no">false</span>
<span class="na">details_dir</span><span class="pi">:</span> <span class="s">bibliography</span>
<span class="na">details_layout</span><span class="pi">:</span> <span class="s">bibtex.html</span>
<span class="na">details_link</span><span class="pi">:</span> <span class="s">Details</span>
<span class="na">query</span><span class="pi">:</span> <span class="s2">"</span><span class="s">@*"</span></code></pre></figure>
<p class="text-justify">You may then perform queries in your <code class="highlighter-rouge">.html</code> or <code class="highlighter-rouge">.md</code> pages as follows:</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid">---
layout: default
title: publications
---
## Journal Articles
<span class="p">{%</span><span class="w"> </span><span class="nt">bibliography</span><span class="w"> </span>-q<span class="w"> </span>@article<span class="w"> </span><span class="p">%}</span>
## Book Chapters
<span class="p">{%</span><span class="w"> </span><span class="nt">bibliography</span><span class="w"> </span>-q<span class="w"> </span>@inbook<span class="w"> </span><span class="p">%}</span>
## Conferences and Workshops
<span class="p">{%</span><span class="w"> </span><span class="nt">bibliography</span><span class="w"> </span>-q<span class="w"> </span>@inproceedings<span class="w"> </span><span class="p">%}</span>
## Manuscripts
<span class="p">{%</span><span class="w"> </span><span class="nt">bibliography</span><span class="w"> </span>-q<span class="w"> </span>@phdthesis<span class="w"> </span><span class="p">%}</span></code></pre></figure>
<p class="text-justify">You may find more information about the bibliography queries <a href="https://github.com/inukshuk/jekyll-scholar">here</a>.</p>
<h2 id="tuning-things">Tuning things</h2>
<p>We will see how to achieve the following:</p>
<ul>
<li>change the way references are ordered</li>
<li>have our own citation style</li>
<li>have output generated for additional bibliography fields (notes, DOI, HAL, and PDF)
and for the BibTeX reference itself</li>
</ul>
<h3 id="ordering-of-references">Ordering of references</h3>
<p class="text-justify">Say you want to have ordering by date of publication, in descending order.
Then you have to change your <code class="highlighter-rouge">_config.yml</code> file to include:</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="na">scholar</span><span class="pi">:</span>
<span class="s">...</span>
<span class="s">sort_by</span><span class="pi">:</span> <span class="s">year, month</span>
<span class="na">order</span><span class="pi">:</span> <span class="s">descending</span>
<span class="s">...</span></code></pre></figure>
<h3 id="citation-styles">Citation styles</h3>
<p class="text-justify">You can change the citation style by changing the style name for Jekyll-Scholar in <code class="highlighter-rouge">_config.yml</code>.
You can use styles from <a href="https://github.com/citation-style-language/styles">the repository for CSL citation styles</a>.
You can also define you own style and link to it as follows:</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="na">scholar</span><span class="pi">:</span>
<span class="s">...</span>
<span class="s">style</span><span class="pi">:</span> <span class="s">_bibliography/mystyle.csl</span>
<span class="s">...</span></code></pre></figure>
<p class="text-justify">The definition of a style is quite complex. There is few documentation.
The best I could find is <a href="http://docs.citationstyles.org/en/stable/">here</a>.
The style I use is a modification of
<a href="http://www.zotero.org/styles/springer-lecture-notes-in-computer-science">http://www.zotero.org/styles/springer-lecture-notes-in-computer-science</a>
which you can see <a href="https://github.com/pascalpoizat/pascalpoizat.github.io/blob/master/src/_bibliography/mystyle.csl">here</a>.</p>
<h3 id="tuning-the-generated-output">Tuning the generated output</h3>
<p class="text-justify">The first thing is to tell Jekyll-Scholar which layout to use for bibliography queries.
We will have the description of it in <code class="highlighter-rouge">_layouts/bib.html</code> so we change <code class="highlighter-rouge">config.yml</code> to have:</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="na">scholar</span><span class="pi">:</span>
<span class="s">...</span>
<span class="s">bibliography_template</span><span class="pi">:</span> <span class="s">bib</span>
<span class="s">...</span></code></pre></figure>
<p class="text-justify">Then you have to put the <code class="highlighter-rouge">bib.html</code> layout file in <code class="highlighter-rouge">_layouts</code> (the default):</p>
<figure class="highlight"><pre><code class="language-html" data-lang="html">---
---
<span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">"text-justify"</span><span class="nt">&gt;</span>
{{reference}}
<span class="nt">&lt;/div&gt;</span>
{% if entry.note %}
<span class="nt">&lt;div&gt;</span>
<span class="nt">&lt;em&gt;</span>{{ entry.note }}<span class="nt">&lt;/em&gt;</span>
<span class="nt">&lt;/div&gt;</span>
{% endif %}
<span class="nt">&lt;div&gt;</span>
{% if entry.doi %}
<span class="nt">&lt;span&gt;&lt;a</span> <span class="na">href=</span><span class="s">"{{ entry.doi | prepend: 'http://doi.org/' }}"</span><span class="nt">&gt;</span>doi<span class="nt">&lt;/a&gt;&lt;/span&gt;</span>
{% endif %}
{% if entry.hal_id %}
<span class="nt">&lt;span&gt;&lt;a</span> <span class="na">href=</span><span class="s">"{{ entry.hal_id | prepend: 'http://hal.inria.fr/' }}"</span><span class="nt">&gt;</span>hal<span class="nt">&lt;/a&gt;&lt;/span&gt;</span>
{% endif %}
<span class="nt">&lt;/div&gt;</span>
<span class="nt">&lt;div&gt;</span>
{% if entry.pdf %}
<span class="nt">&lt;span&gt;&lt;a</span> <span class="na">href=</span><span class="s">"{{ entry.pdf }}"</span><span class="nt">&gt;</span>pdf<span class="nt">&lt;/a&gt;&lt;/span&gt;</span>
{% endif %}
<span class="nt">&lt;/div&gt;</span>
<span class="nt">&lt;div&gt;&lt;pre&gt;</span>{{ entry.bibtex }}<span class="nt">&lt;/pre&gt;&lt;/div&gt;</span></code></pre></figure>
<p class="text-justify">The first thing is the layout information used by Jekyll (the two dash lines).
Then you have the <code class="highlighter-rouge">{{ reference }}</code> tag. It is used to include the reference as generated by Jekyll-Scholar.
Here we put it in a <code class="highlighter-rouge">&lt;div&gt;...&lt;/div&gt;</code> tag to have it text-justified.</p>
<p class="text-justify">Then we want to generate the reference note if there is some.
For this we use a Liquid conditional.
<code class="highlighter-rouge">entry</code> denotes the current reference we are typing out, and
<code class="highlighter-rouge">entry.note</code> denotes the note field of this entry (if it exists).</p>
<p class="text-justify">Then we have two <code class="highlighter-rouge">&lt;div&gt;</code>s. One for the links (DOI and the HAL open archive) and one for the PDF of the reference.
This uses respectively the <code class="highlighter-rouge">doi</code> (or <code class="highlighter-rouge">DOI</code>), <code class="highlighter-rouge">hal_id</code> (or <code class="highlighter-rouge">HAL_ID</code>), and <code class="highlighter-rouge">pdf</code> (or <code class="highlighter-rouge">PDF</code>) user-defined fields
in BibTeX reference files. Typically one would have references such as:</p>
<figure class="highlight"><pre><code class="language-latex" data-lang="latex">@Article<span class="p">{</span>PP<span class="p">_</span>MPS12,
author = <span class="p">{</span>Mateescu, Radu and Poizat, Pascal and Salaün, Gwen<span class="p">}</span>,
year = <span class="p">{</span>2012<span class="p">}</span>,
title = <span class="p">{{</span>Adaptation of Service Protocols using Process Algebra and On-the-Fly Reduction Techniques<span class="p">}}</span>,
journal = <span class="p">{</span>IEEE Transactions on Software Engineering<span class="p">}</span>,
pages = <span class="p">{</span>755--777<span class="p">}</span>,
volume = <span class="p">{</span>38<span class="p">}</span>,
number = <span class="p">{</span>4<span class="p">}</span>,
DOI = <span class="p">{</span>10.1109/TSE.2011.62<span class="p">}</span>,
HAL<span class="p">_</span>ID = <span class="p">{</span>hal-00717252<span class="p">}</span>,
PDF = <span class="p">{</span>https://hal.inria.fr/hal-00717252/document<span class="p">}</span>,
<span class="p">}</span></code></pre></figure>
<p class="text-justify"><strong>Note:</strong> if you want to use <code class="highlighter-rouge">{{ ... }}</code> in your BibTeX files (to force uppercase titles for example),
then you have to tell Jekyll-Scholar not to interpret this as Liquid templates.
This is achieved by putting in your <code class="highlighter-rouge">_config.yml</code> file:</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="na">scholar</span><span class="pi">:</span>
<span class="s">...</span>
<span class="s">use_raw_bibtex_entry</span><span class="pi">:</span> <span class="no">true</span>
<span class="s">...</span></code></pre></figure>
<p class="text-justify">Last, but not least, if you want to end each reference with its BibTex source, e.g., to present them in a Boostrap pop-up),
then you can use <code class="highlighter-rouge">entry.bibtex</code>.</p>
<p class="text-justify">The overall result for the reference above (<strong>at the time of this post</strong>) is:</p>
<p><img src="/posts_images/2016-02-01-image1.png" alt="" /></p>
<p class="text-justify">As you can see, Jekyll-Scholar is a really interesting plugin.
To learn more, see <a href="https://github.com/inukshuk/jekyll-scholar">here</a>.</p>
</description>
<pubDate>Mon, 01 Feb 2016 00:00:00 +0100</pubDate>
<link>http://pascalpoizat.github.io/blog/posts/2016/02/01/jekyll-and-bibtex/</link>
<guid isPermaLink="true">http://pascalpoizat.github.io/blog/posts/2016/02/01/jekyll-and-bibtex/</guid>
<category>jekyll</category>
<category>bibtex</category>
<category>jekyll-scholar</category>
</item>
<item>
<title>GitHub Pages without the Workflow</title>
<description><p class="text-justify">Jekyll nicely <a href="http://jekyllrb.com/docs/github-pages/">integrates with GitHub Pages</a>.
However, this comes with rules that forbid using Jekyll plugins but for authorized ones.<br />
We will see here how to deal with this limit.</p>
<p class="text-justify"><strong>Note:</strong> I am discussing here about User pages on GitHub Pages.
For Project pages things are a bit different. For example for User pages, pages are on a <code class="highlighter-rouge">master</code> branch.
For Project pages, pages are on a <code class="highlighter-rouge">gh-pages</code> branch.
See <a href="https://help.github.com/articles/user-organization-and-project-pages/">here</a>.</p>
<h2 id="two-choices">Two choices</h2>
<p class="text-justify">If you want, e.g., to use the <a href="https://github.com/inukshuk/jekyll-scholar">Jekyll-Scholar</a> plugin
(to generate pages from <code class="highlighter-rouge">.bib</code> BibTeX reference files),
you will have either not to use GitHub Pages
(make a simple <code class="highlighter-rouge">my-web-pages</code> repository and sync your pages with a Web server somewhere else)
or to shortcut the GitHub Pages workflow. This is what we will do here.</p>
<p class="text-justify">This part is based on <a href="https://github.com/barais/barais.github.io">Olivier Barais’s template</a>,
itself based on <a href="https://github.com/rudametw/rudametw.github.io">Walter Rudametkin’s template</a>.
I chose not to fork their templates here since my site structure is different and I also
wanted to build things from scratch to explain how to integrate elements one by one. Yet, without them,
shortcutting the GitHub Pages workflow would certainly have been much more complicated.
Please consider forking their templates that are much more advanced than mine for the moment.</p>
<h2 id="how-things-work-with-the-github-pages-workflow">How things work with the GitHub Pages workflow</h2>
<p class="text-justify">Jekyll takes its sources, i.e., files and specific directories (ones beginning by <code class="highlighter-rouge">_</code> in short) in the current path
and compute pages in subdirectory <code class="highlighter-rouge">_src</code>. See the Jekyll directory structure <a href="http://jekyllrb.com/docs/structure/">here</a>.</p>
<p class="text-justify">GitHub Pages require that your Jekyll sources are in the root directory of <code class="highlighter-rouge">username.github.io</code>.
Then it runs Jekyll and deploys the resulting pages to <code class="highlighter-rouge">http://username.github.io</code>.</p>
<p class="text-justify">If you want to write your pages directly (e.g, without templates) you would have to put them
at the root of the <code class="highlighter-rouge">username.github.io</code> repository and add a <code class="highlighter-rouge">.nojekyll</code> empty file to tell GitHub Pages not to
run Jekyll each time you push things. This is very important if you have directories beginning with <code class="highlighter-rouge">_</code> since
they have a special treatment with Jekyll (they are not deployed on the Web site).</p>
<h2 id="putting-things-together">Putting things together</h2>
<p>The solution that is adopted in <a href="https://github.com/barais/barais.github.io">Olivier Barais’s template</a> and
in <a href="https://github.com/rudametw/rudametw.github.io">Walter Rudametkin’s template</a> is:</p>
<ol>
<li>
<p>define a <code class="highlighter-rouge">src</code> directory at the root (of the repository) containing the Jekyll sources</p>
</li>
<li>
<p>edit files in <code class="highlighter-rouge">src</code> as usual, and commit+push them to GitHub regularly</p>
</li>
<li>
<p>have Jekyll run on these sources and place them in <code class="highlighter-rouge">src/_site</code> (default)</p>
</li>
<li>
<p>“build” the site regularly by copying the pages from <code class="highlighter-rouge">src/_site</code> to the root of the repository,
and then commit+push the new versions of these to GitHub</p>
</li>
</ol>
<p class="text-justify">For this one has two scripts that automate steps 3. and 4.
Step 3. is achieved by <code class="highlighter-rouge">src/run-jekyll.sh</code>. You can have it run in background while doing steps 1. and 2.
Step 4. is achieved by <code class="highlighter-rouge">src/update-site.sh</code>.</p>
<p class="text-justify"><strong>Note:</strong> Jekyll supports the possibility to tell in its configuration file
where are the source and the target directories.
I may use this in the future to simplify things and avoid some file copying.</p>
</description>
<pubDate>Fri, 29 Jan 2016 00:00:00 +0100</pubDate>
<link>http://pascalpoizat.github.io/blog/posts/2016/01/29/github-pages-without-the-workflow/</link>
<guid isPermaLink="true">http://pascalpoizat.github.io/blog/posts/2016/01/29/github-pages-without-the-workflow/</guid>
<category>jekyll</category>
<category>github-pages</category>
</item>
<item>
<title>Generating a Page using Personal Data</title>
<description><p class="text-justify">Static page generators such as <a href="http://jekyllrb.com/">Jekyll</a> can
use data stored in files to produce the information contained into HTML pages.<br />
We will have a look at this using a simple example.</p>
<h2 id="the-data-files">The data files</h2>
<p class="text-justify">The first step is to define the file(s) that will contain the information.
This can be either JSON, YAML, or CSV files.
For <a href="/duties/">my list of duties</a> I chose to use YAML files, but another part of my site,
the list of talks, used to rely on JSON files.
Data files have to be put in the <code class="highlighter-rouge">_data</code> directory of the Jekyll tree structure.
Sub-directories can be used to structure your set of data files. So here I put my data within <code class="highlighter-rouge">_data/duties</code>.
Further, we will have one file for the current duties, <code class="highlighter-rouge">currently.yml</code>,
and another file, <code class="highlighter-rouge">before.yml</code>, for the old ones. Here is the <code class="highlighter-rouge">currently.yml</code> one:</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">Pedagogic</span>
<span class="na">values</span><span class="pi">:</span>
<span class="pi">-</span> <span class="na">period</span><span class="pi">:</span> <span class="s">since 2012</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">Director of 1st and 2nd year of Master in CS (Applied cursus, MIAGE)</span>
<span class="na">at</span><span class="pi">:</span> <span class="s">Paris Ouest University</span>
<span class="pi">-</span> <span class="na">name</span><span class="pi">:</span> <span class="s">Scientific</span>
<span class="na">values</span><span class="pi">:</span>
<span class="pi">-</span> <span class="na">period</span><span class="pi">:</span> <span class="s">since 2014</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">Member of the Nat. Committee for Scientific Research | CoNRS Sect. 6</span>
<span class="na">at</span><span class="pi">:</span> <span class="s">CNRS</span>
<span class="pi">-</span> <span class="na">period</span><span class="pi">:</span> <span class="s">since 2014</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">Member of the Laboratory Council | Conseil de Laboratoire</span>
<span class="na">at</span><span class="pi">:</span> <span class="s">LIP6 Laboratory</span>
<span class="pi">-</span> <span class="na">period</span><span class="pi">:</span> <span class="s">since 2013</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">Member of the CS Advisory Council | CCD Sect. 27</span>
<span class="na">at</span><span class="pi">:</span> <span class="s">Paris Ouest University</span></code></pre></figure>
<p class="text-justify">You have a list of 2 items, each item containing a name (category) and a list of values,
with a value being a period, a name, and the location it took place
(see <a href="https://fr.wikipedia.org/wiki/YAML">here</a> for information about the YAML format).</p>
<h2 id="from-data-to-html">From data to HTML</h2>
<p class="text-justify">To generate HTML information for this, one can create an HTML document, <code class="highlighter-rouge">duties.html</code>,
and use <a href="http://liquidmarkup.org/">Liquid templating</a> to access the data.
To generate a list you simply have to type in <code class="highlighter-rouge">duties.html</code>:</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid">---
layout: default
title: duties
---
<span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>category<span class="w"> </span>in<span class="w"> </span>site.data.duties.currently<span class="w"> </span><span class="p">%}</span>
&lt;h3&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">category</span><span class="p">.</span><span class="nv">name</span><span class="w"> </span><span class="p">}}</span>&lt;/h3&gt;
&lt;ul&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>duty<span class="w"> </span>in<span class="w"> </span>category.values<span class="w"> </span><span class="p">%}</span>
&lt;li&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">period</span><span class="w"> </span><span class="p">}}</span> - <span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">name</span><span class="w"> </span><span class="p">}}</span>&lt;br/&gt;
<span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">at</span><span class="w"> </span><span class="p">}}</span>
&lt;/li&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span>
&lt;/ul&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>
<p class="text-justify">As you can see, to access the data in the file <code class="highlighter-rouge">_data/duties/currently.yml</code>, we refer to <code class="highlighter-rouge">site.data.duties.currently</code>.
This can be read as “the <code class="highlighter-rouge">currently</code> file that is in the <code class="highlighter-rouge">duties</code> subdirectory of the site data directory”.</p>
<p class="text-justify">For loops iterate over a list using some variable <code class="highlighter-rouge">v</code>.</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid"><span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>v<span class="w"> </span>in<span class="w"> </span>list<span class="w"> </span><span class="p">%}</span>...<span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>
<p class="text-justify">To access to some attribute <code class="highlighter-rouge">a</code> of a variable <code class="highlighter-rouge">v</code>, we use double brackets and indexing.</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid"><span class="p">{{</span><span class="w"> </span><span class="nv">v</span><span class="p">.</span><span class="nv">a</span><span class="w"> </span><span class="p">}}</span></code></pre></figure>
<p class="text-justify">The rest is self-explanatory if you know HTML.</p>
<p class="text-justify">You can get more information on Liquid templating <a href="http://jekyllrb.com/docs/datafiles/">here</a> and <a href="http://liquidmarkup.org/">here</a>.</p>
<h2 id="factorizing-things">Factorizing things</h2>
<p class="text-justify">Now if you want to generate also the list of the old duties, you have to copy-paste the piece of code before,
and replace <code class="highlighter-rouge">site.data.duties.currently</code> by <code class="highlighter-rouge">site.data.duties.before</code>. Too bad.
A better way to do things is to define the code in terms of a variable <code class="highlighter-rouge">duties</code> as follows:</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid"><span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>category<span class="w"> </span>in<span class="w"> </span>duties<span class="w"> </span><span class="p">%}</span>
&lt;h3&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">category</span><span class="p">.</span><span class="nv">name</span><span class="w"> </span><span class="p">}}</span>&lt;/h3&gt;
&lt;ul&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>duty<span class="w"> </span>in<span class="w"> </span>category.values<span class="w"> </span><span class="p">%}</span>
&lt;li&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">period</span><span class="w"> </span><span class="p">}}</span> - <span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">name</span><span class="w"> </span><span class="p">}}</span>&lt;br/&gt;
<span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">at</span><span class="w"> </span><span class="p">}}</span>
&lt;/li&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span>
&lt;/ul&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>
<p class="text-justify">Then you put this piece of code, say <code class="highlighter-rouge">print_duties</code> within the Jekyll include directory, <code class="highlighter-rouge">_includes</code>.
In order to generate both lists of duties you now simply have to write in <code class="highlighter-rouge">duties.html</code>:</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid">---
layout: default
title: duties
---
&lt;h2&gt;Currently&lt;/h2&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">duties</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">.</span><span class="nv">duties</span><span class="p">.</span><span class="nv">currently</span><span class="w"> </span><span class="p">%}</span>
<span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span><span class="na">print_duties</span><span class="p">.</span><span class="na">html</span><span class="w"> </span><span class="p">%}</span>
&lt;h2&gt;Before&lt;/h2&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">duties</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">.</span><span class="nv">duties</span><span class="p">.</span><span class="nv">before</span><span class="w"> </span><span class="p">%}</span>
<span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span><span class="na">print_duties</span><span class="p">.</span><span class="na">html</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>
<p class="text-justify">If you prefer to use Markdown, use instead a <code class="highlighter-rouge">duties.md</code> file with:</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid">---
layout: default
title: duties
---
## Currently
<span class="p">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">duties</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">.</span><span class="nv">duties</span><span class="p">.</span><span class="nv">currently</span><span class="w"> </span><span class="p">%}</span>
<span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span><span class="na">print_duties</span><span class="p">.</span><span class="na">html</span><span class="w"> </span><span class="p">%}</span>
## Before
<span class="p">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">duties</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">.</span><span class="nv">duties</span><span class="p">.</span><span class="nv">before</span><span class="w"> </span><span class="p">%}</span>
<span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span><span class="na">print_duties</span><span class="p">.</span><span class="na">html</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>
<h2 id="factorizing-things-revisited">Factorizing things (revisited)</h2>
<p class="text-justify">Indeed file inclusion supports parameters (see <a href="http://jekyllrb.com/docs/templates/">here</a>).
You can add the parameter and its value to the import as follows:</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid">---
layout: default
title: duties
---
## Currently
<span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span><span class="na">print_duties</span><span class="p">.</span><span class="na">html</span><span class="w"> </span><span class="na">duties</span><span class="o">=</span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">.</span><span class="nv">duties</span><span class="p">.</span><span class="na">currently %}
## Before
{% include print_duties</span><span class="p">.</span><span class="na">html</span><span class="w"> </span><span class="na">duties</span><span class="o">=</span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">.</span><span class="nv">duties</span><span class="p">.</span><span class="nv">before</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>
<p class="text-justify">In the <code class="highlighter-rouge">print_duties.html</code> template that is in the <code class="highlighter-rouge">_includes</code> directory, you just have to prefix the name of the parameter with <code class="highlighter-rouge">include</code>:</p>
<figure class="highlight"><pre><code class="language-liquid" data-lang="liquid"><span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>category<span class="w"> </span>in<span class="w"> </span>include.duties<span class="w"> </span><span class="p">%}</span>
&lt;h3&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">category</span><span class="p">.</span><span class="nv">name</span><span class="w"> </span><span class="p">}}</span>&lt;/h3&gt;
&lt;ul&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>duties<span class="w"> </span>in<span class="w"> </span>category.values<span class="w"> </span><span class="p">%}</span>
&lt;li&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">period</span><span class="w"> </span><span class="p">}}</span> - <span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">name</span><span class="w"> </span><span class="p">}}</span>&lt;br/&gt;
<span class="p">{{</span><span class="w"> </span><span class="nv">duty</span><span class="p">.</span><span class="nv">at</span><span class="w"> </span><span class="p">}}</span>
&lt;/li&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span>
&lt;/ul&gt;
<span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span></code></pre></figure>
</description>
<pubDate>Wed, 27 Jan 2016 00:00:00 +0100</pubDate>
<link>http://pascalpoizat.github.io/blog/posts/2016/01/27/generating-a-page-using-personal-data/</link>
<guid isPermaLink="true">http://pascalpoizat.github.io/blog/posts/2016/01/27/generating-a-page-using-personal-data/</guid>
<category>jekyll</category>
<category>liquid</category>
<category>templates</category>
<category>yaml</category>
</item>
<item>
<title>Web Site now using Jekyll</title>
<description><p class="text-justify">New static Web site, now generated using <a href="http://jekyllrb.com/">Jekyll</a>.</p>
<h2 id="static-pages">Static pages</h2>
<p class="text-justify">There are many reasons to prefer static pages over dynamic ones.
You may find some <a href="http://nilclass.com/courses/what-is-a-static-website/#1">here</a>.
It turns out you just have to write some HTML/CSS files using your editor or IDE of choice and then send these files to a server.
You can do this in a responsive way using <a href="http://getbootstrap.com/">BootStrap</a> and with style using available templates,
see e.g., <a href="http://html5up.net/">HTML5UP</a>.</p>
<p class="text-justify">There are limits to this approach.</p>
<p class="text-justify">First, changing the style of your Web site over time soon becomes a burden. A solution is never to change this style.
I am sure you have already seen the nice <em>no-css-no-javascript-HTML-2.0</em> pages that some people like in academia.
But what you are not one of these?
Further, what if your pages relate to data you gather with time?
Of course, you could try to keep your data and your manually edited Web pages synchronized. Not fun.</p>
<h2 id="static-page-generators">Static page generators</h2>
<p class="text-justify">A solution is to follow a <em>data-and-generators</em> approach.
Using data, stored in a database or in files, you can generate not only up-to-date Web pages but also resumes, application files, etc.
Nothing really new here.
Indeed, I had used the <a href="https://github.com/sebastien/tahchee">TahChee</a> python-based static Web site generator for some time.</p>
<p class="text-justify">The choice of a generation framework is vast, <a href="https://www.staticgen.com/">see here</a> for example.</p>
<h2 id="jekyll">Jekyll</h2>
<p class="text-justify">At a first step I would have liked to find one based on the new language I am learning, <a href="https://kotlinlang.org/">Kotlin</a>.
None.
<a href="http://sysgears.com/grain/">Grain</a>, based on Groovy, and with support for the <a href="http://gradle.org/">Gradle</a> build system seems nice too.
But a bit too young.
So let’s go for <a href="http://jekyllrb.com/">Jekyll</a>.</p>
<p class="text-justify">It’s quite simple to have a running Jekyll site:</p>
<ul>
<li>if you intend to publish your Web pages using GitHub pages, the good starting point is the very nice <a href="http://jmcglone.com/guides/github-pages/">tutorial by Jonathan McGlone</a></li>
<li>if not, you can simply follow the <a href="http://jekyllrb.com/docs/quickstart/">Jekyll quick-start guide</a>.</li>
</ul>
<p class="text-justify"><strong>Update:</strong> just found the <a href="http://jekyll.tips/">Jekyll Tips</a> site.
Lots of interesting information here too.</p>
</description>
<pubDate>Tue, 26 Jan 2016 00:00:00 +0100</pubDate>
<link>http://pascalpoizat.github.io/blog/posts/2016/01/26/jekyll-site-launched/</link>
<guid isPermaLink="true">http://pascalpoizat.github.io/blog/posts/2016/01/26/jekyll-site-launched/</guid>
<category>jekyll</category>
<category>github-pages</category>
</item>
</channel>
</rss>