diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index b4fa520cc..32f4ded92 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -1,5 +1,6 @@ name: build-docbook on: push + jobs: check_branch: runs-on: ubuntu-latest @@ -36,6 +37,7 @@ jobs: needs: check_branch env: HAVE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN != '' }} + HAVE_GPGKEYURI: ${{ secrets.ACCESS_TOKEN != '' && secrets.GPGKEYURI != '' }} HAVE_SAXON_EE: ${{ secrets.SAXON_PASSPHRASE != '' }} CIWORKFLOW: yes CI_SHA1: ${{ github.sha }} @@ -135,6 +137,18 @@ jobs: files: | build/distributions/docbook-xslTNG-${{ env.CI_TAG }}.zip + - name: Publish to Sonatype + if: ${{ env.HAVE_GPGKEYURI == 'true' && env.CI_BRANCH == 'main' && env.CI_TAG != '' }} + run: | + curl -s -o secret.gpg ${{ secrets.GPGKEYURI }} + ./gradlew -PsonatypeUsername=${{ secrets.SONATYPEUSER }} \ + -PsonatypePassword="${{ secrets.SONATYPEPASS }}" \ + -Psigning.keyId="${{ secrets.SIGNKEY }}" \ + -Psigning.password="${{ secrets.SIGNPSW }}" \ + -Psigning.secretKeyRingFile=./secret.gpg \ + publish + rm -f secret.gpg + - name: Checkout the CDN uses: actions/checkout@v3 if: ${{ env.HAVE_ACCESS_TOKEN == 'true' && env.CI_BRANCH == 'main' && env.CI_TAG != '' }} diff --git a/buildSrc/src/main/java/org/docbook/xsltng/extensions/Cwd.java b/buildSrc/src/main/java/org/docbook/xsltng/extensions/Cwd.java index 509884d5c..92ff2de8f 100644 --- a/buildSrc/src/main/java/org/docbook/xsltng/extensions/Cwd.java +++ b/buildSrc/src/main/java/org/docbook/xsltng/extensions/Cwd.java @@ -16,7 +16,7 @@ * Saxon * extension to return the current working directory (the user.dir system property). * - *

Copyright © 2011-2020 Norman Walsh. + *

Copyright © 2011-2023 Norman Walsh. * * @author Norman Walsh * ndw@nwalsh.com @@ -61,7 +61,16 @@ public Sequence call(XPathContext xPathContext, Sequence[] sequences) throws XPa if (!dir.endsWith("/")) { dir += "/"; } - return new AnyURIValue(dir); + + // 21 Jan 2023, make this a file: URI. Previously, this was left as just a path + // and it was made absolute against the static base uri. But that doesn't work + // correctly if the static base URI is, for example https://cdn.docbook.org/... + if (dir.startsWith("/")) { + return new AnyURIValue("file:" + dir); + } else { + // Windows, for example, where dir might be C:\... + return new AnyURIValue("file:/" + dir); + } } } } diff --git a/properties.gradle b/properties.gradle index 640b0a442..f178cc4b2 100644 --- a/properties.gradle +++ b/properties.gradle @@ -2,8 +2,8 @@ ext { xslTNGtitle = 'DocBook xslTNG' xslTNGbaseName = 'docbook-xslTNG' - xslTNGversion = '2.0.3' - guideVersion = '2.0.3' + xslTNGversion = '2.0.4' + guideVersion = '2.0.4' guidePrerelease = true docbookVersion = '5.2CR4' diff --git a/src/guide/xml/ref-params.xml b/src/guide/xml/ref-params.xml index 254f4b34b..bfe22a799 100644 --- a/src/guide/xml/ref-params.xml +++ b/src/guide/xml/ref-params.xml @@ -736,9 +736,7 @@ support keyboard navigation. - - + xs:string mediaobject-input-base-uri + select="ext:cwd()"/> diff --git a/src/main/xslt/docbook.xsl b/src/main/xslt/docbook.xsl index 89eabe4b7..68da7afed 100644 --- a/src/main/xslt/docbook.xsl +++ b/src/main/xslt/docbook.xsl @@ -172,8 +172,7 @@ - + diff --git a/src/main/xslt/modules/chunk-cleanup.xsl b/src/main/xslt/modules/chunk-cleanup.xsl index cb8cf783a..ebcce4bc8 100644 --- a/src/main/xslt/modules/chunk-cleanup.xsl +++ b/src/main/xslt/modules/chunk-cleanup.xsl @@ -9,10 +9,11 @@ xmlns:mp="http://docbook.org/ns/docbook/modes/private" xmlns:t="http://docbook.org/ns/docbook/templates" xmlns:v="http://docbook.org/ns/docbook/variables" + xmlns:vp="http://docbook.org/ns/docbook/variables/private" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" default-mode="m:chunk-cleanup" - exclude-result-prefixes="db dbe f fp h m mp t v xs" + exclude-result-prefixes="#all" version="3.0"> @@ -276,8 +277,7 @@ + $vp:chunk-output-base-uri)"/> @@ -566,8 +566,7 @@ - + diff --git a/src/main/xslt/modules/chunk-output.xsl b/src/main/xslt/modules/chunk-output.xsl index abc6cc667..aa7bca035 100644 --- a/src/main/xslt/modules/chunk-output.xsl +++ b/src/main/xslt/modules/chunk-output.xsl @@ -211,7 +211,7 @@ - + @@ -227,121 +227,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -367,7 +255,7 @@ - + diff --git a/src/main/xslt/modules/chunk.xsl b/src/main/xslt/modules/chunk.xsl index 49a93b652..dc7035d38 100644 --- a/src/main/xslt/modules/chunk.xsl +++ b/src/main/xslt/modules/chunk.xsl @@ -9,10 +9,11 @@ xmlns:mp="http://docbook.org/ns/docbook/modes/private" xmlns:t="http://docbook.org/ns/docbook/templates" xmlns:v="http://docbook.org/ns/docbook/variables" + xmlns:vp="http://docbook.org/ns/docbook/variables/private" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" default-mode="m:docbook" - exclude-result-prefixes="db dbe f fp h m mp t v xs" + exclude-result-prefixes="#all" version="3.0"> @@ -207,7 +208,7 @@ - + diff --git a/src/main/xslt/modules/variable.xsl b/src/main/xslt/modules/variable.xsl index 44dc325bb..513df8b6d 100644 --- a/src/main/xslt/modules/variable.xsl +++ b/src/main/xslt/modules/variable.xsl @@ -152,10 +152,27 @@ - + + + + + + + + + + + + + + + + + + + diff --git a/src/test/java/org/docbook/xsltng/extensions/TestCwd.java b/src/test/java/org/docbook/xsltng/extensions/TestCwd.java index c70c96ad8..2ef73dff1 100644 --- a/src/test/java/org/docbook/xsltng/extensions/TestCwd.java +++ b/src/test/java/org/docbook/xsltng/extensions/TestCwd.java @@ -49,7 +49,18 @@ public void testCwd() { transformer.setInitialTemplate(new QName("", "main")); transformer.transform(); XdmValue value = result.getXdmValue(); - assertEquals(System.getProperty("user.dir") + "/", value.toString()); + + String expected = System.getProperty("user.dir"); + if (expected.startsWith("/")) { + expected = "file:" + expected; + } else { + expected = "file:/" + expected; + } + if (!expected.endsWith("/")) { + expected += "/"; + } + + assertEquals(expected, value.toString()); } catch (SaxonApiException sae) { sae.printStackTrace(); TestCase.fail();