diff --git a/src/build/update-validator-schemas.sh b/src/build/update-validator-schemas.sh index 62ff2fe2d..665f53e34 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 126b31fe7..62110fd7d 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 @@ -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 6a271d4ca..4ee91217a 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 75792b1bc..9370b4a56 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 )? 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 623214395..21b9042d9 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 30f144d80..76c1b3270 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 @@