Skip to content

Either don't mutate Manifest ID and href or simplify the mutation. #6

@jcmsj

Description

@jcmsj

Background

The href and sometimes the ID directly reflects a filepath. One issue with this is that filenames aren't always URL safe. Since this is being used in the web, it should be web-safe. However, I consider the current implementation being excessively complex and overstepping some bounds (the unwanted behavior).

Current solution to mitigate the above.

  1. During parsing, the element IDs with periods are replaced with underscore.
  2. When getting content, extensions and sub paths are removed as well doing step 1 again.

Example issues

  1. In the sister project, I am using the id as dynamic routes. One issue with this is that setting the url to have a file extension would result in the browser/server attempting to find that resource (E.g. An id "chapter1.html" will be fetched). Even though that it is url safe
  2. May result into unwanted behavior such as Epubs may contain all chapter data inside a body.xhtml #2, Epub 2.0's ncx filename/manifest ID may not exactly be "ncx" #5.

New solution

Simply URL-encode element IDs, HREFs, and anchor tags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions