Repository: w3c/epubcheck (java)

Issue:
role="math" on images
When following the WAI ARIA 1.2 example for using `role="math"` on an image element to indicate that it represents a mathematical expression (https://www.w3.org/TR/wai-aria-1.2/#example-8), EPUBCheck reports an ERROR RSC-005 stating that the value of the "role" attribute is invalid.

From the WAI ARIA 1.2 spec:

> While it is not ideal to use an image of a mathematical expression, there exists a significant amount of legacy content where images are used to represent mathematical expressions. Authors SHOULD ensure that images of math are labeled by text that describes the mathematical expression as it might be spoken.

However, EPUBCheck doesn't recognize `math` as a valid value for the `role` attribute, resulting in a false positive error.

Here you can find a sample EPUB file exhibiting this issue for testing purposes: [quadratic-formula.epub.zip](https://github.com/w3c/epubcheck/files/15401438/quadratic-formula.epub.zip)

Pull request:
Update the HTML schema
Fix #1562

Patch:
diff --git a/src/build/update-validator-schemas.sh b/src/build/update-validator-schemas.sh
index 62ff2fe2..665f53e3 100755
--- a/src/build/update-validator-schemas.sh
+++ b/src/build/update-validator-schemas.sh
@@ -35,7 +35,7 @@ LAST_UPDATE_FILE=$EPUBCHECK_DIR/src/main/resources/com/adobe/epubcheck/schema/30
 if [ ! -f "$LAST_UPDATE_FILE" ]; then
   error_exit "could not find the last commit sha-1; make sure you are in the EPUBCheck git repository"
 fi
-LAST_SHA1=`cat $LAST_UPDATE_FILE`
+SHA_LAST_UPDATE=`cat $LAST_UPDATE_FILE`
 
 ## Move to validator.nu repo
 echo "Moving to the validator.nu repository"
@@ -55,22 +55,23 @@ fi
 echo "Fetching new commits from remote '$UPSTREAM'"
 git fetch $UPSTREAM
 
-## Create patches since last update (to the `latest` tag)
-echo "Creating paches of changes since the last update"
-git format-patch -o $EPUBCHECK_DIR/ $LAST_SHA1..latest schema
+## Get the SHA-1 of the SHA_VALIDATOR_LATEST revision on upstream
+SHA_VALIDATOR_LATEST=`git rev-list -n 1 $UPSTREAM/main`
+echo $SHA_VALIDATOR_LATEST
 
-## Get the SHA-1 of the `latest` tag
-LATEST=`git rev-list -n 1 latest`
-echo $LATEST
+## Create patches since last update (to the `SHA_VALIDATOR_LATEST` tag)
+echo "Creating paches of changes since the last update"
+git format-patch -o $EPUBCHECK_DIR/ $SHA_LAST_UPDATE..$SHA_VALIDATOR_LATEST schema
 
 ## Move to EPUBCheck repo
 echo "Moving back to the EPUBCheck repository"
 cd "$EPUBCHECK_DIR" # let's move to the validator repo
 
 ## Edit the LAST_UPDATE file
-echo $LATEST > $LAST_UPDATE_FILE
+echo $SHA_VALIDATOR_LATEST > $LAST_UPDATE_FILE
 git add $LAST_UPDATE_FILE
 git ci -m "feat: update to latest schemas from the Nu HTML Checker"
+SHA_BEFORE_PATCH=`git rev-list -n 1 HEAD`
 
 ## Update the paths in patches to the EPUBCheck location
 echo "Updating paths in patch files"
@@ -80,10 +81,30 @@ sed -i "" -E  "/^(diff|---|\+\+\+) / s:/schema/:/src/main/resources/com/adobe/ep
 echo "Applying the patches"
 git am *.patch
 
-## FROM HERE ON, THE INTERACTIVE APPLICATION OF PATCHES MAY EXIT THE SCRIPT
-
-# Remaing tasks:
-# - commit new last commit ID
-# - squash commits (add "Co-Authored by" credits)
-#   `git log --pretty=format:"---------------------%n%n%s%n%nhttps://github.com/validator/validator/commit/%h%n%nCo-authored-by: %aN <%aE>%n" $LAST-SHA1..latest schema``
-# - remove patch files
\ No newline at end of file
+###
+echo ""
+echo "WARNING! From here on, the interactive application of patches may exit the script."
+echo ""
+###
+
+SHA_AFTER_PATCH=`git rev-list -n 1 HEAD`
+
+## Build a commit message
+## - with proper credits to original committers
+## - replacing issue references to the validator repo
+echo "Creating the consolidated commit message"
+printf "feat: update to latest schemas from the Nu HTML Checker\n\n" > commit-message.txt
+git log \
+ --pretty=format:"---------------------%n%n%s%n%nhttps://github.com/validator/validator/commit/%h%n%nCo-authored-by: %aN <%aE>%n" \
+ $SHA_BEFORE_PATCH..$SHA_AFTER_PATCH \
+ | sed -E "s/#([0-9]+)/validator\/validator\/#\1/" >> commit-message.txt
+
+## Squash the patch commits
+echo "Consolidating the commits"
+git reset --soft $SHA_BEFORE_PATCH~1
+git ci -F commit-message.txt
+
+## Clean up the files
+echo "Cleaning the patch files"
+rm *.patch
+rm commit-message.txt
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/LAST_UPDATE b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/LAST_UPDATE
index 126b31fe..62110fd7 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/LAST_UPDATE
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/LAST_UPDATE
@@ -1,1 +1,1 @@
-b118bf6031b0b06797f3ccdc25d0f74c1447139a
+9855955c12fa95b0b452ddf62ca731172b5c7cea
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/embed.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/embed.rnc
index 6a271d4c..4ee91217 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/embed.rnc
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/embed.rnc
@@ -38,6 +38,7 @@ namespace local = ""
 			|	common.attrs.aria.role.checkbox
 			|	common.attrs.aria.role.img
 			|	common.attrs.aria.role.link
+			|	common.attrs.aria.role.math
 			|	common.attrs.aria.role.menuitem
 			|	common.attrs.aria.role.menuitemcheckbox
 			|	common.attrs.aria.role.menuitemradio
diff --git a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/structural.rnc b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/structural.rnc
index 75792b1b..9370b4a5 100644
--- a/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/structural.rnc
+++ b/src/main/resources/com/adobe/epubcheck/schema/30/mod/html5/structural.rnc
@@ -125,6 +125,7 @@
 			|	common.attrs.aria.role.doc-dedication
 			|	common.attrs.aria.role.doc-example
 			|	common.attrs.aria.role.doc-footnote
+			|	common.attrs.aria.role.doc-glossary
 			|	common.attrs.aria.role.doc-pullquote
 			|	common.attrs.aria.role.doc-tip
 			)?


Test patch:
diff --git a/src/test/resources/epub3/06-content-document/content-document-xhtml.feature b/src/test/resources/epub3/06-content-document/content-document-xhtml.feature
index 62321439..21b9042d 100644
--- a/src/test/resources/epub3/06-content-document/content-document-xhtml.feature
+++ b/src/test/resources/epub3/06-content-document/content-document-xhtml.feature
@@ -141,14 +141,6 @@ Feature: EPUB 3 — Content Documents — XHTML
     Then error RSC-005 is reported
     And the message contains 'attribute "aria-describedat" not allowed here'
     And no other errors or warnings are reported
-    
-  Scenario: Verify the DPUB-ARIA roles allowed on `a`
-    When checking document 'aria-roles-img-valid.xhtml'
-    Then no errors or warnings are reported
-
-  Scenario: Verify the DPUB-ARIA roles allowed on `aside`
-    When checking document 'aria-roles-img-valid.xhtml'
-    Then no errors or warnings are reported
 
   Scenario: Verify the DPUB-ARIA roles allowed on `footer`
     When checking document 'aria-roles-footer-valid.xhtml'
@@ -162,10 +154,6 @@ Feature: EPUB 3 — Content Documents — XHTML
     When checking document 'aria-roles-header-valid.xhtml'
     Then no errors or warnings are reported
 
-  Scenario: Verify the DPUB-ARIA roles allowed on `hr`
-    When checking document 'aria-roles-header-valid.xhtml'
-    Then no errors or warnings are reported
-
   Scenario: Verify the DPUB-ARIA roles allowed on `img`
     When checking document 'aria-roles-img-valid.xhtml'
     Then no errors or warnings are reported
diff --git a/src/test/resources/epub3/06-content-document/files/aria-roles-img-valid.xhtml b/src/test/resources/epub3/06-content-document/files/aria-roles-img-valid.xhtml
index 30f144d8..76c1b327 100644
--- a/src/test/resources/epub3/06-content-document/files/aria-roles-img-valid.xhtml
+++ b/src/test/resources/epub3/06-content-document/files/aria-roles-img-valid.xhtml
@@ -5,6 +5,7 @@
 		<title>DPUB-ARIA roles allowed on img</title>
 	</head>
 	<body>
-		<img role="doc-cover" src="test.jpg" alt="okay"/>
+		<img role="doc-cover" src="cover.jpg" alt="cover"/>
+		<img role="math" src="math.jpg" alt="math"/>
 	</body>
 </html>