From c543f42fe50d9b10175059ee5ed9186f30445f40 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun
Date: Thu, 14 Nov 2019 17:17:56 +0100
Subject: doc: Process HTML template with m4
Seems to be more reliable than C preprocessor, dependency tracking never
really worked anyway.
---
doc/index.html | 16 ++++++++--------
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
- #include "corpus.html"
+ include(`corpus.html')
The plot below shows ا ل ي م و ن can be
@@ -163,7 +163,7 @@
- #include "ar-lulua-fingerhand.html"
+ include(`ar-lulua-fingerhand.html')
@@ -181,7 +181,7 @@
- #include "ar-asmo663-fingerhand.html"
+ include(`ar-asmo663-fingerhand.html')
@@ -206,7 +206,7 @@
- #include "ar-linux-fingerhand.html"
+ include(`ar-linux-fingerhand.html')
@@ -231,7 +231,7 @@
- #include "ar-malas-fingerhand.html"
+ include(`ar-malas-fingerhand.html')
@@ -262,7 +262,7 @@
- #include "ar-osman-fingerhand.html"
+ include(`ar-osman-fingerhand.html')
@@ -295,7 +295,7 @@
- #include "ar-khorshid-fingerhand.html"
+ include(`ar-khorshid-fingerhand.html')
@@ -325,7 +325,7 @@
- #include "ar-phonetic-fingerhand.html"
+ include(`ar-phonetic-fingerhand.html')
diff --git a/gen.sh b/gen.sh
index de1fed0..589035a 100755
--- a/gen.sh
+++ b/gen.sh
@@ -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 <