News for hackers. Stuff that matters.
Re:Cog: Use Python in your source files to generate pieces o... by lf-non on Wednesday December 13, 2023 @02:01AM (#38623623)
I don't think that would fall within the scope of a utility like cog.

I wrote a minimal tool long back which I used to extract parts of code from my test suite as json which I could then use within my documentation generator to embed these snippets as example.

The examples then are guaranteed to be correct because they are quite literally pulled from the project's test suite. The util is written i n ts but should work with any lang. that supports C or Python style comments.

https://github.com/lorefnon/snippet-collector

There are no comments on this comment yet.