build in build, not temp. update templates to match
OUTDIR=blog.aescling.cat.family
OUTDIR=blog.aescling.cat.family
ARTICLES=$(wildcard source/*.djot)
_UNFORMATTED_ARTICLES=$(ARTICLES:.djot=.unformatted)
ARTICLES=$(wildcard source/*.djot)
_UNFORMATTED_ARTICLES=$(ARTICLES:.djot=.unformatted)
-UNFORMATTED_ARTICLES=$(patsubst source/%, temp/%, $(_UNFORMATTED_ARTICLES))
-_FORMATTED_ARTICLES=$(UNFORMATTED_ARTICLES:.unformatted=.xhtml)
-# putting these in $(OUTDIR) will make the links from index.xhtml point to
-# `4(OUTDIR)/$BASENAME.xhtml`, instead of `$BASENAME.xhtml`; we will move them
-# later
-FORMATTED_ARTICLES=$(patsubst temp/%, %, $(_FORMATTED_ARTICLES))
+UNFORMATTED_ARTICLES=$(patsubst source/%, $(OUTDIR)/%, $(_UNFORMATTED_ARTICLES))
+FORMATTED_ARTICLES=$(UNFORMATTED_ARTICLES:.unformatted=.xhtml)
COMMONS=$(wildcard template/common/*)
COMMONS=$(wildcard template/common/*)
.SECONDARY:
all: $(OUTDIR)/index.xhtml $(OUTDIR)/atom.xml
.SECONDARY:
all: $(OUTDIR)/index.xhtml $(OUTDIR)/atom.xml
- for f in $(FORMATTED_ARTICLES); do \
- [ -f "$$f" ] || exit 0; \
- done && mv $(FORMATTED_ARTICLES) $(OUTDIR)
-$(OUTDIR)/index.xhtml: temp/index.unformatted_index
+$(OUTDIR)/index.xhtml: $(BUILDDIR)/index.unformatted_index $(OUTDIR)
-temp/index.unformatted_index: $(FORMATTED_ARTICLES) template/index.xhtml.template
+$(BUILDDIR)/index.unformatted_index: $(FORMATTED_ARTICLES) template/index.xhtml.template $(BUILDDIR)
sblg -t template/index.xhtml.template -s rdate -o $@ $(FORMATTED_ARTICLES)
sblg -t template/index.xhtml.template -s rdate -o $@ $(FORMATTED_ARTICLES)
-%.xhtml: temp/%.unformatted
+# the URLs fur post will be `$(OUTDIR)/%.xhtml`; links will havu to be
+# overridden in the templates
+$(OUTDIR)%.xhtml: $(BUILDDIR)/%.unformatted $(BUILDDIR)
-temp/%.unformatted: temp/%.fragment template/article.xhtml.template
+$(BUILDDIR)/%.unformatted: $(BUILDDIR)/%.fragment template/article.xhtml.template $(BUILDDIR)
sblg -t template/article.xhtml.template -c -o $@ $<
# the djot file MUST generate content surrounded by
sblg -t template/article.xhtml.template -c -o $@ $<
# the djot file MUST generate content surrounded by
#
# the hxextract(1) invocation is redundant unless the djot source file is
# pathological, containing content befur or after the div
#
# the hxextract(1) invocation is redundant unless the djot source file is
# pathological, containing content befur or after the div
-temp/%.fragment: source/%.djot
+$(BUILDDIR)/%.fragment: source/%.djot
{ echo '<article data-sblg-article="1">'; \
djot $< | hxextract .article - | sed '1d; $$d'; \
echo '</article>'; } >$@
{ echo '<article data-sblg-article="1">'; \
djot $< | hxextract .article - | sed '1d; $$d'; \
echo '</article>'; } >$@
-$(OUTDIR)/atom.xml: temp/atom.unformatted_atom
+$(OUTDIR)/atom.xml: $(BUILDDIR)/atom.unformatted_atom $(OUTDIR)
-temp/atom.unformatted_atom: $(FORMATTED_ARTICLES) template/atom.xml.template
+$(BUILDDIR)/atom.unformatted_atom: $(FORMATTED_ARTICLES) template/atom.xml.template $(BUILDDIR)
sblg -t template/atom.xml.template -a -o $@ $(FORMATTED_ARTICLES)
template/%.template: template/%.sh $(COMMONS)
./$< | hxnormalize -x >$@
sblg -t template/atom.xml.template -a -o $@ $(FORMATTED_ARTICLES)
template/%.template: template/%.sh $(COMMONS)
./$< | hxnormalize -x >$@
+$(OUTDIR):
+ mkdir -p $(OUTDIR)
+
+$(BUILDDIR):
+ mkdir -p $(BUILDDIR)
+
<p>a blog by cat æscling</p>
</header>
<p>a blog by cat æscling</p>
</header>
- <nav data-sblg-nav="1"></nav>
+ <nav data-sblg-nav="1" data-sblg-navcontent="1">${sblg-date}: <a href="${sblg-stripbase}.xhtml">${sblg-title}</a>
+ </nav>
EOF
cat template/common/footer.xhtml.template.fragment
EOF
cat template/common/footer.xhtml.template.fragment