Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 2.03 KB

postproc.adoc

File metadata and controls

46 lines (37 loc) · 2.03 KB

Postprocessing

When the Racket preprocessing and the Asciidoctor runs complete, we have a bunch of .cached/*.html files in our distribution tree. It would be nice if these were all there is to it, but there is still a bunch of post-processing left. We use the other $ADOC_POSTPROC_* files to guide this post-processing.

For starters, the .cached/*.html files need to go up one directory, so they sit alongside their source .adoc files in the distribution tree. (We may later choose to delete the .adoc files before deployment to the website, but that’s a different matter.) In particular, we need to ensure that the final HTML file has extension .shtml when it’s a lesson plan or pathway doc, either narrative or resources. It is .html in all other cases, i.e., workbook pages and pathway-independent files.

The following are the components of the postprocessing:

  • CSS path correction: When Asciidoctor is run on the .asc file, it enshrines a pathname for curriculum.css. Make it relative to the HTML location. (Unfortunately, Asciidoctor can’t take a relative pathname correctly from command-line when called on files that aren’t in the calling directory.)

  • Boilerplate insertion. Include links to various .css and .js files. Sometimes conditionally: Codemirror-related links are included only if the file has tags classed pyret, racket, or circleevalsexp.

  • Nested span and div insertion. Asciidoctor lacks the ability to nest more than one level of div or span with specific classes. The Racket preprocessor embeds markers for these so they go through Asciidoctor verbatim. We can now scan for them and replace them with divs/spans as appropriate.

  • Remove intrusive spans in headers, add self-link to h2’s

  • Create Google-Drive versions

In general, it would be nice to reduce the amount of postprocessing needed. However there are some limitations to how much we can autoinsert during the preprocessing and Asciidoctor-ing phases. View this purely as the unavoidable finishing touch. Hopefully we can reduce this with time.