Skip to main content

springheel.classes module

class springheel.classes.Arrow(relation: str, page: str)

Bases: object

A navigation element to go to another page.

Parameters
relationstr

The relationship between the target page and the current one. Will be first, prev, next, or last.

pagestr

The page number for the target page.

Attributes
longstr

The long link text for this arrow, like “Previous Page - 3”. (Translated into the site language, of course.) Mostly used by assistive technology, to make it easier to tell where a link goes without looking at the rest of the page.

lrelstr

Link relation for this arrow. Either “prev” or “next”, as “first” and “last” are not part of the spec.

pagestr

The page number for the target page.

relationstr

The relationship between the target page and the current one. Will be first, prev, next, or last.

shortstr

Short link text for this arrow. “First”, “Previous”, “Next”, or “Last” in the site language. Appears beneath arrow images.

stringsdict

Various strings used by this arrow. “rel”, corresponding to self.relation; “long” link text (visible to screen readers), and “short” link text (below image).

long
lrel
page
relation
short
strings
class springheel.classes.Chapter(category: str, chap_number: int, chap_title=False)

Bases: object

A collection of related Strip items.

More specific than Comic. Initialized with the chapter number and optionally the chapter title.

Parameters
categorystr

The name of the Comic this chapter belongs to.

chap_numberint

The number of the chapter.

chap_titlestr, optional

The title of the chapter.

See also

Strip

The elements that pages comprises.

Attributes
authorsset

All authors associated with the chapter. Used for making copyright statements in chapter view, etc.

categorystr

The name of the Comic this chapter belongs to.

ch_outfnstr

The output filename for the chapter-view page. Formatted like “{series_slug}_c{padded_chap_number}.html”.

chap_numberint

The number of the chapter.

chap_titlestr, optional

The title of the chapter.

chap_title_escapedstr, optional

HTML-safe chap_title, with entity characters escaped.

pageslist of Strip

All Strips in the chapter.

slugstr

Slug used for the chapter in the archive table of contents.

yearsset

Initial publication years of comics in this chapter.

class springheel.classes.Comic(category: str, publicdomain: bool = False)

Bases: object

A comic series or story.

Initialized with just the name of the comic. The next broadest level after Site.

Parameters
categorystr

The name of the comic.

publicdomainbool, default: False

Whether the comic is public domain or not. Necessary for some copyright-related stuff.

Attributes
aboutstr, optional

A longer description of the comic, used on about pages.

authorstr

The comic’s creator.

authorslist

A list of all authors associated with a comic. Used just in case multiple people worked on different strips of a category.

bannerstr

The comic’s banner that appears on the index page.

headerhstr

The height of the banner in pixels.

headerwstr

The width of the banner in pixels.

categorystr

The name of the comic.

category_escapedstr

HTML-safe category, with entity characters escaped.

category_themestr, optional

Theme used by the comic.

chaptersbool

True if the comic is chaptered, False if not.

chapters_dictslist, optional

Dicts with chapter numbers and titles.

chapters_filestr, optional

If chapters is True, full path to the chapter file.

chapters_listlist, optional

List of Chapters in the comic.

chars_filestr or None

If present, the filename of the character file.

chars_fnstr, optional

The basename of the characters page, if it exists. Will be “characters.html” on single-comic sites and “{category-slug}- characters.html” on multiple-comic sites.

clicensestr

The original license name specified in the conf file.

conf_cdict

Contents of the comic’s config file.

copyright_statementstr

An HTML copyright statement.

descstr

A description of the comic for the index.

emailstr

The comic creator’s email address, for RSS feeds.

fbd_linklist

HTML filename of the first strip by date.

fbp_linklist

HTML filename of the first strip by page number.

first_pageint

The first page of the comic.

headerstr

Filename for the page header of the comic.

headerhstr

The height of the page header in pixels.

headerwstr

The width of the page header in pixels.

known_pageslist

A list of zero-padded page numbers for this category. Used for navigation generation.

known_pages_rawlist

