literate programming in D
Philippe Sigaud via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Aug 30 00:24:38 PDT 2014
On Sat, Aug 30, 2014 at 1:37 AM, nikki wrote:
> I wasn't too happy about it and I wrote my own little parse
> thingie and have
> a literate version nice and meta and small and sloppy ;)
>
> http://nikkikoole.github.io/docs/dokidokDOC.html
>
> I use it to change my d sourcefile slightly (into valid
> markdown)
> then I use a node module (ghmd) to make sortof sexy html from
> that.
Nice. Maybe you could strip the initial whitespaces in the code
parts: due to blocks, your code lines are shifting to the right.
If you document something that's inside a method inside a class,
you're bound to have problems :)
Right now, you're documenting your code in a linear way. That's
good, but for me, most of LP is based around the idea of naming
snippets and referring to them in code, to be explained elsewhere:
```
Here is the main loop:
<Main>=
void main() {
<Initialize Variables>
<Precompute State>
foreach(i; 0..max) {
<Do Computation>
}
}
Before doing all this, we need to initialize the variables:
<Initialize Variables>= ...
```
Of course, snippets can refer to other snippets, recursively.
Do you have any plan to go there?
More information about the Digitalmars-d-learn
mailing list