Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #148

Merged
merged 3 commits into from
Jul 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
echo "Running with system JDK"
else
curl -o /tmp/jdk.tar.gz $JDK
cd /tmp && tar zxf jdk-8u333-linux-x64.tar.gz
cd /tmp && tar zxf jdk.tar.gz
echo "Running with JDK 8"
fi

Expand Down
17 changes: 15 additions & 2 deletions src/bin/docbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,22 @@ def compute_dependencies(self):
or artifact not in self.depends[group] \
or version not in self.depends[group][artifact] \
or self.depends[group][artifact][version] is None:
print(f"Required package not found: {group}:{artifact}:{version}; download with Maven")
found = False
found = self._libfallback(package);

if not found:
sys.exit(1)

def _libfallback(self, package):
# This is pretty crude. But as issue #144 pointed out, I'm building
# a release that includes the libs. That means for jars that are
# in the release, it doesn't actually matter if we don't find them.
group, artifact, version = package.split(":")
localpath = self.root + "/libs/lib/" + artifact + "-" + version + ".jar"
if os.path.exists(localpath):
return True
print(f"Required package not found: {group}:{artifact}:{version}; download with Maven")
return False

def _higher_version(self, curver, newver):
if curver == newver:
return False
Expand Down Expand Up @@ -461,6 +471,9 @@ def _add_to_classpath(self, package):
curver = list(self._cp[group][artifact].keys())[0]
if self._higher_version(curver, version):
usever = version
# Actually remove the current version, we're replacing it.
del self._cp[group][artifact][curver];
del self.depends[group][artifact][curver];
else:
usever = curver

Expand Down
5 changes: 4 additions & 1 deletion src/main/xslt/modules/functions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@
<xsl:sequence select="1"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="plist" select="$list/preceding::db:orderedlist[1]"/>
<xsl:variable name="plist"
select="$list/preceding::db:orderedlist
[not(ancestor::db:orderedlist)][1]"/>

<xsl:sequence select="f:orderedlist-startingnumber($plist)
+ count($plist/db:listitem)"/>
</xsl:otherwise>
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/expected/orderedlist.004.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" class="no-js"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script><title>Article wrapper</title><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link href="https://purl.org/dc/elements/1.1/" rel="schema.dc"/><meta name="dc.modified" content="2022-07-02T12:14:33Z"/><meta name="generator" content="DocBook xslTNG version 1.7.0-11 / 72cb9caf / SAXON HE 11.3"/><link href="./css/docbook.css" rel="stylesheet"/><link href="./css/docbook-screen.css" rel="stylesheet"/></head><body class="home"><nav class="top"></nav><main><article class="article"><header><h1>Article wrapper</h1></header><p>An ordered list with a continuation. From
<a href="https://github.com/docbook/xslTNG/issues/145" class="link">issue #145</a>.
</p><ol class="orderedlist" type="1"><li><p>First Item</p></li><li><p>Second Item</p><ol class="orderedlist" type="a"><li><p>Sub-Item a</p></li></ol></li><li><p>Third Item</p></li></ol><p class="simpara">Some text.</p><ol class="orderedlist" start="4" type="1"><li><p>Fourth Item</p></li></ol></article></main><nav class="bottom"></nav></body></html>
33 changes: 33 additions & 0 deletions src/test/resources/xml/orderedlist.004.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.1">
<title>Article wrapper</title>

<para>An ordered list with a continuation. From
<link xlink:href="https://github.com/docbook/xslTNG/issues/145">issue #145</link>.
</para>

<orderedlist>
<listitem>
<para>First Item</para>
</listitem>
<listitem>
<para>Second Item</para>
<orderedlist numeration="loweralpha">
<listitem>
<para>Sub-Item a</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Third Item</para>
</listitem>
</orderedlist>
<simpara>Some text.</simpara>
<orderedlist continuation="continues">
<listitem>
<para>Fourth Item</para>
</listitem>
</orderedlist>
</article>