A list of page numbers for this category. These are the raw numbers taken directly from metadata files, so they are strings. Some may not be convertible to integers.

known_pages_reallist

A list of page numbers for this category. These are real numbers – ints, floats, or tuples containing ints and/or floats.

languagestr

ISO 639-1 code (2 letters) for the comic’s language.

last_pageint

The latest page of the comic.

lbd_linklist

HTML filename of the last strip by date.

lbp_linklist

HTML filename of the last strip by page number.

licensestr

The comic’s license.

license_uristr

The license URI specified in the conf file.

modestr

Debug parameter that currently does nothing.

pbdlist

all Strips in the comic, sorted by date.

pbplist

all Strips in the comic, sorted by page number.

publicdomainbool

Whether the comic is public domain or not. Necessary for some copyright-related stuff.

slugstr

category slugified for URLs.

statusstr

Whether the comic is still updating or not.

statussstr

status but wrapped in <strong> tags.

Methods

populate:

Add initial information to a comic category.

about
author
authors
banner
bannerh
bannerw
category
category_escaped
category_theme
chapters
chapters_dicts
chapters_file
chapters_list
chars_file
chars_fn
clicense
conf_c
copyright_statement
desc
email
first_page
header
headerh
headerw
known_pages
known_pages_raw
known_pages_real
language
last_page
license
license_uri
mode
pbd
pbp
populate(site, comics_base)

Add initial information to a comic category.

Parameters
siteSite

The root comic Site.

comics_baselist of Strip

Strips known to Springheel.

publicdomain
slug
status
statuss
class springheel.classes.Config(*file_names: str)

Bases: object

A set of various site preferences.

Parameters
file_namesstr, optional

Filename of the configuration file.

Attributes
aboutbool, optional

Whether or not to generate an “about” page describing each comic and link it in the top navigation.

base_urlstr

The root URL for the site. All page URLs are considered relative to this.

characters_pagestr

Whether or not to generate character pages. If “True”, character file names can be specified in comic config files. If “False”, they will be ignored.

countrystr

The legal territory the site is operated from. Mostly used for copyright waivers.

descriptionstr

A description of the site. Appears in feeds and the like.

diaspora_urlstr

Social link. Diaspora* stream. This requires a full URL.

dictdict

The original dictionary used to create this object. Based on configparser.ConfigParser.

extras_pagestr

If “True”, Springheel will convert input/Extra.json to an extras page. If “False”, it will be ignored.

header_filenamestr

The name of an image file in input/ that will appear at the top of various pages on the site.

image_rename_patternstr

The pattern used for renaming images in output. Available replacement items: {titleslug} (slugified strip title), {author}, {height}, {width}, and {ext}. Defaults to “{comic}_{page}_{titleslug}_{date}.{ext}”.

json_modebool

Whether to look for files ending in “.meta.json” and “.transcript.json” (True) or simply “.meta” and “.transcript” (False).

languagestr

The language the site is in. An ISO 639-1 code (2 letters).

liberapay_handlestr

Social link. Liberapay handle. Applied in the form of https://liberapay.com/{liberapay_handle}.

licensestr

An overall copyright statement for the site. HTML accepted.

mastodon_urlstr

Social link. Mastodon account. This requires a full URL.

navdirectionstr

Either “ltr” or “rtl”. Whether first/previous arrows should point to the left and next/last arrows to the right or vice- versa.

patreon_handlestr

Social link. Patreon handle. Applied in the form of https://www.patreon.com/{patreon_handle}.

pump_urlstr

Social link. Pump microblog. This requires a full URL.

rename_imagesstr

If “True”, comic images are renamed according to image_rename_pattern.

site_authorstr

The person or people considered the owner(s) of the site.

site_author_emailstr

The email address of the owner. Used for RSS feeds because they require it for some reason.

site_stylestr

The name of a theme located in themes/ that will be loaded as the overall site style.

site_titlestr

The title of the site as a whole.

site_typestr

Either “single” or “multi”. If single, only one Comic is on the site. If multi, the site is a hub for multiple works.

social_iconsstr

