User:ArielGlenn/Sandbox

Figuring out some standard formatting for code examples for dumps (and other) knowledge sharing sessions.

Here's a first sample...

This is an example of how not to exit from a python script.

You can see that the author has carefully kept to python style guidelines as far as use of indentation and blank lines, even going so far as to avoid extraneous code in __main__ to avoid pylint errors.

Nonetheless, blah blah blah.

This trick avoids pylint whines about how the constant you were going to define in __main__ doesn't have an approved uppercase name etc. Plus it's polite behavior to have all of your functionality in methods and invoke the ones you want out of __main__ if the script is executed as standalone.

Turn this into three templates:
 * one for everything through the syntaxighlighting tag, with params: number of brs to write if any, link target if you have one, language, highlight if any, start if needed
 * second one to close all the tags
 * third would be for the commentary boxes, taking only the content