Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve checks of package links #1466

Merged
merged 2 commits into from
Jan 3, 2023
Merged

improve checks of package links #1466

merged 2 commits into from
Jan 3, 2023

Conversation

rdeltour
Copy link
Member

fix: allow links to resources embedded in content documents

This commit checks that the linked resource is not in the spine before
reporting OPF-067 ("The resource "…" must not be listed both as a
"link" element in the package metadata and as a manifest item.").

Effectively, this allows package links to publication resources in the
two cases identified in the EPUB 3.3 specification:

Resources referenced from the link element are publication resources
only when they are:

  • referenced from the spine; or
  • included or embedded in an EPUB content document

Fix #1454

feat: report package link to package document elements

This commit introduces a new error message (OPF-098) to report href attributes
containing a URL to package document elements.

This implements a check for the following specification statement:

The URL string MUST NOT reference resources via elements in the package document

This commit introduces a new error message (`OPF-098`) to report `href` attributes
containing a URL to package document elements.

This implements a check for the following specification statement:
> The URL string MUST NOT reference resources via elements in the package document
@rdeltour rdeltour added this to the v5.0.0-rc milestone Dec 23, 2022
@rdeltour rdeltour self-assigned this Dec 23, 2022
@@ -213,7 +213,8 @@ OPF_094=The "media-type" attribute is required for "%1$s" links.
OPF_095=The "media-type" attribute of "voicing" links must be an audio MIME type, but found "%1$s".
OPF_096=Non-linear content must be reachable, but found no hyperlink to "%1$s".
OPF_096b=No hyperlink was found to non-linear document "%1$s", please check that it can be reached from scripted content.
OPF_097=Resource "%1$s" is listed in the manifest, but no reference to it was found in content documents.
OPF_097=Resource "%1$s" is listed in the manifest, but no reference to it was found in content documents.
OPF_098=The "href" attribute must not reference resources via elements in the package document itself, but found URL "%1$s".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, but could this be explained as a must:

Suggested change
OPF_098=The "href" attribute must not reference resources via elements in the package document itself, but found URL "%1$s".
OPF_098=The "href" attribute must reference resources, not elements in the package document, but found URL "%1$s".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I copied the language from the spec 🙂, but I agree your suggested wording makes more sense.

At some point it would be nice to have the time to go over all the messages and try to do some copyediting to harmonize the language and tone… but well, that's for another version!

Base automatically changed from feat/manifest-resources to main January 3, 2023 14:03
This commit checks that the linked resource is not in the spine before
reporting `OPF-067` ("The resource "…" must not be listed both as a
"link" element in the package metadata and as a manifest item.").

Effectively, this allows package links to publication resources in the
two cases identified in the EPUB 3.3 specification:

> Resources referenced from the link element are publication resources
> only when they are:
> - referenced from the spine; or
> - included or embedded in an EPUB content document

Fix #1454
@rdeltour rdeltour merged commit 54b5f1f into main Jan 3, 2023
@rdeltour rdeltour deleted the feat/package-links branch January 3, 2023 14:32
rdeltour added a commit that referenced this pull request Jul 6, 2023
---------------------

Add `plaintext-only` value to `contenteditable` attribute

validator/validator@228ea687b

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

add warnings for deprecated ARIA attributes (#1560)

validator/validator@e61fbeb2c

Co-authored-by: Steve Faulkner <faulkner.steve@gmail.com>

---------------------

disallow aria attributes on datalist (#1557)

validator/validator@b4849c04b

Co-authored-by: Steve Faulkner <faulkner.steve@gmail.com>

---------------------

allow role=button on area

validator/validator@89ff1fc2b

Co-authored-by: stevefaulkner <faulkner.steve@gmail.com>

---------------------

fix: allow -1 for aria-colcount

validator/validator@2466e73c4

Co-authored-by: Nick Schonning <nschonni@gmail.com>

---------------------

fix: Allow -1 for aria-rowcount

validator/validator@eac205b6b

Co-authored-by: Nick Schonning <nschonni@gmail.com>

---------------------

Add `fetchpriority` attribute

validator/validator@7c9991405

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Script type importmap (#1478)

validator/validator@4054c56f5

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

Move “manifest” attribute to legacy-attributes list

validator/validator@175e62d3a

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

Pointer Events (#1481)

validator/validator@5eb52a931

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

Report a better error message for obsolete “manifest” attribute

validator/validator@ae924b625

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

onscrollend

validator/validator@87287a97f

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

slot element

validator/validator@d6cf423c1

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Allow paragraphs in hgroup (#1467)

validator/validator@3ff53973f

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

blocking="render" (#1466)

validator/validator@df5d4e23a

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

inert

validator/validator@507f551b2

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

hidden=until-found

validator/validator@a424d55a8

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

media attribute in meta element

validator/validator@af3e94d22

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Sync event handlers

validator/validator@58bea51c7

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Remove manifest attribute

validator/validator@66510f3ca

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

enterkeyhint

validator/validator@70f3044d7

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Form method dialog (#1443)

validator/validator@0db229a44

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

imagesrcset and imagesizes in link (#1444)

validator/validator@49656dbfc

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

feat: add support width and height of source in picture

validator/validator@176d98e4f

Co-authored-by: Takeshi Kurosawa <kurosawa-takeshi@mitsue.co.jp>

---------------------

Update: allow none/presentation on nav element (#1323)

validator/validator@5e25edb39

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

Update schema/html5/web-forms.rnc

validator/validator@95ba6c7cf

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

update role allowances for button and input type=button

validator/validator@6cc14c4d7

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

adds role=radio alowance to img alt=foo

validator/validator@b013aa02b

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

remove deprecated dpub role allowances

validator/validator@b0fb152c0

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

allow section element to have role=group

validator/validator@078341d37

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>
rdeltour added a commit that referenced this pull request Jul 7, 2023
---------------------

Add `plaintext-only` value to `contenteditable` attribute

validator/validator@228ea687b

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

add warnings for deprecated ARIA attributes (#1560)

validator/validator@e61fbeb2c

Co-authored-by: Steve Faulkner <faulkner.steve@gmail.com>

---------------------

disallow aria attributes on datalist (#1557)

validator/validator@b4849c04b

Co-authored-by: Steve Faulkner <faulkner.steve@gmail.com>

---------------------

allow role=button on area

validator/validator@89ff1fc2b

Co-authored-by: stevefaulkner <faulkner.steve@gmail.com>

---------------------

fix: allow -1 for aria-colcount

validator/validator@2466e73c4

Co-authored-by: Nick Schonning <nschonni@gmail.com>

---------------------

fix: Allow -1 for aria-rowcount

validator/validator@eac205b6b

Co-authored-by: Nick Schonning <nschonni@gmail.com>

---------------------

Add `fetchpriority` attribute

validator/validator@7c9991405

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Script type importmap (#1478)

validator/validator@4054c56f5

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

Move “manifest” attribute to legacy-attributes list

validator/validator@175e62d3a

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

Pointer Events (#1481)

validator/validator@5eb52a931

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

Report a better error message for obsolete “manifest” attribute

validator/validator@ae924b625

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

onscrollend

validator/validator@87287a97f

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

slot element

validator/validator@d6cf423c1

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Allow paragraphs in hgroup (#1467)

validator/validator@3ff53973f

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

blocking="render" (#1466)

validator/validator@df5d4e23a

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

inert

validator/validator@507f551b2

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

hidden=until-found

validator/validator@a424d55a8

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

media attribute in meta element

validator/validator@af3e94d22

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Sync event handlers

validator/validator@58bea51c7

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Remove manifest attribute

validator/validator@66510f3ca

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

enterkeyhint

validator/validator@70f3044d7

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Form method dialog (#1443)

validator/validator@0db229a44

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

imagesrcset and imagesizes in link (#1444)

validator/validator@49656dbfc

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

feat: add support width and height of source in picture

validator/validator@176d98e4f

Co-authored-by: Takeshi Kurosawa <kurosawa-takeshi@mitsue.co.jp>

---------------------

Update: allow none/presentation on nav element (#1323)

validator/validator@5e25edb39

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

Update schema/html5/web-forms.rnc

validator/validator@95ba6c7cf

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

update role allowances for button and input type=button

validator/validator@6cc14c4d7

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

adds role=radio alowance to img alt=foo

validator/validator@b013aa02b

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

remove deprecated dpub role allowances

validator/validator@b0fb152c0

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

allow section element to have role=group

validator/validator@078341d37

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>
rdeltour added a commit that referenced this pull request Jul 7, 2023
---------------------

Add `plaintext-only` value to `contenteditable` attribute

validator/validator@228ea687b

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

add warnings for deprecated ARIA attributes (#1560)

validator/validator@e61fbeb2c

Co-authored-by: Steve Faulkner <faulkner.steve@gmail.com>

---------------------

disallow aria attributes on datalist (#1557)

validator/validator@b4849c04b

Co-authored-by: Steve Faulkner <faulkner.steve@gmail.com>

---------------------

allow role=button on area

validator/validator@89ff1fc2b

Co-authored-by: stevefaulkner <faulkner.steve@gmail.com>

---------------------

fix: allow -1 for aria-colcount

validator/validator@2466e73c4

Co-authored-by: Nick Schonning <nschonni@gmail.com>

---------------------

fix: Allow -1 for aria-rowcount

validator/validator@eac205b6b

Co-authored-by: Nick Schonning <nschonni@gmail.com>

---------------------

Add `fetchpriority` attribute

validator/validator@7c9991405

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Script type importmap (#1478)

validator/validator@4054c56f5

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

Move “manifest” attribute to legacy-attributes list

validator/validator@175e62d3a

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

Pointer Events (#1481)

validator/validator@5eb52a931

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

Report a better error message for obsolete “manifest” attribute

validator/validator@ae924b625

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

onscrollend

validator/validator@87287a97f

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

slot element

validator/validator@d6cf423c1

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Allow paragraphs in hgroup (#1467)

validator/validator@3ff53973f

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

blocking="render" (#1466)

validator/validator@df5d4e23a

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

inert

validator/validator@507f551b2

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

hidden=until-found

validator/validator@a424d55a8

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

media attribute in meta element

validator/validator@af3e94d22

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Sync event handlers

validator/validator@58bea51c7

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Remove manifest attribute

validator/validator@66510f3ca

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

enterkeyhint

validator/validator@70f3044d7

Co-authored-by: Niedziolka Michal <niedziolek@hotmail.com>

---------------------

Form method dialog (#1443)

validator/validator@0db229a44

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

imagesrcset and imagesizes in link (#1444)

validator/validator@49656dbfc

Co-authored-by: Michał Niedziółka <niedziolek@hotmail.com>

---------------------

feat: add support width and height of source in picture

validator/validator@176d98e4f

Co-authored-by: Takeshi Kurosawa <kurosawa-takeshi@mitsue.co.jp>

---------------------

Update: allow none/presentation on nav element (#1323)

validator/validator@5e25edb39

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

Update schema/html5/web-forms.rnc

validator/validator@95ba6c7cf

Co-authored-by: Michael[tm] Smith <mike@w3.org>

---------------------

update role allowances for button and input type=button

validator/validator@6cc14c4d7

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

adds role=radio alowance to img alt=foo

validator/validator@b013aa02b

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

remove deprecated dpub role allowances

validator/validator@b0fb152c0

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>

---------------------

allow section element to have role=group

validator/validator@078341d37

Co-authored-by: Scott O'Hara <scottaohara@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

do not report when linked resources are legit publication resources
2 participants