If “True”, social media links whose configs aren’t set to “False” will be displayed on the site. If “False”, they will not be generated.

store_pagestr

A URL to link to in the top menu as a store associated with the comic, such as a merchandise outlet.

tumblr_handlestr

Social link. Tumblr blog. Applied in the form of http://{tumblr_handle}.tumblr.com.

twitter_handlestr

Social link. A Twitter handle. Applied in the form of http://twitter.com/{twitter_handle}.

zero_paddingstr

Either an integer indicating the number of digits page and chapter numbers should be padded to (defaulting to 4) or False to disable zero-padding.

about
base_url
characters_page
country
description
diaspora_url
dict
extras_page
header_filename
image_rename_pattern
json_mode
language
liberapay_handle
license
mastodon_url
navdirection
patreon_handle
pump_url
rename_images
site_author
site_author_email
site_style
site_title
site_type
social_icons
store_page
tumblr_handle
twitter_handle
zero_padding
class springheel.classes.EXpage

Bases: object

An extras page.

Attributes
headingslist of str

The page’s navigational headings.

contentstr

The generated HTML for the extras page.

content
headings
class springheel.classes.Site

Bases: object

A Springheel comic site.

The top level of a Springheel instance. It contains all Comic series and site-related metadata.

Attributes
authorstr

A single-string version of authors, mostly for compatibility.

authorslist of str

A list of strings describing authors whose work appears on the site.

c_pathstr

The current/root directory for this site.

comicslist of Comic

A list of Comic series/categories.

configConfig

Sitewide configuration settings.

copyright_statementstr

A copyright statement for the site.

i_pathstr

The path to the input directory for the site. Will generally be the equivalent of ./input/.

imagesdict

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

jsonpointsdict

Information about the site in JSON format.

licensestr

The license of the overall site.

o_pathstr

The output path for the site. Will generally be the equivalent of ./output/.

processed_authorsdict of str

Mapping between items from raw_authors and their processed equivalents.

raw_authorsset of str

Like authors, but the set of unique author strings that appear in comic metadata (i.e. without processing for multiple authors, etc.).

singlebool

Whether the site is single-comic or not.

sitemaplist of dict

Dicts of HTML filenames and last-modified times for all pages.

author
authors
c_path
comics
config
copyright_statement
i_path
images
jsonpoints
license
o_path
processed_authors
raw_authors
single
sitemap
class springheel.classes.Strip(imagef: str, metaf: str, transf: str)

Bases: object

An individual comic page.

Part of a Comic and optionally a Chapter as well.

Parameters
imagefstr

Filename of the strip image.

metafstr

Filename of the strip’s metadata file.

transfstr

Filename of the strip’s transcript file.

Attributes
alt_textstr, optional

Extra text that displays below the strip. Despite the name, is not really used as alt text. A more accessible version of the title text some comics have.

archive_linkstr

The text that will link to the strip on the Archives page.

authorstr

The strip’s credited author.

author_emailstr

The strip’s author’s email address (for RSS feeds).

authorslist

All individuals involved with a strip. If multiple people are listed in the metadata file, separated by &, /, or +, they’re added separately to this list.

categorystr

The strip’s category.

chapterint/bool

The chapter number if a strip is part of a chapter. False if it is not.

clicensestr

The name of the strip’s license.

commentarystr

The strip’s creator commentary.

conf_cdict

Contents of the strip’s config file.

copyright_statementstr

The copyright information used in the footer of the page.

datedatetime.datetime

The upload date of the strip.

date_fmtstr

date formatted according to either ISO 8601 or a locale that is basically that, like Japanese. Used on archive pages.

date_sstr

date formatted according to ISO 8601 (YYYY-MM-dd).

figcaptionstr, optional

alt_text wrapped in <figcaption> tags.

file_namestr

The output filename for the strip image (without “pages/”).

h1_titlestr

The title used as a top-level heading for the strip.

header_titlestr

The string used as an HTML <title> element.

heightstr

The height of the strip image in pixels.

html_filenamestr

