Skip to main content

springheel.genchars module

Generate character pages.

springheel.genchars.genCharsPage(chars_list: List[dict], images: dict)str

Create a characters page from a list of character elements.

Parameters
chars_listlist of dict

A list of character file elements.

imagesdict

A dictionary mapping image filenames to (width, height) in pixels.

Returns
str

The contents of the generated HTML characters page.

springheel.genchars.loadChars(fp: str, json_mode: bool)List[dict]

Try to load a characters file.

Parameters
fpstr

The path to the file to open.

json_modebool

Whether to load the file as JSON (True) or plain text (False).

Returns
list of dict

A list of dictionaries (parsed character file data).

springheel.genchars.parseChars(charfile: str)List[dict]

Format the contents of a character file.

Parameters
charfilestr

The contents of a character file.

Returns
list of dict

A list of character file elements formatted as dictionaries.

springheel.genchars.saveCharsPage(ccomics: List[springheel.classes.Comic], site: springheel.classes.Site, chars_t: str, translated_strings: dict, site_img_url: str, year: str, top_site_nav: str, falses: set, link_rel: str, icons: str, sep: str)List[asyncio.coroutines.coroutine]

Create character pages for every category that should have one.

Parameters
ccomicslist of Comic

A list of Comic series/categories to check.

siteSite

The Site to make pages for.

chars_tstr

The path to the characters page template.

translated_stringsdict

The translation file contents for this site.

site_img_urlstr

The full URL of an image that represents this site. Used for meta tags.

yearstr

The year(s) to put in the copyright footer.

top_site_navstr

The top navigation.

falsesset

A variety of different “negative” values, as a character image string might be False, None, Null, Disable, etc.

link_relstr

Link rel values to put into page headers.

iconsstr

Social icons to use in the footer.

sepstr

A line separator to use in output.

Returns
list of coroutine

A list of asynchronous file-copying tasks.