retroforth/tools/make-book.retro
crc c38f11224e toolchain: move generate-epub.retro to tools/, fix make-book.retro
FossilOrigin-Name: e7506b632a7289a7b25c3c84332efa243f0c9075a576f7411345a474065c65e2
2020-10-01 16:53:52 +00:00

36 lines
886 B
Forth
Executable file

#!/usr/bin/env retro
This is used to assemble the Markdown copy of the RETRO Handbook.
The individual chapters are in the `book/` directory. This is set
using the `BOOK-BASE` constant.
~~~
'doc/book/ 'BOOK-BASE s:const
~~~
The chapters are specified it the `TOC`, a named array. These are
the file names, they will be included in order. I am structuring
it using separate file to make the actual editing process easier
for me.
~~~
'tools/book-chapters.retro include
~~~
~~~
'Out var
:import here swap BOOK-BASE s:prepend file:slurp ;
:/n ASCII:LF @Out file:write ;
:add-to-book here [ @Out file:write ] s:for-each /n ;
:process-files [ #1 a:fetch import add-to-book $. c:put ] a:for-each nl ;
:open 'doc/RETRO-Book.md file:open-for-writing !Out ;
:close @Out file:close ;
:assemble open process-files close ;
~~~
~~~
TOC assemble
~~~