Functions | |
def | extract |
Extract Matching Lines. More... | |
def | convert |
Convert Lines to Markdown. More... | |
def | excerpt |
Extract and Convert Matching Lines. More... | |
def | modify_path |
Modify a Path. More... | |
def excerpts.main.convert | ( | lines, | |
comment_character, | |||
magic_character, | |||
allow_pep8 = True |
|||
) |
Convert Lines to Markdown.
Remove whitespace and magic characters from lines and output valid markdown.
lines | The lines to be converted. |
comment_character | The comment character of the language. |
magic_character | The magic character marking lines as excerpts. |
allow_pep8 | Allow for a leading comment character and space to confrom to PEP 8 block comments. |
def excerpts.main.excerpt | ( | lines, | |
comment_character, | |||
magic_character, | |||
allow_pep8 = True |
|||
) |
Extract and Convert Matching Lines.
Just a wrapper to extract() and convert().
lines | A list containing the code lines. |
comment_character | The comment character of the language. |
magic_character | The magic character marking lines as excerpts. |
allow_pep8 | Allow for a leading comment character and space to confrom to PEP 8 block comments. |
def excerpts.main.extract | ( | lines, | |
comment_character, | |||
magic_character, | |||
allow_pep8 = True |
|||
) |
Extract Matching Lines.
Extract all itmes starting with a combination of comment_character and magic_character from a list.
lines | A list containing the code lines. |
comment_character | The comment character of the language. |
magic_character | The magic character marking lines as excerpts. |
allow_pep8 | Allow for a leading comment character and space to confrom to PEP 8 block comments. |
def excerpts.main.modify_path | ( | file_name, | |
postfix = "" , |
|||
prefix = "" , |
|||
output_path = "" , |
|||
extension = None |
|||
) |
Modify a Path.
Add a postfix and a prefix to the basename of a path and change it's extension.
file_name | The file path to be modified. |
postfix | Set the output file postfix. |
prefix | Set the output file prefix. |
extension | Set a new file extension. |
output_path | Set a new file name or an output directory. If the path given is not an existing directory, it is assumed to be a file path and all other arguments are discarded. |