springheel.generatenav module¶
Generate comic navigation.
-
springheel.generatenav.
navGen
(navdirection: str, page_num: str, first_page: str, last_page: str, first: bool, final: bool, series_slug: str, site_style: str, translated_strings: dict, all_pages: List[str], known_pages_real: List[Union[int, float, tuple]], current_ind: int, images: dict, chapter_mode: Optional[bool] = False) → Tuple[str, str]¶ Generate navigation boxes and link rel navigation.
- Parameters
- navdirectionstr
Site reading direction. One of ltr or rtl.
- page_numstr
The page number represented as an integer. Zero-padded.
- first_pagestr
The number of the first page. Likely be 0 or 1. Zero-padded.
- last_pagestr
The number of the latest/final page. Zero-padded.
- firstbool
Whether or not the current page is the first one.
- finalbool
Whether or not the current page is the final one.
- series_slugstr
URL-safe slug for the comic category.
- site_stylestr
The theme whose arrows will be used.
- translated_stringsdict
The translation file contents for this site.
- all_pageslist of str
List of all known page numbers for the current category. Used to validate navigation and make sure there will not be missing pages.
- known_pages_reallist of int, float, or tuple
A list of raw page numbers. Used for alt text so that it works as intended with assistive tech.
- current_indint
The current strip’s index in all_pages.
- chapter_modebool, optional
If True, creates chapter navigation instead of page navigation. Defaults to False.
- imagesdict
A dictionary mapping image filenames to (width, height) in pixels. Used to set the size of arrow images.
- Returns
- navstr
The generated navigation box.
- linkrelsstr
The generated link rel information.
-
springheel.generatenav.
processTup
(page: Union[int, float, tuple], range_separator: str) → Union[str, int, float]¶ Convert multiple page numbers to singles.
Check if page numbers are a usable type, and convert them to such if they are not.
- Parameters
- pageint, float, or tuple
The page number to process.
- range_separatorstr
The string (a single character) to use for separating ranges in the current language.
- Returns
- str, int, or float
If the input is a tuple (i.e. a range of page numbers), return its contents joined by the range separator. Otherwise, the original page number (an int or float).