synthale package¶
Submodules¶
synthale.cli module¶
Contains the commands for the CLI interface.
synthale.convert module¶
Contains functions used to convert units.
Input units for volumes is liters. Input units for mass is kilograms. These units are the defaults used in the BeerXML format, and as a result, in pybeerxml.
Functions in this module accept a format_spec parameter. The format_spec parameter is a string conforming to the Python “Format Specification Mini Language”.
See format_spec documentation.
-
synthale.convert.
celsius
(celsius, format_spec='')¶ Return a string with the unit appended.
-
synthale.convert.
fahrenheit
(celsius, format_spec='')¶ Convert celsius to fahrenheit, return a string with unit appended.
-
synthale.convert.
gallons
(liters, format_spec='')¶ Convert liters to gallons and return a string with the unit appended.
-
synthale.convert.
grams
(kilograms, format_spec='')¶ Convert kilograms to grams, return a string with the unit appended.
-
synthale.convert.
kilograms
(kilograms, format_spec='')¶ Return a string with the unit appended.
-
synthale.convert.
liters
(liters, format_spec='')¶ Return a string with the unit appended.
-
synthale.convert.
ounces
(kilograms, format_spec='')¶ Convert kilograms to ounces, return a string with the unit appended.
-
synthale.convert.
pounds
(kilograms, format_spec='')¶ Convert kilograms to pounds, return a string with the unit appended.
synthale.markdown module¶
This module contains functions to generate markdown elements.
-
synthale.markdown.
emphasis
(text)¶ Wrap text with asterisks.
-
synthale.markdown.
setext_heading
(text, level)¶ Return an setext heading.
text is the text to include in the heading. Leading and trailing whitespace is trimmed from text. If level is the number 1, a first level (h1) heading is returned. If level is the number 2 (or anything else), a second level (h2) heading is returned.
See https://github.github.com/gfm/#setext-heading for more information.
-
synthale.markdown.
strong
(text)¶ Wrap text with double asterisks.
-
synthale.markdown.
table
(headers, rows)¶ Generate a table.
headers is a list/tuple of header cells. rows is a list of lists containing each cell. If any row has more cells than there are headers, the extra cells are silently dropped.
See https://github.github.com/gfm/#tables-extension- for syntax of a GFM table.
synthale.recipes module¶
Use this module to parse BeerXML files.
-
class
synthale.recipes.
MarkdownRecipe
(recipe, vol_unit='gallons', hop_unit='ounces', fermentable_unit='pounds', temp_unit='fahrenheit')¶ Bases:
object
A recipe in markdown form.
-
details
¶ Return markdown for the recipe’s details.
-
fermentables
¶ Return markdown to represent the recipe’s fermentables.
-
filename
¶ Return the filename for the recipe.
Converts the recipe name to lowercase and replaces all non-word characters with an underscore. Trailing underscores are removed. .md is appended to the name.
-
hops
¶ Return markdown to represent the recipe’s hops.
-
markdown
¶ Return generated markdown for the recipe.
-
mash
¶ Return the markdown to represent the recipe’s mash steps.
-
miscs
¶ Return the markdown to represent the recipe’s other ingredients.
-
name
¶ Return markdown for the recipe’s name.
-
style
¶ Return markdown for the recipe’s style.
-
yeast
¶ Return markdown to represent the recipe’s yeast.
-
-
synthale.recipes.
load_all_files
(path, units={})¶ Parse all XML files in a directory.
path is a path to a directory with .xml files. units is a dictionary defining the units used. units will be unpacked and used during the creation of a MarkdownRecipe object.
Returns a list of MarkdownRecipe objects.
-
synthale.recipes.
load_file
(path, units={})¶ Parse BeerXML file.
path is the path to a BeerXML file. units is a dictionary defining the units used. units will be unpacked and used during the creation of a MarkdownRecipe object.
Return a list of MarkdownRecipe objects. If an exception is raised during parsing, the message is printed to stderr and an empty list is returned.
-
synthale.recipes.
write_recipes
(recipes, output_path)¶ Write recipes to output_path.
recipes is a list of MarkdownRecipe objects. output_path is a directory to write the recipes to.
Module contents¶
Synthale package.