excerpts: excerpts.main Namespace Reference

excerpts

- Main Page
- Packages
- Files

- Packages
- Package Functions

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

  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.

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

  lines | a list containing the code lines.
  comment_character | The comment character of the files 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.

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

  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.

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_name | The file name 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.

Returns
  A string containing the modified path.