-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add textbook-html Relax-NG Grammar #9
Conversation
java -jar ./cnxml/jing.jar ./textbook-html/textbook-html.rng /path/to/cnx-rulesets/data/econ-raw.xhtml | grep "error: attribute"
java -jar ./cnxml/jing.jar ./textbook-html/textbook-html.rng /path/to/cnx-rulesets/data/econ-raw.xhtml | grep "unknown element"
yay, down to 1828 errors (in the econ book) from like 50k or so. I think the remaining errors require changes to both:
@reedstrm where would I look to change the metadata blocks? |
re: |
to get an epub to validate, try |
@reedstrm Hmm, I tried and got the following:
I also tried running the following but nothing showed up:
Where would I find that script on |
@philschatz check your scripts dir: the archive venv: /var/cnx/venv/archive/bin , I think. |
Thanks! that worked. I checked the econ book ( Of course, I'm only on the 1st part (widen the scope of validation so that books pass through). The 2nd part is "narrow the scope of validation so that books are structurally sound". For example, right now an "exercise solution" can exist anywhere but it should only occur inside an exercise. |
by adding boilerplate
openstax/rhaptos.cnxmlutils@8dcf3d1 contains all the fixes to get |
Astronomy now validates as well |
There are now autogenerated docs (from the This should help in code-review and as a reference to link to |
This seems to require prefixing RNG elements with `r:` so that the HTML elements can remain unprefixed
Last night I tried rebuilding all the textbooks in https://github.com/philschatz/textbooks and ran into validation errors so it appears that this PR needs to be updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't parsed the rng in detail, but the autogenerated docs seem accurate - assuming the comments match the code, we're good to go on this.
@reedstrm Oops, I was wrong... they weren't "validation errors", this correctly caught the following:
So, yeah, the grammar matches the XSLT in openstax/rhaptos.cnxmlutils#157 |
Ah, and the most recent commit doesn't pass tests for some reason? |
I'm a little confused by the question. The most-recent commit does pass tests (the Travis-CI checkmark). Yesterday a book was failing validation and I thought it was because I needed to update the |
CLOSING. If this presents itself as an issue again, we will reopen. |
Click me to View the Docs
The goal is to validate against the raw (and then baked) books in https://github.com/Connexions/cnx-rulesets
TODO
First, widen the grammar to stop erroring:
<figure>
,<section>
itemprop
attributes to the elements that need itdata-type
anddata-*
attributes to the elements that need itClick me for ... Example Grammar for the book structure as a .rnc file (more readable)
And then, fix HTML elements that are not allowed in a certain context (in the CNXML->HTML conversion)
p > div
p > table
p > figure
p > blockquote
??? > ol
And then, clean up the metadata blocks:
id="publisher-1"
attributes<div class="...">
(does not have adata-type
or some other attribute) so it is not validatableid="{UUID}"
attributes (needs to start with a character, not a number)And then, begin restricting the elements and attributes:
<abbr>
,<script>
<abbr>
,<acronym>
,<dfn>
)id
attributes required for many elements<div data-type="exercise">
(not arbitrary divs)<nav>
with a restricted set of childrendata-numbering-style="..."
only when a<ol>
or a<div data-type="list">
And then:
<a:documentation>
elements