Skip to content

Commit

Permalink
Merge pull request docbook#71 from ndw/master
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
ndw committed Sep 17, 2015
2 parents 5b6c88b + ed65e61 commit c1b89c3
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 38 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ task runtests(type: JavaExec) {
task testreport(dependsOn: runtests, type: JavaExec) {
classpath = configurations.runtime

inputs.file fileTree(dir: testsRoot + "/style/").include("report.xpl")
inputs.file fileTree(dir: testsRoot + "/result/")
outputs.file fileTree(dir: testsRoot).include("index.html")
inputs.file file(testsRoot + "/style/report.xpl")
inputs.dir testsRoot + "/result/"
outputs.file file(testsRoot + "/index.html")

//systemProperty "log4j.configurationFile", "/home/ndw/java/log4j2-debug.xml"

Expand Down Expand Up @@ -335,8 +335,8 @@ task copyEtc(type: Copy) {
}

task copyResources(type: Copy) {
FileTree tree = fileTree(dir: 'resources',
exclude: ['src/**'])
FileTree tree = fileTree(dir: 'resources', exclude: ['src/**',
'**/*_flymake.css'])
from tree
into "build/dist/bin/resources/"
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.0.14
version=2.0.15
snapshot=
builtBy=Norman Walsh
baseline=0
Expand Down
32 changes: 17 additions & 15 deletions src/main/java/org/docbook/DocBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,24 +196,26 @@ public void run(String sourcefn) throws IOException, SaxonApiException {
pipeline.run();

XdmNode result = pipeline.readFrom("result").read();
Serialization serial = pipeline.getSerialization("result");
if (result != null) {
Serialization serial = pipeline.getSerialization("result");

if (serial == null) {
serial = new Serialization(runtime, pipeline.getNode()); // The node's a hack
serial.setMethod(new QName("", "xhtml"));
}
if (serial == null) {
serial = new Serialization(runtime, pipeline.getNode()); // The node's a hack
serial.setMethod(new QName("", "xhtml"));
}

WritableDocument wd = null;
if (options.containsKey(_output)) {
String filename = options.get(_output).getStringValue().asString();
FileOutputStream outfile = new FileOutputStream(filename);
wd = new WritableDocument(runtime, filename, serial, outfile);
logger.info("Writing output to " + filename);
} else {
wd = new WritableDocument(runtime, null, serial);
}
WritableDocument wd = null;
if (options.containsKey(_output)) {
String filename = options.get(_output).getStringValue().asString();
FileOutputStream outfile = new FileOutputStream(filename);
wd = new WritableDocument(runtime, filename, serial, outfile);
logger.info("Writing output to " + filename);
} else {
wd = new WritableDocument(runtime, null, serial);
}

wd.write(result);
wd.write(result);
}
}

public String version() {
Expand Down
45 changes: 29 additions & 16 deletions xslt/base/html/xref.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,40 @@ identified.</entry>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:when test="not(f:findid(@linkend,.))">
<xsl:when test="@linkend">
<xsl:choose>
<xsl:when test="not(f:findid(@linkend,.))">
<xsl:message>
<xsl:text>Attempt to link to undefined ID: </xsl:text>
<xsl:value-of select="@linkend"/>
</xsl:message>
<span class="markup-error">
<xsl:sequence select="f:html-attributes(., @xml:id, ())"/>
<xsl:text>@@LINKEND: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:text>@@</xsl:text>
</span>
</xsl:when>
<xsl:otherwise>
<a href="{f:href(., f:findid(@linkend,.))}">
<xsl:sequence select="f:html-attributes(.)"/>
<xsl:if test="$title != ''">
<xsl:attribute name="title" select="$title"/>
</xsl:if>
<xsl:apply-templates/>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Attempt to link to undefined ID: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:text>Link element with no target?</xsl:text>
</xsl:message>
<span class="markup-error">
<xsl:sequence select="f:html-attributes(., @xml:id, ())"/>
<xsl:text>@@LINKEND: </xsl:text>
<xsl:value-of select="@linkend"/>
<xsl:text>@@</xsl:text>
<xsl:text>@@NO TARGET@@</xsl:text>
</span>
</xsl:when>
<xsl:otherwise>
<a href="{f:href(., f:findid(@linkend,.))}">
<xsl:sequence select="f:html-attributes(.)"/>
<xsl:if test="$title != ''">
<xsl:attribute name="title" select="$title"/>
</xsl:if>
<xsl:apply-templates/>
</a>
</xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
Expand Down
2 changes: 1 addition & 1 deletion xslt/params/resource.root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<refsynopsisdiv>
<src:fragment xml:id='resource.root.frag'>
<xsl:param name="resource.root"
select="concat('http://docbook.github.com/release/',$VERSION,'/')"/>
select="concat('https://docbook.github.io/release/',$VERSION,'/resources/')"/>
</src:fragment>
</refsynopsisdiv>

Expand Down

0 comments on commit c1b89c3

Please sign in to comment.