diff --git a/.gitignore b/.gitignore index e2f5dd2..0b62354 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -result \ No newline at end of file +result +*.epub +*.mobi +*.pdf +.redo diff --git a/all.do b/all.do new file mode 100644 index 0000000..53ed412 --- /dev/null +++ b/all.do @@ -0,0 +1,2 @@ +redo-ifchange Spellblade.mobi +redo-ifchange wordcount \ No newline at end of file diff --git a/default.epub.do b/default.epub.do new file mode 100644 index 0000000..425a60c --- /dev/null +++ b/default.epub.do @@ -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 \ No newline at end of file diff --git a/default.mobi.do b/default.mobi.do new file mode 100644 index 0000000..12c4bcc --- /dev/null +++ b/default.mobi.do @@ -0,0 +1,5 @@ +exec >&2 + +redo-ifchange ./out/$2.epub + +ebook-convert ./out/$2.epub ./out/$2.mobi \ No newline at end of file diff --git a/default.nix b/default.nix index 59e4e32..37b1826 100644 --- a/default.nix +++ b/default.nix @@ -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 = '' diff --git a/shell.nix b/shell.nix index eb9f4fe..8c0c4f0 100644 --- a/shell.nix +++ b/shell.nix @@ -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 diff --git a/src/build.sh b/src/build.sh deleted file mode 100755 index 1a649b3..0000000 --- a/src/build.sh +++ /dev/null @@ -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 diff --git a/src/chapter-1/scene-2.md b/src/chapter-1/scene-2.md index e69de29..2740c3a 100644 --- a/src/chapter-1/scene-2.md +++ b/src/chapter-1/scene-2.md @@ -0,0 +1 @@ +\pagebreak diff --git a/wordcount.do b/wordcount.do new file mode 100644 index 0000000..152192e --- /dev/null +++ b/wordcount.do @@ -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 \ No newline at end of file