From ae1c2724e9f730b01ebdecfb8491edf9ea0f9334 Mon Sep 17 00:00:00 2001 From: Matt Garrish Date: Thu, 28 Jul 2022 10:59:33 -0300 Subject: [PATCH 01/11] preliminary implementation of an algorithm --- epub33/rs/index.html | 246 ++++++++++++++++++++++++------------------- 1 file changed, 139 insertions(+), 107 deletions(-) diff --git a/epub33/rs/index.html b/epub33/rs/index.html index c5ae41a2b..21ff38f71 100644 --- a/epub33/rs/index.html +++ b/epub33/rs/index.html @@ -643,8 +643,8 @@

OCF ZIP container

  • -

    Obtain the values of propertyPrefix and propertyName as follows:

    +

    Obtain the values of propertyPrefix and propertyReference as follows:

    1. -

      If value does not contain a colon (U+003A), set propertyName to - value and continue processing at the next step.

      +

      If value does not contain a colon (U+003A), set propertyReference + to value.

      Explanation

      If a property value does not have a colon, it does not have a prefix. In - this case, the value is drawn from the default vocabulary as described in the next step of the algorithm.

      + this case, the value is drawn from the default vocabulary as described in the next + step of the algorithm.

    2. @@ -2147,38 +2150,26 @@

      Processing property values

      set.

    3. -
    4. -

      Otherwise, if value does not contain a slash (U+002F) and value - ends with a colon or has more than one colon, the value is invalid. Return null.

      -
      - Explanation -

      If a property does not contain any slashes, then the colon represents - the prefix delimiter. It is not valid for the value to end with a colon, as that - would indicate there is only a prefix and no name.

      -

      Likewise, there cannot be more than one colon, as the name must be a - [=path-relative-scheme-less-URL string=] (i.e., any colons must be after the first - [=URL-path-segment string=]).

      -

      For example, the following is a valid property value as the second colon - follows a slash: foo:bar/ba:z. This example shows an invalid value, as - the second colon could represent a scheme: foo:bar:baz/qux.

      -
      -
    5. Otherwise, split value on the first colon and set propertyPrefix to - the string before the colon and set propertyName to the string after the + the string before the colon and set propertyReference to the string after the colon.

    -

    If propertyName contains a colon, and that colon occurs before a slash character, the - value is invalid. Return null.

    +

    If propertyReference is an empty string or is not a valid + [=path-relative-scheme-less-URL string=], as required by the property data type definition + [[epub-33]], the value is invalid. Return null.

    Explanation -

    If a propertyName has a colon at this stage, then there were multiple colons in - the original value. The first delimited the prefix. Any subsequent ones left in the name - must occur after a slash, otherwise the name is not a valid [=path-relative-scheme-less-URL - string=]. (Refer to the explanation for substep 3 - for additional explanation about valid path-relative-scheme-less-URL strings.)

    +

    If the reference is an empty string, the colon separating the prefix from the reference must + have been at the end of value. A prefix without a reference is invalid.

    +

    The path-relative-scheme-less-URL string definition has a number of restrictions that apply + to the reference whether it has a prefix or not.

    +

    For example, the reference must not begin with a [=URL-scheme string=] followed by a colon. + This restriction means that the following is not a valid property value as the + second colon could represent a scheme: foo:bar:baz/qux.

    +

    There are also restrictions on what characters must be percent encoded.

  • @@ -2251,7 +2242,7 @@

    Processing property values

  • Set expandedURL to the concatenated values of baseURL and - propertyName. Do not add a separator when concatenating the values.
  • + propertyReference. Do not add a separator when concatenating the values.
  • If expandedURL is not a [=valid URL string=], the value is invalid. Return null.

    From 261af245bac486b608752ae4191946d2e82bac6e Mon Sep 17 00:00:00 2001 From: Matt Garrish Date: Fri, 29 Jul 2022 16:40:06 -0300 Subject: [PATCH 07/11] allow prefix-only values --- epub33/rs/index.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/epub33/rs/index.html b/epub33/rs/index.html index 167158451..3e920d07d 100644 --- a/epub33/rs/index.html +++ b/epub33/rs/index.html @@ -2156,14 +2156,12 @@

    Processing property values

    colon.

  • -

    If propertyReference is an empty string or is not a valid - [=path-relative-scheme-less-URL string=], as required by the property data type definition - [[epub-33]], the value is invalid. Return null.

    +

    If propertyReference is not a valid [=path-relative-scheme-less-URL string=], as + required by the property data type + definition [[epub-33]], the value is invalid. Return null.

    Explanation -

    If the reference is an empty string, the colon separating the prefix from the reference must - have been at the end of value. A prefix without a reference is invalid.

    The path-relative-scheme-less-URL string definition has a number of restrictions that apply to the reference whether it has a prefix or not.

    For example, the reference must not begin with a [=URL-scheme string=] followed by a colon. From 7b07d2b72d8a316299d6cb10b5c773328dfd56dd Mon Sep 17 00:00:00 2001 From: Matt Garrish Date: Fri, 29 Jul 2022 16:58:16 -0300 Subject: [PATCH 08/11] flag scheme attribute values without a prefix as invalid --- epub33/rs/index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/epub33/rs/index.html b/epub33/rs/index.html index 3e920d07d..bde5c26ba 100644 --- a/epub33/rs/index.html +++ b/epub33/rs/index.html @@ -2178,6 +2178,9 @@

    Processing property values

    1. If attr is [^/epub:type^] [[epub-33]], set baseURL to
      http://idpf.org/epub/vocab/structure/#
    2. +
    3. Otherwise, if elem is the package document [^meta^] element [[epub-33]] + and attr is scheme, the property value is invalid. Return null.
    4. Otherwise, if elem is the package document [^meta^] element [[epub-33]], set baseURL to
      http://idpf.org/epub/vocab/package/meta/#
    5. @@ -2199,6 +2202,9 @@

      Processing property values

      property data type, those attributes share the same default vocabulary. For this reason, it is not necessary to check both the element and attribute to determine what URL to assign.

      +

      The one attribute in EPUB 3 that does not have a default vocabulary is the scheme attribute + [[epub-33]]. A scheme value without a prefix is invalid.

  • From 577a97b18c81750ea13b22cb74f7cf172335890d Mon Sep 17 00:00:00 2001 From: Matt Garrish Date: Fri, 29 Jul 2022 17:01:58 -0300 Subject: [PATCH 09/11] clarify that scheme attribute does not have a default vocabulary so all values require a prefix --- epub33/core/index.html | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/epub33/core/index.html b/epub33/core/index.html index 303793c57..d9c95786d 100644 --- a/epub33/core/index.html +++ b/epub33/core/index.html @@ -4372,7 +4372,9 @@

    The meta element

    The scheme attribute identifies the system or scheme the EPUB creator obtained the element's [=value=] from. The value of the attribute MUST be a property data type value that resolves to the - resource that defines the scheme.

    + resource that defines the scheme. The scheme attribute does not have a default vocabulary (i.e., all values require a prefix).

  • +
  • 28-July-2022: The restrictions on the elements where epub:type may be used has been + made explicit. See issue 2377.
  • 18-July-2022: The viewport meta element for specifying the initial containing boundary in fixed-layout documents is now formally defined. See issue 2292.
  • From c3545604d452b93a86b9bcf834c6c22a8c624469 Mon Sep 17 00:00:00 2001 From: Matt Garrish Date: Sat, 30 Jul 2022 08:57:35 -0300 Subject: [PATCH 11/11] add clarification that an empty reference is allowed when a prefix and colon are defined --- epub33/core/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epub33/core/index.html b/epub33/core/index.html index 87df104ed..107f40ab4 100644 --- a/epub33/core/index.html +++ b/epub33/core/index.html @@ -9944,7 +9944,8 @@

    The property data type

    An empty string does not represent a valid property value, even though it is valid to - the definition above.

    + the definition above. A property value that consists only of a prefix and colon is + valid, however (i.e., the reference can be an empty string when a prefix is defined).