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 two templates:
 * one for everything through the syntaxhighlight tag, with params: number of brs to write if any, link target if you have one, language, highlight if any, start if needed, if syntax is omitted we just use plain text; also allow background color (only good for plain text boxes)
 * second one to close all the tags

If content wraps in the commentary box and it's not capped to a max width, the box pushes a little into the left column. Added a max width which I prefer anyways.