Whats a snippet?¶
Within a configuration, there are times when some bit of text needs to be changed.
The only requirement is the file format should recognize pound symbol #
as a comment.
A snippet without an snippet code (id)
before snippet
# @@@ editable
code block
# @@@ end
after snippet
A snippet with an snippet code (id)
before snippet
# @@@ i_am_a_snippet_co
code block
# @@@ end
after snippet
What batteries are included?¶
None
This is a base package. Other authors are encouraged to:
not reinvent the wheel
avoid packages with snippet implementations, when only just want the base class, Snip
Packages using drain-swamp-snippet-pypi¶
Acknowledgement¶
The technique and initial implementation is from Ned Batchelder
Ned Batchelder is also the author of cog which creates content by embedding both Python code and output in the original file.
Check out introduction to cog
See also
[original code] supports replacing one snippet per file, not idiot proof, nor unittested.