I like my code DRY (Don’t Repeat Yourself)—no boilerplate, no repetition. But there’s always a handful of things I can't clean up. Literate program helps me scrub out those last few stubborn repetitions. Because it's basically a pre-processor, Literate programming can DRY out things that no programming language can. Want to write your company's copyright notice once and reference it in all your source files? Want a project name variable that you can reference across your project? Literate programming is up to the challenge.
Here 1 , I reuse a copyright notice in several files. If I ever need to update it, I change it in one place and run ‘omd tangle’; it gets changed everywhere.
To make life even easier, I add a ‘copyright-year’ variable to a yaml block at the top of the markdown file. Then I can reference it in my copyright code block:
When 2025 comes, I’ll simply change the year in the yaml header, and run ‘omd tangle’ again. All the files will get updated.