excerpts
 All Namespaces Files Functions
Functions
excerpts.main Namespace Reference

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...
 

Function Documentation

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.

Parameters
linesThe lines to be converted.
comment_characterThe comment character of the language.
magic_characterThe magic character marking lines as excerpts.
allow_pep8Allow for a leading comment character and space to confrom to PEP 8 block comments.
Returns
A list of strings containing the lines converted.

Here is the call graph for this function:

def excerpts.main.excerpt (   lines,
  comment_character,
  magic_character,
  allow_pep8 = True 
)

Extract and Convert Matching Lines.

Just a wrapper to extract() and convert().

Parameters
linesa list containing the code lines.
comment_characterThe comment character of the files language.
magic_characterThe magic character marking lines as excerpts.
allow_pep8Allow for a leading comment character and space to confrom to PEP 8 block comments.
Returns
A list of strings containing the lines extracted and converted.

Here is the call graph for this function:

def excerpts.main.extract (   lines,
  comment_character,
  magic_character,
  allow_pep8 = True 
)

Extract Matching Lines.

Extract all lines starting with a combination of comment_character and magic_character from a list.

Parameters
linesa list containing the code lines.
comment_characterThe comment character of the language.
magic_characterThe magic character marking lines as excerpts.
allow_pep8Allow for a leading comment character and space to confrom to PEP 8 block comments.
Returns
A list of strings containing the lines extracted.

Here is the call graph for this function:

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.

Parameters
file_nameThe file name to be modified.
postfixSet the output file postfix.
prefixSet the output file prefix.
extensionSet a new file extension.
output_pathSet a new file name or an output directory.
Returns
A string containing the modified path.