API

Copyright (c) 2014, Kim van Wyk All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

class kppe.ConfigManager(path, verbose=False)[source]

Hold config items as suitable types.

class kppe.TagReplace(lines, names={})[source]

Hold a set of lines, and perform tag replacement on them. A tag is defined as anything inside a << >>, which starts with a lower case letter. Tag contents are seperated with ”:”

process()[source]

Loop over each line, replacing all tags as they are encountered

kppe.build_pdf(text, template, name, toc=False)[source]

Build the provided text into a PDF via markdown2pdf, using the supplied full path to the template name is the output filename to use if toc evals as True, a table of contents is generated

Return a tuple of (returned text, return code)

kppe.exit(code=None, verbose=False)[source]

Exit, using optional supplied ERROR_CODES value if given. If ‘verbose’, print additional info

kppe.get_ref_tags(config_file=None, verbose=False)[source]

Determine if the supplied config_file path is valid Exit with an error code otherwise

‘verbose’ governs whether the exit function should print additional info

kppe.latex_label(s)[source]

Return a version of input string suitable for use as a Latex label - Lowercase all characters - Replace ” ”, “#”, “” with “_”

kppe.read_config(config_file=None, verbose=False)[source]

Determine if the supplied config_file path is valid and create a global ConfigHandler object if so. Exit with an error code otherwise

‘verbose’ governs whether the exit function should print additional info

Indices and tables