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

Allow foreign ns elements and attributes in svg content docs #970

Merged
merged 2 commits into from
Feb 25, 2019

Conversation

mattgarrish
Copy link
Member

(Resubmitting branched off next/v4.2.0 this time.)

I believe this NVDL accomplishes what is needed for #491. It attaches XHTML elements as well as epub:, xlink: and xml: attributes, as well as attributes in no namespace. Elements and attributes from any other namespace are blanket allowed.

The empty pattern in the sch file is annoying, but without it oxygen was complaining that a required pattern was missing. Seems to be harmless, but feel free to comment it out.

@murata2makoto
Copy link
Contributor

I reviewed the NVDL script. It looks good to me, but I would like to use a mode name different from "attach". This mode does not attach foreign elements or attributes.

@mattgarrish
Copy link
Member Author

mattgarrish commented Feb 9, 2019

How about calling it allowForeignNS?

Copy link
Member

@rdeltour rdeltour left a comment

Choose a reason for hiding this comment

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

Thank you @mattgarrish for submitting this PR, and thank you @murata2makoto for the review!

Before merging, I'll need to augment the PR with the Java code to preprocess (remove) data-* attributes, in both HTML and SVG Content Docs. That's why I'm reviewing as "Request changes".
This code is sitting on a branch in my local working copy btw, I'll push it when I'm back.

@rdeltour rdeltour self-assigned this Feb 9, 2019
@rdeltour rdeltour added the status: in progress The issue is being implemented by the development team label Feb 9, 2019
@rdeltour rdeltour added this to the 4.2.0-beta milestone Feb 9, 2019
@rdeltour rdeltour self-requested a review February 25, 2019 00:41
Main changes:
- switch to a master NVDL schema for SVG Content Document validation
  (in EPUB 3)
- allow elements and attributes in foreign namespaces in SVG Content
  Documents, except where otherwise forbidden in the spec (i.e. in the
 `foreignObject` element, where only HTML is allowed)
- allow `data-*` attributes in SVG (by removing them at parsing time)
- add more tests

Also:
- slightly refactor the attribute pre-processing in XMLParser

Fix #491
@rdeltour rdeltour force-pushed the fix/issue-491/nvdl-foreign-ns branch from f8e79c8 to ca29c89 Compare February 25, 2019 00:51
@rdeltour
Copy link
Member

I updated the PR:

  • added code in the XML Parser to allow the data-* attributes by removing them at parsing time
  • tweaked the NVDL to attach all namespaces to the Schematron validation
  • tweaked the NVDL to set a stricter HTML-only mode to the RelaxNG validation in the context of a foreignObject element.

I took the opportunity to update Jing to v20181222 (which fixes #859 without us having to provide a hack, and even from an NVDL schema factory).

@mattgarrish I couldn't assign you to review your own PR, but if you can have a quick look… 😉

@mattgarrish
Copy link
Member Author

LGTM!

@rdeltour rdeltour merged commit ca29c89 into next/v4.2.0 Feb 25, 2019
@rdeltour rdeltour added status: completed Work completed, can be closed and removed status: in progress The issue is being implemented by the development team labels Feb 25, 2019
@rdeltour rdeltour deleted the fix/issue-491/nvdl-foreign-ns branch February 25, 2019 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed Work completed, can be closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants