Mirror of the Rel4tion website/wiki source, view at <http://rel4tion.org>
Clone
HTTPS:
git clone https://vervis.peers.community/repos/yEzqv
SSH:
git clone USERNAME@vervis.peers.community:yEzqv
Branches
Tags
07-literate.mdwn
[[!meta title=“7 | Literate Coding”]]
Literate Coding
Idan supports literate coding. It is a style of writing in which text is a comment by default, and Idan code needs to be marked explicitly. Since comments in Idan don’t have support for documentation generation (because that can work using NLI through names and descriptions of resources), an Idan parser just needs to know how to extract the code from the file, and concatenate into a regular Idan document.
Literate coding is currently based a simple plain-text format. A text file may contain code blocks, which can be detected by an Idan parser. A code block consists of a blank line, a sequence of lines all of which begin with a tab or all begin with 4 spaces, and finally another blank line.
Literate Idan files can be marked as such by giving them an idanl
extension.
The interpretation by the Idan parser is as follows:
- Collect all the sequences of indented lines in the file as described
- Rremove the 1 tab / 4 space indentations
- concatenate the result into a regular Idan document
In particular, it means the code blocks may themselves contain comments (using --
and {- -}
).