EdText
Briefly

"I've long used cog to build documentation and HTML presentations. Cog interpolates text from elsewhere, like source code or execution output. Often I don't want the full source file or all of the lines of output. I want to be able to choose the lines, and sometimes I need to tweak the lines with a regex to get the results I want."
"The old function has 16 arguments (!), nine of which are for selecting the lines of text: Recently I started a new presentation, and when I couldn't express what I needed with these nine arguments, I thought of a better way: the ed text editor has concise mechanisms for addressing lines of text. Ed addressing evolved into vim and sed, and probably other things too, so it might already be familiar to you."
Edtext is a utility inspired by the ed editor for selecting and manipulating lines of text. It provides concise address ranges similar to ed, sed, and vim to select subsets of lines. Edtext integrates with include_file helpers that return EdText objects, allowing slicing with ed-style address strings such as /# section1/;+/# end/- to capture ranges relative to regex matches. The utility targets use cases where embedding code or execution output into documentation requires selecting only specific lines and applying regex tweaks. Edtext replaces complex ad-hoc functions and reduces argument complexity while enabling more expressive line addressing.
Read at Nedbatchelder
Unable to calculate read time
[
|
]