The text used as the output filename (ending in “.html”).

imagefstr

Input filename of the strip image.

imgstr

The output path of the strip image.

langstr

ISO 639-1 code (2 letters) for the strip’s language.

licensestr

The copyright status of the strip.

metadatadict

The strip’s metadata.

metafstr

Input filename of the strip’s metadata file.

modestr

Debug parameter that currently does nothing.

new_metastr

The output filename for the metadata file.

new_transcrstr

The output filename for the transcript file.

pagestr

The strip’s page number (directly from the meta file).

page_paddedstr

The strip’s page number formatted with zero-padding.

page_real_numint, float, or tuple

The strip’s page number converted to a real number (or a tuple containing real numbers).

page_urlstr

The strip’s ultimate URL/permalink.

permalinkstr

HTML permalink to the strip.

piecesstr

HTML <img> element(s) for this strip.

raw_commentslist of str

The strip’s commentary without any HTML formatting, etc.

series_slugstr

URL-safe slug for the strip’s category.

sha256str

SHA-256 checksum of the strip image. Included for API purposes.

slugstr

The HTML filename without the extension, for use as a slug.

slugslist

Title and series slugs.

sourcestr, optional

If available, the URL of an original work on which this strip is based. For translations, freely-licensed comics, etc.

statlinestr

The “posted by x on y date” type line that appears at the bottom of the commentary box. HTML paragraph.

stat_nopermastr

The statline without a “permalink”, for chapter pages.

tagslist, optional

A list of Tag items used by the strip.

tbstr

The formatted HTML transcript block, separated by newlines.

titlestr

The title of the strip.

title_slugstr

URL-safe slug for the strip’s title.

tlinestr

HTML hyperlinked list of tags attached to the strip.

transcript_blocklist

The <div> elements used to make the transcript block.

transcript_cstr

The HTML contents of the transcript (no heading, etc.).

transfstr

Input filename of the strip’s transcript file.

widthstr

The width of the strip image in pixels.

yearint

The year in which the strip was published.

Methods

get_matching:

Find the Comic this Strip belongs to.

populate:

Add initial information to a comic Strip.

populate_authors:

Add author information for the Strip.

alt_text
author
author_email
authors
category
chapter
clicense
commentary
conf_c
copyright_statement
date
date_fmt
date_s
figcaption
file_name
get_matching(ccomics)

Find the Comic this Strip belongs to.

Parameters
ccomicslist

A list of Comic objects.

Returns
Comic

The matching Comic.

h1_title
header_title
height
html_filename
imagef
img
lang
license
metadata
metaf
mode
new_meta
new_transcr
page
page_padded
page_real_num
page_url
pieces
populate(meta: dict, commentary: str, raw_comments: list, configs: list, site: springheel.classes.Site)None

Add initial information to a comic Strip.

Parameters
metadict

Metadata about the strip.

commentarystr

The comic’s commentary.

raw_commentslist of str

Raw commentary lines from the comic’s metadata file.

configslist of dict

Configuration files known to Springheel.

siteSite

The root site

populate_authors(site: springheel.classes.Site)

Add author information for the Strip.

Parameters
siteSite

The root site, which usually has author data.

raw_comments
series_slug
sha256
slug
slugs
source
stat_noperma
statline
tags
tb
title
title_slug
tline
transcript_block
transcript_c
transf
width
year
class springheel.classes.Tag(name: str)

Bases: object

A tag that classifies comic strips.

An optional element that can be applied to Strip items. The most specific item available on a Springheel site.

Parameters
namestr

The name of the tag.

Attributes
escapedstr

An HTML-safe version of name (no &, <, or >).

linkstr

HTML hyperlink to the tag index URL.

namestr

The name of the tag.

rurlstr

HTML filename for the tag index.

slugstr

name slugified for URLs.

stripslist

Strips to which the tag applies.

Methods

gen_links:

Generate links for a Tag.

escaped

Generate links for a Tag.

Parameters
translated_stringsdict

The translation file contents for this site.

name
rurl
slug
strips