springheel package¶
Submodules¶
- springheel.acopy module
- springheel.addimg module
- springheel.classes module
- springheel.command_line module
- springheel.copystuff module
- springheel.genabout module
- springheel.genchars module
- springheel.genchbook module
- springheel.generatearchive module
- springheel.generatenav module
- springheel.genextra module
- springheel.genjsonfeed module
- springheel.genmultilang module
- springheel.genmultipleindex module
- springheel.genrss module
- springheel.genstatline module
- springheel.gentopnav module
- springheel.gentrans module
- springheel.gettemplatenames module
- springheel.metatag module
- springheel.parseconf module
- springheel.parsemeta module
- springheel.parsetranscript module
- springheel.renameimgs module
- springheel.slugurl module
- springheel.socialbuttons module
- springheel.splitseps module
- springheel.springheelinit module
- springheel.tl module
- springheel.webtoon module
- springheel.wraptag module
Module contents¶
Springheel – a static site generator for webcomics.
-
async
springheel.
build
()¶ Generate a Springheel site.
-
springheel.
checkExtremes
(sorted_ints: List[int]) → Tuple[int, int]¶ Find the highest and lowest values in a sorted list of integers.
- Parameters
- sorted_intslist of int
A sorted list of integers.
- Returns
- highestint
The highest value in the list.
- lowestint
The lowest value in the list.
Notes
Used instead of min(l), max(l) because e.g. page number lists may contain various different types. This simply returns the first and last values in a list that has already been sorted, under the assumption that what I’ve already done to sort the list is enough.
-
springheel.
fracPage
(page: float, zero_padding: Union[int, bool]) → str¶ Pad the whole part of a decimal page number with zeroes.
- Parameters
- pagefloat
A fractional page number (e.g. 3.5).
- zero_paddingint or False
The desired amount of zero padding according to site settings.
- Returns
- str
The padded number.
-
springheel.
getChapters
(chapter_file: str) → List[dict]¶ Get numbers and titles from a chapter file.
- Parameters
- chapter_filestr
The path to the chapter file to read.
- Returns
- list of dict
The chapter data extracted from the file. Comprises dicts with “num” for the chapter number (an int), and optionally “title”: chapter title (a str).
-
springheel.
getComics
(i_path: str, m_ext: str, t_ext: str) → Tuple[List[springheel.classes.Strip], dict]¶ Find comic strips in the input folder.
- Parameters
- i_pathstr
The path to the input directory. Should be “./input”.
- m_extstr
File extension for metadata files. Will be either “.meta” or “.meta.json”.
- t_extstr
File extension for transcript files. Will be either “.transcript” or “.transcript.json”.
- Returns
- comicslist of springheel.Strip
All comics detected in the current mode.
- image_dimensionsdict
A dictionary mapping image filenames to (width, height) in pixels.
-
springheel.
getDimensions
(img_path: str) → Tuple[str, str]¶ Get the pixel dimensions of an image file.
- Parameters
- img_pathstr
The full path to the image.
- Returns
- widthstr
The width of the image.
- heightstr
The height of the image.
-
springheel.
getTags
(meta: dict, all_tags: List[springheel.classes.Tag], translated_strings: dict) → Tuple[str, List[springheel.classes.Tag], List[springheel.classes.Tag]]¶ Get and process a strip’s tags.
- Parameters
- metadict
The strips metadata.
- all_tagslist of Tag
The “list of all known tags” to which tags should be added.
- translated_stringsdict
The translation file contents for this site.
- Returns
- taglinestr
HTML links to the index pages of the strip’s tags. Separated by commas.
- this_strips_tagslist of Tag
The Tags used by this strip.
- all_tagslist of Tag
The updated list of all known tags.
Notes
Retrieve a strip’s used tags, add new ones to the list of all known tags, and create a line that indicates the strip’s tags with hyperlinks to those tags’ indices.
-
async
springheel.
init
()¶ Initialize a Springheel project.
-
springheel.
makeFilename
(series_slug: str, page: str) → str¶ Combine a series slug and page number into an HTML filename.
- Parameters
- series_slugstr
The series slug to use.
- pagestr
The page number. Expected to be zero-padded, etc., already.
- Returns
- str
The HTML filename.
-
springheel.
mixNum
(num: List[str]) → Tuple[int, str, str]¶ Generate a sort key to use for lists of page numbers.
- Parameters
- numlist of str
The page number to use.
- Returns
- tuple of 0, str, empty str
The sort key.
-
springheel.
padNum
(page: str, zero_padding: Union[int, bool]) → Tuple[Union[int, float, tuple], str]¶ Pad page number(s) with zeroes, as desired.
- Parameters
- pagestr
The page number or numbers to pad. Will still work even with page ranges or fractional pages.
- zero_paddingint or False
Whether to pad the page number with zeroes, and if so, by how much.
- Returns
- page_real_numint, float, or tuple
The “real” page number, in the sense that you can do math with it. May be an integer, a float, or a tuple containing either.
- page_paddedstr
The page number(s) padded with zeroes to the desired length.
- Raises
- UnboundLocalError :
If the page number is not convertible to any usable format.
-
springheel.
realMixNum
(num: Union[int, float, tuple]) → Tuple[int, Union[int, float], str]¶ Generate a sort key to use for lists of int/float page numbers.
- Parameters
- numint, float, or tuple
The page number(s) to use.
- Returns
- tuple of int, int or float, str
The sort key, comprising 0, the lowest value present in the num parameter (which will be simply the value itself if it is a float or int), and an empty string.
-
springheel.
retainDimensions
(img_fn: str, i_path: str, images: dict) → dict¶ Save image dimensions so they don’t need to be recalculated.
- Parameters
- img_fnstr
The image filename to check.
- i_pathstr
The path to the input directory.
- imagesdict
A dictionary mapping image filenames to (width, height) in pixels.
- Returns
- dict
The image mapping dictionary, updated as needed.
-
springheel.
strBool
(str_to_check: str) → bool¶ Convert a string “True”/”False” to boolean without ast.
- Parameters
- str_to_checkstr
The string to check. Expected to be either “True” or “False”.
- Returns
- bool
Whether the string is not “False”.
-
springheel.
version
()¶ Print version information.