I want to automate source code examples in my documentation. Listing comes very close to doing this as it allows specification of start and ending line numbers:
\lstinputlisting[firstline=300,lastline=500]{file.cc}
See: Using \lstinputlisting to include a file but only certain lines or line ranges
However, source code tends to be a living document. I would love some way to markup my code with some kind of EXAMPLE_BEGIN
and EXAMPLE_END
type of tag in the comments and let that define the bounds for the listing.
If this isn't possible with a current package, I'm not opposed to writing one that does this. If that's the case, is there a good starting point? (i.e. Modifying Listing? Modifying Minted? Parsing with a macro?)