diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2019-11-14 17:17:56 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2019-11-16 10:17:42 +0100 |
commit | c543f42fe50d9b10175059ee5ed9186f30445f40 (patch) | |
tree | b2bda46e6247cee0391d1bb68c73de008aa7a245 | |
parent | 14daa5644598836fd6321038c6b0a496c7874374 (diff) | |
download | lulua-c543f42fe50d9b10175059ee5ed9186f30445f40.tar.gz lulua-c543f42fe50d9b10175059ee5ed9186f30445f40.tar.bz2 lulua-c543f42fe50d9b10175059ee5ed9186f30445f40.zip |
doc: Process HTML template with m4
Seems to be more reliable than C preprocessor, dependency tracking never
really worked anyway.
-rw-r--r-- | doc/index.html | 16 | ||||
-rwxr-xr-x | gen.sh | 23 |
2 files changed, 24 insertions, 15 deletions
diff --git a/doc/index.html b/doc/index.html index e930892..b0fa3a1 100644 --- a/doc/index.html +++ b/doc/index.html @@ -119,7 +119,7 @@ The corpus used for the following analysis consists of </p> - #include "corpus.html" + include(`corpus.html') <p> The plot below shows <bdo dir="ltr" lang="ar">ا ل ي م و ن</bdo> can be @@ -163,7 +163,7 @@ <figure id="ar-lulua-heat"> <div class="lbox" lang="en"> <img src="ar-lulua-heat.svg"> - #include "ar-lulua-fingerhand.html" + include(`ar-lulua-fingerhand.html') </div> </figure> @@ -181,7 +181,7 @@ <figure id="ar-asmo663"> <div class="lbox"> <img src="ar-asmo663-heat.svg"> - #include "ar-asmo663-fingerhand.html" + include(`ar-asmo663-fingerhand.html') </div> <figcaption class="pure-g flexreverse"> <div class="pure-u-1 pure-u-md-1-2"> @@ -206,7 +206,7 @@ <figure id="ar-linux"> <div class="lbox"> <img src="ar-linux-heat.svg"> - #include "ar-linux-fingerhand.html" + include(`ar-linux-fingerhand.html') </div> <figcaption class="pure-g flexreverse"> <div class="pure-u-1 pure-u-md-1-2"> @@ -231,7 +231,7 @@ <figure id="ar-malas"> <div class="lbox"> <img src="ar-malas-heat.svg"> - #include "ar-malas-fingerhand.html" + include(`ar-malas-fingerhand.html') </div> <figcaption class="pure-g flexreverse"> <div class="pure-u-1 pure-u-md-1-2"> @@ -262,7 +262,7 @@ <figure id="ar-osman"> <div class="lbox"> <img src="ar-osman-heat.svg"> - #include "ar-osman-fingerhand.html" + include(`ar-osman-fingerhand.html') </div> <figcaption class="pure-g flexreverse"> <div class="pure-u-1 pure-u-md-1-2"> @@ -295,7 +295,7 @@ <figure> <div class="lbox"> <img src="ar-khorshid-heat.svg"> - #include "ar-khorshid-fingerhand.html" + include(`ar-khorshid-fingerhand.html') </div> <figcaption class="pure-g flexreverse"> <div class="pure-u-1 pure-u-md-1-2"> @@ -325,7 +325,7 @@ <figure> <div class="lbox"> <img src="ar-phonetic-heat.svg"> - #include "ar-phonetic-fingerhand.html" + include(`ar-phonetic-fingerhand.html') </div> <figcaption class="pure-g flexreverse"> <div class="pure-u-1 pure-u-md-1-2"> @@ -90,10 +90,8 @@ rule analyze-corpushtml rule wordlist command = lulua-analyze -l ar-lulua latinime < \$in > \$out -rule cpp - command = gcc -E -x c -nostdinc -MMD -MF \$out.d -C -P -I \$docdir/_temp \$in -o \$out - depfile = \$out.d - deps = gcc +rule html + command = m4 -I \$docdir/_temp \$template > \$out rule cp command = cp \$in \$out @@ -105,7 +103,6 @@ rule gz build \$docdir/_build: mkdir build \$docdir/_build/fonts: mkdir build \$docdir/_temp: mkdir -build \$docdir/_build/index.html: cpp \$docdir/index.html || \$docdir/_build build \$docdir/_build/letterfreq.json: letterfreq \$statsdir/ar-lulua/all.pickle || \$docdir/_build build \$docdir/_build/style.css: cp \$docdir/style.css || \$docdir/_build build \$docdir/_build/lulua-logo.svg: cp \$docdir/lulua-logo.svg || \$docdir/_build @@ -116,6 +113,7 @@ build \$docdir/_build/lulua.combined.gz: gz \$docdir/_temp/lulua.combined || \$d build \$docdir/_build/fonts/IBMPlexArabic-Regular.woff2: cp \$fontdir/IBMPlexArabic-Regular.woff2 || \$docdir/_build/fonts build \$docdir/_build/fonts/IBMPlexArabic-Thin.woff2: cp \$fontdir/IBMPlexArabic-Thin.woff2 || \$docdir/_build/fonts + EOF # targets for every layout @@ -138,10 +136,10 @@ build \$statsdir/${l}/tanzil-quaran.pickle: write-tanzil \$corpusdir/tanzil-quar build \$statsdir/${l}/arwiki.pickle: write-arwiki \$corpusdir/arwiki/arwiki-20190701-pages-articles.xml.bz2 || \$statsdir/${l} layout = ${l} -build \$statsdir/${l}/un-v1.0-tei.pickle: write-tei2 \$corpusdir/un-v1.0-tei || \$statsdir/${l} +build \$statsdir/${l}/un-v1.0-tei.pickle: write-tei2 \$corpusdir/un-v1.0-tei/raw || \$statsdir/${l} layout = ${l} -build \$statsdir/${l}/opensubtitles-2018.pickle: write-opensubtitles \$corpusdir/opensubtitles-2018 || \$statsdir/${l} +build \$statsdir/${l}/opensubtitles-2018.pickle: write-opensubtitles \$corpusdir/opensubtitles-2018/raw || \$statsdir/${l} layout = ${l} build \$statsdir/${l}/all.pickle: combine \$statsdir/${l}/bbcarabic.pickle \$statsdir/${l}/aljazeera.pickle \$statsdir/${l}/tanzil-quaran.pickle \$statsdir/${l}/arwiki.pickle \$statsdir/${l}/hindawi.pickle \$statsdir/${l}/un-v1.0-tei.pickle \$statsdir/${l}/opensubtitles-2018.pickle || \$statsdir/${l} @@ -159,6 +157,8 @@ build \$docdir/_temp/${l}-fingerhand.html: analyze-fingerhand \$statsdir/${l}/al layout = ${l} EOF +# included by index.html and thus must be its dependencies +fingerhandfiles+=" \$docdir/_temp/${l}-fingerhand.html" done # layouts with xmodmap support @@ -177,11 +177,20 @@ cat <<EOF build \$docdir/_temp/metadata-$c.yaml: analyze-corpusstats \$statsdir/ar-lulua/$c.pickle \$corpusdir/$c/metadata.yaml || \$docdir/_temp \$corpusdir/$c/metadata.yaml metadata = \$corpusdir/$c/metadata.yaml stats = \$statsdir/ar-lulua/$c.pickle + EOF outfiles+=" \$docdir/_temp/metadata-$c.yaml" done cat <<EOF build \$docdir/_temp/corpus.html: analyze-corpushtml $outfiles || \$docdir/_temp + +EOF + +# html, which depends on several other files generated above +cat <<EOF +build \$docdir/_build/index.html: html \$docdir/index.html \$docdir/_temp/corpus.html $fingerhandfiles || \$docdir/_build + template = \$docdir/index.html + EOF |