diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2020-02-22 13:20:31 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2020-02-22 13:23:26 +0100 |
commit | 0f8643954fd9507aec85bab46046e71a497bfffe (patch) | |
tree | 28708a991bd136fd255282326e93f7588120a2e3 /gen.sh | |
parent | a91fc5e945b841ae54f67ed331409ad857178f13 (diff) | |
download | lulua-0f8643954fd9507aec85bab46046e71a497bfffe.tar.gz lulua-0f8643954fd9507aec85bab46046e71a497bfffe.tar.bz2 lulua-0f8643954fd9507aec85bab46046e71a497bfffe.zip |
doc: Switch to jinja2-based rendering
Pre-rendering HTML was not the best idea. Instead pre-process the data,
cache it into data files and do the HTML rendering only as the final
step.
Also adds asymmetry to analysis and uses tabular numbers and spaces
instead of ugly table hacks to align numbers.
Diffstat (limited to 'gen.sh')
-rwxr-xr-x | gen.sh | 38 |
1 files changed, 16 insertions, 22 deletions
@@ -9,6 +9,7 @@ cat <<EOF ### auto-generated by gen.sh. Do not edit. ### ### settings ### +datadir=lulua/data corpusdir=corpus statsdir=stats docdir=doc @@ -83,20 +84,17 @@ rule mkdir rule letterfreq command = lulua-analyze -l ar-lulua letterfreq < \$in > \$out -rule analyze-fingerhand - command = lulua-analyze -l \$layout fingerhand < \$in > \$out +rule analyze-layoutstats + command = lulua-analyze -l \$layout layoutstats < \$in > \$out rule analyze-corpusstats command = lulua-analyze -l ar-lulua corpusstats \$metadata < \$stats > \$out -rule analyze-corpushtml - command = cat \$in | lulua-analyze -l ar-lulua corpushtml > \$out - rule wordlist command = lulua-analyze -l ar-lulua latinime < \$in > \$out -rule html - command = m4 -I \$docdir/_temp \$template > \$out +rule report + command = lulua-report -c \$corpus -l \$layoutstats > \$out rule cp command = cp \$in \$out @@ -121,8 +119,8 @@ build \$docdir/_build: mkdir build \$docdir/_build/fonts: mkdir build \$docdir/_temp: mkdir 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 +build \$docdir/_build/style.css: cp \$datadir/report/style.css || \$docdir/_build +build \$docdir/_build/lulua-logo.svg: cp \$datadir/report/lulua-logo.svg || \$docdir/_build # wordlist build \$docdir/_temp/lulua.combined: wordlist \$statsdir/ar-lulua/all.pickle || \$docdir/_temp build \$docdir/_build/lulua.combined.gz: gz \$docdir/_temp/lulua.combined || \$docdir/_build @@ -191,12 +189,12 @@ build \$docdir/_temp/${l}-heat.yaml: analyze-heat \$statsdir/${l}/all.pickle || build \$docdir/_build/${l}-heat.svg: render-svg-heat \$docdir/_temp/${l}-heat.yaml || \$docdir/_build layout = ${l} -build \$docdir/_temp/${l}-fingerhand.html: analyze-fingerhand \$statsdir/${l}/all.pickle || \$docdir/_temp +build \$docdir/_temp/${l}-layoutstats.pickle: analyze-layoutstats \$statsdir/${l}/all.pickle || \$docdir/_temp layout = ${l} EOF # included by index.html and thus must be its dependencies -fingerhandfiles+=" \$docdir/_temp/${l}-fingerhand.html" +layoutstatsfiles+=" \$docdir/_temp/${l}-layoutstats.pickle" done # layouts with xmodmap support @@ -209,7 +207,7 @@ EOF done # statistics for each corpus (ar-lulua) and html rendering -outfiles="" +metafiles="" for c in $corpora; do 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 @@ -217,18 +215,14 @@ build \$docdir/_temp/metadata-$c.yaml: analyze-corpusstats \$statsdir/ar-lulua/$ stats = \$statsdir/ar-lulua/$c.pickle EOF -outfiles+=" \$docdir/_temp/metadata-$c.yaml" +metafiles+=" \$docdir/_temp/metadata-$c.yaml" done +# dependencies are not properly modeled, always rebuild 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 - +build always: phony +build \$docdir/_build/index.html: report | always || \$docdir/_build $metafiles $layoutstatsfiles + corpus = $metafiles + layoutstats = $layoutstatsfiles EOF |