Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
Christine Dodrill 2021-04-23 14:22:52 -04:00
parent c6eb3fa975
commit b7434d1894
9 changed files with 34 additions and 21 deletions

6
.gitignore vendored
View File

@ -1 +1,5 @@
result
result
*.epub
*.mobi
*.pdf
.redo

2
all.do Normal file
View File

@ -0,0 +1,2 @@
redo-ifchange Spellblade.mobi
redo-ifchange wordcount

11
default.epub.do Normal file
View File

@ -0,0 +1,11 @@
DEPS="$(ls ./src/**/*.md | grep -v plans)"
redo-ifchange $DEPS ./src/style.css ./src/pagebreak.lua ./src/title.txt
pandoc \
-o $3 \
--resource-path=./src \
--css ./src/style.css \
--lua-filter ./src/pagebreak.lua \
--to epub \
./src/title.txt $DEPS

5
default.mobi.do Normal file
View File

@ -0,0 +1,5 @@
exec >&2
redo-ifchange ./out/$2.epub
ebook-convert ./out/$2.epub ./out/$2.mobi

View File

@ -14,12 +14,14 @@ in pkgs.stdenv.mkDerivation {
buildInputs = with pkgs; [
calibre
nur.repos.mic92.pandoc-bin
redo-apenwarr
];
buildPhase = ''
cp -rf $src/src .
mkdir out
cd ./src && ./build.sh && cd ..
cp -rf $src/*.do .
mkdir -p out
redo
'';
installPhase = ''

View File

@ -9,6 +9,7 @@ in pkgs.mkShell {
buildInputs = with pkgs; [
calibre
nur.repos.mic92.pandoc-bin
redo-apenwarr
# keep this line if you use bash
bashInteractive

View File

@ -1,18 +0,0 @@
#!/usr/bin/env bash
set -e
[[ $DEBUG ]] && set -x
FILES="$(ls ./**/*.md | grep -v plans)"
echo $FILES
pandoc \
-o ../out/Spellblade.epub \
--resource-path=. \
--css style.css \
--lua-filter ./pagebreak.lua \
title.txt $FILES
ebook-convert ../out/Spellblade.epub ../out/Spellblade.mobi
pandoc --lua-filter wordcount.lua $FILES

View File

@ -0,0 +1 @@
\pagebreak

5
wordcount.do Normal file
View File

@ -0,0 +1,5 @@
DEPS="$(ls ./src/**/*.md | grep -v plans)"
redo-ifchange $DEPS ./src/wordcount.lua
pandoc --lua-filter ./src/wordcount.lua $DEPS >&2