Skip to content

Literate Programming with LibreOffice

This post comes in the form of an OpenDocumentFormat document containing a program that can extract programs from ODF documents, including the program contained in this document.

{ 1 } Comments

  1. Tim Daly | May 22, 2017 at 2:22 pm | Permalink

    https://en.wikipedia.org/wiki/Axiom_(computer_algebra_system) contains links to the literate programs that make up the Axiom computer algebra system. They were produced using LaTeX.

    Latex is trivially easy to use. Writing an initial document requires almost no markup. Anything special you might want to do can be found online.

    The Axiom documentation uses a trivial markup, called a ‘chunk’ which has a name. as in

    \begin{chunk}{somename}

    code goes here

    \end{chunk}

    and a program that expects the name of the file (e.g. mydocument.tex) and a chunk name, as in

    tangle mydocument.tex somename

    and writes the result to standard output. You can redirect the output to a file. That’s all the tooling you need. Send me an email and I’ll send you the code to extract chunks. It’s pretty trivial.

    See the page http://axiom-developer.org/axiom-website/documentation.html

    On that page is a link to http://axiom-developer.org/axiom-website/litprog.html which is an example program to write literate programs in HTML. Like your example, this page contains the code to extract itself from the HTML source.

    The gold standard for literate programming is a book called “Physically Based Rendering” which won an Academy Award. If all programs were written that way it would be easy to maintain and modify them. Buy the book (I have no connection to it) and strive to achieve that level of explanation (not “documentation”, not “comments”).

Post a Comment

Your email is never published nor shared. Required fields are marked * Comments are moderated; please make sure that your post is civil and valuable before submitting it to improve the chance it will be accepted.