forked from kristapsdz/sblg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
article2.xml
61 lines (61 loc) · 3.02 KB
/
article2.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
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h2>How does it work?</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2013-07-01">01 July, 2013</time></div>
</header>
<aside>How sblg merges articles into a blog.</aside>
<p>
It works like generating executables: with a <a href="Makefile">Makefile</a> like the one building this page (and the code) or
by manual, cc(1)-like compilation.
Click on file links to see the sequence—you'll get the point.
</p>
<p class="code">
<code class="prettyprint">all: <a href="index.html">index.html</a></code>
<code class="prettyprint"><a href="index.html">index.html</a>:
<a href="index.xml">index.xml</a></code>
<code class="prettyprint"><a href="article1.html">article1.html</a>
<a href="article2.html">article2.html</a>:
<a href="article.xml">article.xml</a></code>
<code class="prettyprint"><a href="index.html">index.html</a>:
<a href="article1.html">article1.html</a>
<a href="article2.html">article2.html</a></code>
<code class="prettyprint tab">sblg -o $@
<a href="article1.html">article1.html</a>
<a href="article2.html">article2.html</a></code>
<code class="prettyprint">.xml.html:</code>
<code class="prettyprint tab">sblg -c -o $@ $<</code>
</p>
<p>
Or in words, first build individual articles from a <a href="article.xml">template</a> with <code class="prettyprint
lang-sh">sblg -o article1.html -c article1.xml</code>.
Then knit together individuals into a <a href="index.xml">templated</a> front page with <code class="prettyprint
lang-sh">sblg -t index.xml -o index.html article1.html</code>).
The rest of this Makefile is dependencies.
Not shown are <a href="article4.html">Atom</a> feeds: these use <code class="prettyprint lang-sh">sblg -a atom.xml
article1.html</code> with a <a href="atom-template.xml">template</a> just like the <q>linking</q> phase. See the <a
href="sblg.1.html">sblg(1)</a> manual for details.
</p>
<p>
I actually prefer to use the XML files as input to both the standalone and blog mode.
This allows the rules to be run in parallel.
</p>
<p class="code">
<code class="prettyprint"><a href="index.html">index.html</a>:
<a href="article1.xml">article1.xml</a>
<a href="article2.xml">article2.xml</a></code>
<code class="prettyprint tab">sblg -o $@
<a href="article1.xml">article1.xml</a>
<a href="article2.xml">article2.xml</a></code>
<code class="prettyprint">.xml.html:</code>
<code class="prettyprint tab">sblg -c -o $@ $<</code>
</p>
<p>
Why do I do it like this?
I prefer building articles individually, versioning the source with <a
href="https://en.wikipedia.org/wiki/Concurrent_Versions_System">CVS</a>, alongside templates for individual and linked
articles.
I let <span class="name">sblg</span> do the work of putting it all together.
Since most of my articles involve, for example, images built from <a href="http://gnuplot.info">gnuplot</a> graphs, I already
use Makefiles already to manage dependencies.
</p>
</article>