MD -> TXT: scripts/preprocmdheaders.pl -n $docdir MD -> HTML: scripts/preprocmdheaders.pl -nl $docdir scripts/linkpages.pl $docdir markdown $docdir/index.txt > $docdir/index.html while read file; do \ markdown $docdir/$file.txt > $docdir/$file.html done < $docdir/series scripts/postprochtmlheaders.pl -anL $docdir scripts/preprocmdheaders.pl [-ntl] docdir options -n prepend section numbers to headers -l handle hyperlinks to sections in text and table of contents pseudocode chapter = 0 for each file in $docdir/series: ++chapter ... for each header: if opt n: ... ... scripts/linkpages.pl docdir scripts/postprochtmlheaders.pl [-anL] docdir options -a add "id" attributes to headers -n remove section numbers from "id" attributes (use with -a) scripts/preproc.pl options -f format "txt" or "html" pseudopseudocode scan each source file for sections build a ToC print(' ' x $seclev, "* [$secnum $sectitle][$secid]\n"); if txt add section numbers to headers add $title . "\n" . '*' x strlen($title) if html add link defs "[$secid]: $chapter.html#$section_id" scripts/postproc.pl options -f format "txt" or "html" pseudopseudocode if txt blame the schools and bail out add section numbers and "id" attributes to headers $docdir/ +- appendices | A list of appendix documents in the book. +- chapters | A list of chapter documents in the book. +- first-chapter.md | The source file for a chapter. +- first-chapter.html | The rendered HTML file for a chapter. +- first-chapter.txt | The rendered text file for a chapter. +- reference-stuff.md | The source file for an appendix. +- second-chapter.md | The source file for a chapter. \- title.md The source file for the title page. ToC substitution: $[toc] section link substitution: $[sectlink][foo] [ยง 1.10.11][foo] # create book and documents - DONE # book->parse() - DONE # foreach document: - DONE # doc->parse() - DONE # foreach heading: - DONE # section = new Section - DONE # push(self->sections, section) - DONE # book->add_section() - DONE # prefix section title with num - DONE # book->output() - DONE # book->subst_macros - DONE # build ToC string - DONE # foreach document: - DONE # doc(Txt)->output() - DONE # book->subst_macros() - DONE # write title - DONE # dump Markdown text - DONE # doc(HTML)->output() - DONE # book->subst_macros() - DONE # append link defs string - DONE # generate HTML (markdown) - DONE # parse HTML - DONE # foreach heading: - DONE # set id attribute - DONE # write templated documents - DONE # # Book # new # add_section # indexes section by id # appends to link defs string # parse # output # add_section # add_macro # subst_macros # _do_subst_macro # Document # new # parse # Document::Txt # output # Document::HTML # output # Section # new # number # id # title