literate programming in D
nikki via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 4 05:46:41 PDT 2014
On Saturday, 30 August 2014 at 07:24:39 UTC, Philippe Sigaud
wrote:
> 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?
Ah that sounds interesting too! Immediately I start thinking in
terms like tidlywiki http://tiddlywiki.com/ or something similar,
I guess the emacs way described earlier also would support this.
I personally always enjoy reading the readthedocs stuff
http://docs.readthedocs.org/en/latest/ is that the sort of stuff
you mean?
My current usage of the little script is just for small projects
which basically are written in one or a few files (I am only just
dipping my toe in D ;) ) but I imagine larger projects would need
some linking in the docs anyhow so I definitely will look into
that eventually.
More information about the Digitalmars-d-learn
mailing list