diff --git a/README.markdown b/README.markdown index e06ac4997c..c55a090d65 100644 --- a/README.markdown +++ b/README.markdown @@ -9,7 +9,10 @@ For information on additional DITA and DITA-OT resources, see [SUPPORT]. To repo - [Prerequisites: Java 17](#prerequisites-java-17) - [Installing](#installing) - [Building output](#building-output) -- [For developers](#for-developers) +- [Development](#development) + - [Running tests](#running-tests) + - [Formatting code](#formatting-code) + - [Distribution builds](#distribution-builds) - [License](#license) ## Prerequisites: Java 17 @@ -65,10 +68,9 @@ You can generate output using the `dita` command-line tool included with DITA Op See the [documentation][docs] for arguments and [options]. -## For developers +## Development -
-Building the toolkit from source code and compiling the distribution package +Building the toolkit from source code and compiling the distribution package 1. Clone the DITA-OT Git repository: ```shell @@ -87,6 +89,15 @@ See the [documentation][docs] for arguments and [options]. ./gradlew ``` +### Running tests + +```shell +./gradlew check +``` + +All tests are run by GitHub Actions [test workflow] on each push and +for every pull request. + ### Formatting code Requirements: @@ -118,8 +129,6 @@ Prettier is used retain consistent Java formatting. For more information on the `-Xmx` option, see the [Java SE Documentation][javadoc]. -
- ## License DITA Open Toolkit is licensed for use under the [Apache License 2.0][apache]. @@ -136,3 +145,4 @@ DITA Open Toolkit is licensed for use under the [Apache License 2.0][apache]. [apache]: http://www.apache.org/licenses/LICENSE-2.0 [issue]: https://github.com/dita-ot/dita-ot/issues/new/choose [contributing]: https://github.com/dita-ot/.github/blob/master/CONTRIBUTING.md +[test workflow]: https://github.com/dita-ot/dita-ot/actions/workflows/test.yml \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6dc7e07c3b..9dd9a659e7 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ apply plugin: 'signing' group = 'org.dita-ot' archivesBaseName = 'dost' /** Semver version number */ -version = '4.1.0' +version = '4.1.1' description = """DITA Open Toolkit""" @@ -33,28 +33,29 @@ dependencies { implementation group: 'xerces', name: 'xercesImpl', version:'2.12.2' implementation group: 'xml-apis', name: 'xml-apis', version:'1.4.01' implementation group: 'xml-resolver', name: 'xml-resolver', version:'1.2' - implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '12.2' + implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '12.3' implementation group: 'com.ibm.icu', name: 'icu4j', version:'70.1' implementation group: 'org.apache.ant', name: 'ant', version:'1.10.13' implementation group: 'org.apache.ant', name: 'ant-launcher', version:'1.10.13' - implementation(group: 'com.google.guava', name: 'guava', version: '25.1-jre') { + implementation(group: 'com.google.guava', name: 'guava', version: '32.1.1-jre') { exclude group: 'org.checkerframework', module: 'checker-qual' - exclude group: 'org.codehaus.mojo', module: 'animal-sniffer-annotations' exclude group: 'com.google.code.findbugs', module: 'jsr305' + exclude group: 'com.google.guava', module: 'failureaccess' + exclude group: 'com.google.guava', module: 'listenablefuture' exclude group: 'com.google.errorprone', module: 'error_prone_annotations' exclude group: 'com.google.j2objc', module: 'j2objc-annotations' } - implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.32' - implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.8' - implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.13.0' - implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.0' - implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.13.4' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.7' + implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.8' + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.15.2' + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2' + implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.15.2' implementation group: 'org.relaxng', name: 'jing', version: '20181222' implementation group: 'org.apache.ant', name: 'ant-apache-resolver', version:'1.10.13' testImplementation group: 'nu.validator.htmlparser', name: 'htmlparser', version:'1.4' - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.8.2' - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.8.2' - testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.6.0' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.9.3' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.9.3' + testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.9.1' } jar { @@ -84,6 +85,7 @@ artifacts { } test { + useJUnitPlatform() exclude '**/IntegrationTest*.class' exclude '**/EndToEndTest*.class' } @@ -110,6 +112,10 @@ task integrationTest(type: Test, dependsOn: 'buildLocal') { systemProperties = integrationTestSystemProperties include '**/IntegrationTest*.class' } +tasks.named('check') { + dependsOn('integrationTest') +} + // End to end test @@ -135,6 +141,9 @@ task e2eTest(type: Test, dependsOn: 'buildLocal') { systemProperties = e2eTestSystemProperties include '**/EndToEndTest*.class' } +tasks.named('check') { + dependsOn('e2eTest') +} // Install diff --git a/src/main/docsrc b/src/main/docsrc index a2925714be..6e6e51e892 160000 --- a/src/main/docsrc +++ b/src/main/docsrc @@ -1 +1 @@ -Subproject commit a2925714bea2a4b6ded51f3871bc91d39adb3485 +Subproject commit 6e6e51e89216f9f67cfe5e93f76d389a4e3ce0d5 diff --git a/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java b/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java index 09bc39c7bd..e913b2d30a 100644 --- a/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java +++ b/src/main/java/org/dita/dost/exception/DITAOTXMLErrorHandler.java @@ -45,10 +45,11 @@ public DITAOTXMLErrorHandler(final String file, final DITAOTLogger logger, final */ @Override public void error(final SAXParseException saxException) throws SAXException { + final SAXExceptionWrapper ex = new SAXExceptionWrapper(filePath, saxException); if (mode == Configuration.Mode.STRICT) { - throw new SAXExceptionWrapper(filePath, saxException); + throw ex; } else { - logger.error(saxException.getMessage(), saxException); + logger.error(ex.getMessage(), ex); } } diff --git a/src/main/java/org/ditang/relaxng/defaults/RelaxDefaultsParserConfiguration.java b/src/main/java/org/ditang/relaxng/defaults/RelaxDefaultsParserConfiguration.java index 2f48c6bb4c..3a8dc12cf6 100644 --- a/src/main/java/org/ditang/relaxng/defaults/RelaxDefaultsParserConfiguration.java +++ b/src/main/java/org/ditang/relaxng/defaults/RelaxDefaultsParserConfiguration.java @@ -163,9 +163,8 @@ protected void insertRelaxDefaultsComponent() { public void setFeature(String featureId, boolean state) throws XMLConfigurationException { if (XERCES_SCHEMA_VALIDATION.equals(featureId)) { relaxNGValidation = state; - } else { - super.setFeature(featureId, state); } + super.setFeature(featureId, state); } @Override diff --git a/src/main/plugins/org.dita.base/xsl/preprocess/topicpullImpl.xsl b/src/main/plugins/org.dita.base/xsl/preprocess/topicpullImpl.xsl index fcf5023e6f..5bec8fa24e 100644 --- a/src/main/plugins/org.dita.base/xsl/preprocess/topicpullImpl.xsl +++ b/src/main/plugins/org.dita.base/xsl/preprocess/topicpullImpl.xsl @@ -402,6 +402,14 @@ mode="topicpull:figure-linktext" and mode="topicpull:table-linktext" + + + + + + @@ -698,7 +706,6 @@ mode="topicpull:figure-linktext" and mode="topicpull:table-linktext" - @@ -714,7 +721,7 @@ mode="topicpull:figure-linktext" and mode="topicpull:table-linktext" - + @@ -1416,25 +1423,16 @@ mode="topicpull:figure-linktext" and mode="topicpull:table-linktext" - - - - - - - genshortdesc - - + + + + genshortdesc - - - - - - - usershortdesc - - + + + + + usershortdesc diff --git a/src/main/plugins/org.dita.html5/build_dita2html5_template.xml b/src/main/plugins/org.dita.html5/build_dita2html5_template.xml index aca4778c93..f2e4c1ed51 100644 --- a/src/main/plugins/org.dita.html5/build_dita2html5_template.xml +++ b/src/main/plugins/org.dita.html5/build_dita2html5_template.xml @@ -35,6 +35,7 @@ See the accompanying LICENSE file for applicable license. + @@ -46,6 +47,7 @@ See the accompanying LICENSE file for applicable license. + @@ -57,6 +59,7 @@ See the accompanying LICENSE file for applicable license. + @@ -178,9 +181,9 @@ See the accompanying LICENSE file for applicable license. - - - + + + diff --git a/src/main/plugins/org.dita.htmlhelp/build.gradle b/src/main/plugins/org.dita.htmlhelp/build.gradle index 292a87fa2d..75ff787cea 100644 --- a/src/main/plugins/org.dita.htmlhelp/build.gradle +++ b/src/main/plugins/org.dita.htmlhelp/build.gradle @@ -18,17 +18,21 @@ repositories { dependencies { implementation rootProject implementation group: 'commons-io', name: 'commons-io', version: '2.8.0' - implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '12.2' - implementation group: 'org.apache.ant', name: 'ant', version:'1.10.12' - implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' + implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '12.3' + implementation group: 'org.apache.ant', name: 'ant', version:'1.10.13' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.7' testImplementation rootProject - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.8.2' - testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.8.2' - testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.3.0' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.9.3' + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.9.3' + testImplementation group: 'org.xmlunit', name: 'xmlunit-core', version: '2.9.1' testImplementation group: 'nu.validator.htmlparser', name: 'htmlparser', version:'1.4' testImplementation rootProject.sourceSets.test.output } +test { + useJUnitPlatform() +} + jar.archiveFileName = "${project.name}.jar" task copyInstall(type: Copy) { diff --git a/src/main/plugins/org.dita.pdf2.fop/build.gradle b/src/main/plugins/org.dita.pdf2.fop/build.gradle index ce90c98248..c3023de407 100644 --- a/src/main/plugins/org.dita.pdf2.fop/build.gradle +++ b/src/main/plugins/org.dita.pdf2.fop/build.gradle @@ -21,13 +21,17 @@ dependencies { exclude group: 'xalan' } runtimeOnly group: 'xml-apis', name: 'xml-apis-ext', version: '1.3.04' - runtimeOnly group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.30' + runtimeOnly group: 'org.slf4j', name: 'jcl-over-slf4j', version: '2.0.7' runtimeOnly(group: 'org.apache.xmlgraphics', name: 'fop-pdf-images', version: '2.8') { exclude group: 'xalan' } runtimeOnly group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.28' } +test { + useJUnitPlatform() +} + task copyInstall(type: Copy) { from (jar) from(sourceSets.main.runtimeClasspath) { diff --git a/src/main/plugins/org.dita.pdf2.fop/plugin.xml b/src/main/plugins/org.dita.pdf2.fop/plugin.xml index 335a94a271..207de7e3a2 100644 --- a/src/main/plugins/org.dita.pdf2.fop/plugin.xml +++ b/src/main/plugins/org.dita.pdf2.fop/plugin.xml @@ -15,10 +15,10 @@ See the accompanying LICENSE file for applicable license. - + - + diff --git a/src/main/plugins/org.dita.pdf2/build.gradle b/src/main/plugins/org.dita.pdf2/build.gradle index a3d98dead9..2b906afc53 100644 --- a/src/main/plugins/org.dita.pdf2/build.gradle +++ b/src/main/plugins/org.dita.pdf2/build.gradle @@ -19,11 +19,10 @@ dependencies { implementation rootProject implementation group: 'commons-io', name: 'commons-io', version: '2.8.0' implementation group: 'com.ibm.icu', name: 'icu4j', version:'70.1' - implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '10.6' + implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '12.3' implementation group: 'org.apache.ant', name: 'ant', version:'1.10.13' - implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' + implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.7' implementation group: 'xml-resolver', name: 'xml-resolver', version:'1.2' - implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '12.2' } sourceSets { main { @@ -33,6 +32,10 @@ sourceSets { } } +test { + useJUnitPlatform() +} + jar.archiveFileName = "${project.name}.jar" jar.include "com/idiominc/**" jar.include "com/suite/**" diff --git a/src/main/plugins/org.dita.xhtml/build_general_template.xml b/src/main/plugins/org.dita.xhtml/build_general_template.xml index 1c6b0e4612..302547ea95 100644 --- a/src/main/plugins/org.dita.xhtml/build_general_template.xml +++ b/src/main/plugins/org.dita.xhtml/build_general_template.xml @@ -23,6 +23,7 @@ See the accompanying LICENSE file for applicable license. + @@ -34,6 +35,7 @@ See the accompanying LICENSE file for applicable license. + @@ -45,6 +47,7 @@ See the accompanying LICENSE file for applicable license. + @@ -133,9 +136,9 @@ See the accompanying LICENSE file for applicable license. if:set="args.css.file" /> - - - + + + diff --git a/src/test/java/org/dita/dost/IntegrationTestPreprocess1.java b/src/test/java/org/dita/dost/IntegrationTestPreprocess1.java index a0a23e85b7..cd91fed435 100644 --- a/src/test/java/org/dita/dost/IntegrationTestPreprocess1.java +++ b/src/test/java/org/dita/dost/IntegrationTestPreprocess1.java @@ -47,4 +47,16 @@ public void testRngGrammarPoolNoValidate() throws Throwable { .errorCount(0) .test(); } + + @Test + public void testXSDValidate() throws Throwable { + builder() + .name("bookmap-xsd-based-validate") + .transtype(PREPROCESS) + .input(Paths.get("main.ditamap")) + .put("validate", "true") + .warnCount(0) + .errorCount(0) + .test(); + } } diff --git a/src/test/java/org/dita/dost/exception/DITAOTXMLErrorHandlerTest.java b/src/test/java/org/dita/dost/exception/DITAOTXMLErrorHandlerTest.java index 64a9624c67..f5f1242b69 100644 --- a/src/test/java/org/dita/dost/exception/DITAOTXMLErrorHandlerTest.java +++ b/src/test/java/org/dita/dost/exception/DITAOTXMLErrorHandlerTest.java @@ -19,7 +19,7 @@ public class DITAOTXMLErrorHandlerTest { private final DITAOTLogger logger = new TestLogger(); - private final DITAOTXMLErrorHandler e = new DITAOTXMLErrorHandler("path", logger, Configuration.Mode.LAX); + private final DITAOTXMLErrorHandler e = new DITAOTXMLErrorHandler("path", logger, Configuration.Mode.STRICT); private final SAXParseException se = new SAXParseException( "message", "publicId", diff --git a/src/test/resources/bookmap-xsd-based-validate/exp/preprocess/main.ditamap b/src/test/resources/bookmap-xsd-based-validate/exp/preprocess/main.ditamap new file mode 100644 index 0000000000..8d07b12ba7 --- /dev/null +++ b/src/test/resources/bookmap-xsd-based-validate/exp/preprocess/main.ditamap @@ -0,0 +1,4 @@ + + Main + T1T1 + \ No newline at end of file diff --git a/src/test/resources/bookmap-xsd-based-validate/exp/preprocess/t1.dita b/src/test/resources/bookmap-xsd-based-validate/exp/preprocess/t1.dita new file mode 100644 index 0000000000..dfe5c2f614 --- /dev/null +++ b/src/test/resources/bookmap-xsd-based-validate/exp/preprocess/t1.dita @@ -0,0 +1,6 @@ + + T1 + +

+ + \ No newline at end of file diff --git a/src/test/resources/bookmap-xsd-based-validate/src/main.ditamap b/src/test/resources/bookmap-xsd-based-validate/src/main.ditamap new file mode 100644 index 0000000000..3c972cdbf9 --- /dev/null +++ b/src/test/resources/bookmap-xsd-based-validate/src/main.ditamap @@ -0,0 +1,8 @@ + + + + Main + + + diff --git a/src/test/resources/bookmap-xsd-based-validate/src/t1.dita b/src/test/resources/bookmap-xsd-based-validate/src/t1.dita new file mode 100644 index 0000000000..4f93b4097d --- /dev/null +++ b/src/test/resources/bookmap-xsd-based-validate/src/t1.dita @@ -0,0 +1,8 @@ + + + T1 + +

+ +