default
ReSpec to EPUB
The top level entry in the package: convert a single Respec file, or a collection thereof, into an EPUB document.
Convenience class, to export the internal RespecToEPUB class for the package as a whole.
(This is only useful if, for some reasons, the conversion is done starting with a DOM tree, using create_epub_from_dom. In general, convert
should be used).
lib/common.ts
Global constants used at various places.
Acceptable endings for document URL-s. We try to avoid cases when the relative URL calculations go wrong
Config options, to be used as part of the arguments in [[Options]] to overwrite the configuration options of ReSpec.
CORS headers to be added to the server response
Entity/code pairs: the XHTML conversion is supposed to remove the XML entities (if used) to their code alternatives.
Environmental variable name for the location of external copies of some css and image files
Flag to decide whether the code runs in a browser, in Deno, or in node.js.
Generic 'fixup' script (used for warnings for rescinded or obsolete versions).
Invalid host names (essentially "localhost" and friends); unless explicitly set in the environment, these are considered to be unsafe. This is important for server deployment: servers should never accept these host names
Default port number for the server locally.
Set to the default HTTP port number; the environment variable PORT
may,
however, overwrite this for a server.
Local (relative) URL for styles and logos
Various media types used in the code.
Base URL for the W3C files (like base.css
, logos in SVG format) modified for EPUB.
Cut-off date for the publication process change
Process version being used
URL of the spec generator service, used if the source has to be transformed via respec first.
Valid Spec Status values
These media types refer to textual content, no reason to bother about streaming when fetching them...
Base URL for the official W3C css files (only the non-SVG ones are used directly).
Extra CSS file for EPUB content; mainly used to adapt and, possibly, to compensate the effects of the main CSS file. The features are
Base URL for the official W3C logos (only the non-SVG ones are used directly).
Generic ICON directory on the W3C site
Document types that are supposed to be WCAG A level due to the W3C publication check.
lib/convert.ts
Main entry points
Interface of the "Global" data, to be used by various utilities
Interface for the resources that, eventually, should be added to the EPUB file
lib/cover.ts
Cover page
The SVG template to be used for the cover image.
Create the cover image: it is an SVG file with title, the type of the document, date, and a W3C Logo.
lib/css2016.ts
CSS files (for the 2016 version of the Process)
Extract/add the right CSS references and gathers all resources (logo files, watermark image, etc.) to be added to the overall set of resources in the final book. Note that the HTML DOM of the main file is modified on the fly:
lib/css2021.ts
CSS files (for the 2021 version of the Process)
Extract/add the right CSS references and gathers all resources (logo files, watermark image, etc.) to be added to the overall set of resources in the final book. Note that the HTML DOM of the main file is modified on the fly:
lib/defontSvg.ts
Handle a nasty bug in some SVG files
Replace all occurrences of the <font>
element in the SVG file by a <span>
.
lib/fetch.ts
Fetch
Fetch an HTML file via [[fetch_resource]] and parse the result into a DOM instance.
Fetch an JSON file via [[fetch_resource]] and parse the result into an object.
Fetch a resource.
Fetch the media type of the resource.
lib/home.ts
Service home page
lib/ocf.ts
OCF Package
The class representing the EPUB 3.4 OCF package.
lib/opf.ts
The OPF package
The "link" element content, as define in the spec. @rel
is optional, because it is also used for OPF collections, and
@rel
is indeed optional in that context.
lib/overview.ts
Generate the Overview.xhtml
entry
Generate the resource entry for the Overview.xhtml
item into the package; that includes setting the various manifest item
properties (see manifest item properties).
lib/title.ts
Title page
Create the cover page: it is an XHTML file with title, editors, copyright information, and a disclaimer whereby the EPUB version of the document is not authoritative.
lib/utils.ts
Some common utilities
Convert an ISO formatted date to a more readable format.
Remove any XML/HTML tags from the input; <br/>
tags are replaced by space and all other tags are removed.
Filter XML entities in an xhtml code, and turn them into their equivalent hexadecimal Unicode point
“Slice” a long text into lines separated by the (HTML) <br/>
tag. Used as a rudimentary tool
when adding the title lines to an SVG content.
Convert an HTML5 content (in text or as a DOM) into XHTML5.