Generate documentation by assembling markdown and litcoffee files

This commit is contained in:
Glen Whitney 2019-12-09 20:52:42 -05:00
parent 83318c7884
commit eb81cee609
5 changed files with 42 additions and 20 deletions

17
doc/gendoc.litcoffee Normal file
View file

@ -0,0 +1,17 @@
- The documentation will be generated by a coffeescript template (gendoc.litcoffee) which collates in the proper order several particular Markdown files, starting with README.md. The list of files includes all of the Literate Coffeescript files, with the actual code stripped out, leaving just the Markdown. The resulting dyna3.md file will be further processed into HTML and placed in the site directory.
```javascript
fs = require 'fs'
striplit = (text) -> String(text).replace(/^```javascript[^]*?```\n/mg,'')
incfile = (fn, filt = null) ->
if (filt is null)
if (/litcoffee$/.test(fn)) then filt = striplit
else filt = (x)->x
process.stdout.write filt fs.readFileSync fn
process.stdout.write "\n"
incfile f for f in [
'README.md', 'src/dyna3.litcoffee',
'src/helpers/pkglock_to_externals.litcoffee', 'docbuild/extlist.md',
'doc/tech.md', 'doc/gendoc.litcoffee' ]
```