Skip to content
Snippets Groups Projects
Commit b01614a3 authored by Goik Martin's avatar Goik Martin
Browse files

javaapi:// referencing

parent 581a16be
No related branches found
No related tags found
No related merge requests found
...@@ -178,8 +178,8 @@ ...@@ -178,8 +178,8 @@
<listitem> <listitem>
<para>Referencing <link <para>Referencing <link
xlink:href="javaapi://java.util.String">List</link> by Java xlink:href="javaapi://java.util.List">List</link> by Java package
package syntax</para> syntax</para>
</listitem> </listitem>
<listitem> <listitem>
...@@ -187,6 +187,13 @@ ...@@ -187,6 +187,13 @@
xlink:href="javaapi://java.lang.String">String</link> reference xlink:href="javaapi://java.lang.String">String</link> reference
for <package>java.lang</package> default package</para> for <package>java.lang</package> default package</para>
</listitem> </listitem>
<listitem>
<para><link
xlink:href="javaapi://java.lang.String#join(java.lang.CharSequence,java.lang.Iterable)">String.join</link>
method reference for <package>java.lang</package> default
package</para>
</listitem>
</itemizedlist> </itemizedlist>
</figure> </figure>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook"
xmlns="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook"> xmlns:db="http://docbook.org/ns/docbook">
<xsl:include href="common.xsl"/> <xsl:include href="common.xsl"/>
<xsl:param name="javaApiBaseUrl"
>https://docs.oracle.com/en/java/javase/21/docs/api/java.base</xsl:param>
<xsl:param name="generateIdPrefix">__sdwordm4342cs__</xsl:param> <xsl:param name="generateIdPrefix">__sdwordm4342cs__</xsl:param>
<xsl:param name="nl"> <xsl:param name="nl">
<xsl:text> <xsl:text>
...@@ -13,7 +16,7 @@ ...@@ -13,7 +16,7 @@
</xsl:param> </xsl:param>
<xsl:output indent="no"/> <xsl:output indent="no"/>
<xsl:param name="lastAnswerId" select="document('lastAnswerId.xml',/)/lastAnswer/@id" /> <xsl:param name="lastAnswerId" select="document('lastAnswerId.xml', /)/lastAnswer/@id"/>
<!-- Excluding glossary self references --> <!-- Excluding glossary self references -->
<xsl:key name="internRef" match="//*[@linkend and not(ancestor::db:glossary)]" use="@linkend"/> <xsl:key name="internRef" match="//*[@linkend and not(ancestor::db:glossary)]" use="@linkend"/>
...@@ -55,28 +58,76 @@ ...@@ -55,28 +58,76 @@
<xsl:template match="node() | @*"> <xsl:template match="node() | @*">
<xsl:copy> <xsl:copy>
<xsl:apply-templates select="node()| @*"/> <xsl:apply-templates select="node() | @*"/>
</xsl:copy> </xsl:copy>
</xsl:template> </xsl:template>
<xsl:template match="@db:href"> <xsl:template match="@xlink:href">
<xsl:choose> <xsl:attribute name="xlink:href">
<xsl:when test="starts-with(., 'javaapi://')">
<xsl:variable name="javaClassReference" select="substring-after(., 'javaapi://')"/> <xsl:choose>
<xsl:text>https://docs.oracle.com/en/java/javase/17/docs/api/java.base/</xsl:text> <xsl:when test="starts-with(., 'javaapi://')">
<xsl:variable name="javaUrl">
<xsl:value-of select="substring-after(., 'javaapi://')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($javaUrl, '#')">
<xsl:call-template name="javaApiClassname2htmlReference">
<xsl:with-param name="javaApiClassname" select="substring-before($javaUrl, '#')"/>
</xsl:call-template>
<xsl:text>#</xsl:text>
<xsl:message>
<xsl:value-of select="substring-after($javaUrl, '#')"/>
</xsl:message>
<xsl:call-template name="javaApiArgs2htmlReference">
<xsl:with-param name="javaArguments" select="substring-after($javaUrl, '#')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="javaApiClassname2htmlReference">
<xsl:with-param name="javaApiClassname" select="$javaUrl"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:value-of select="$javaClassReference"/> <xsl:otherwise>
<xsl:attribute name="xlink:href" select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
<xsl:template name="javaApiArgs2htmlReference">
<xsl:param name="javaArguments"/>
<xsl:value-of select="$javaArguments"/>
</xsl:template>
<xsl:template name="javaApiClassname2htmlReference">
<xsl:param name="javaApiClassname"/>
<xsl:value-of select="$javaApiBaseUrl"/>
<xsl:choose>
<xsl:when test="contains($javaApiClassname, '.')">
<xsl:text>/</xsl:text>
<xsl:value-of select="replace($javaApiClassname, '\.', '/')"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<text>otherwise</text> <xsl:text>/java/lang/</xsl:text>
<xsl:value-of select="."/> <xsl:value-of select="$javaApiClassname"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:text>.html</xsl:text>
</xsl:template> </xsl:template>
<xsl:template match="*" mode="hdmIdGenerate"> <xsl:template match="*" mode="hdmIdGenerate">
<xsl:choose> <xsl:choose>
<xsl:when test="@xml:id"> <xsl:when test="@xml:id">
...@@ -90,7 +141,7 @@ ...@@ -90,7 +141,7 @@
</xsl:template> </xsl:template>
<!-- Providing list of exercises --> <!-- Providing list of exercises -->
<xsl:template match="db:book[not(db:part)]|db:part"> <xsl:template match="db:book[not(db:part)] | db:part">
<xsl:copy> <xsl:copy>
<xsl:apply-templates select="@* | node()"/> <xsl:apply-templates select="@* | node()"/>
<xsl:if test=".//db:qandaset"> <xsl:if test=".//db:qandaset">
...@@ -101,13 +152,13 @@ ...@@ -101,13 +152,13 @@
<caption> <caption>
<xsl:text>Exercises in </xsl:text> <xsl:text>Exercises in </xsl:text>
<emphasis> <emphasis>
<xsl:value-of select="ancestor-or-self::db:part/db:title" /> <xsl:value-of select="ancestor-or-self::db:part/db:title"/>
</emphasis> </emphasis>
</caption> </caption>
<col width="25%" /> <col width="25%"/>
<col width="2%" /> <col width="2%"/>
<col width="45%" /> <col width="45%"/>
<col width="28%" /> <col width="28%"/>
<tr> <tr>
<th rowspan="2">Chapter</th> <th rowspan="2">Chapter</th>
<th colspan="3">Exercise</th> <th colspan="3">Exercise</th>
...@@ -121,7 +172,8 @@ ...@@ -121,7 +172,8 @@
<xsl:for-each-group select=".//db:qandaset" group-by="ancestor::db:chapter/@xml:id"> <xsl:for-each-group select=".//db:qandaset" group-by="ancestor::db:chapter/@xml:id">
<xsl:for-each select="current-group()"> <xsl:for-each select="current-group()">
<tr> <tr>
<xsl:if test="1 = position()"> <!-- Group's key entry only present in first row --> <xsl:if test="1 = position()">
<!-- Group's key entry only present in first row -->
<td valign="top" rowspan="{count(current-group())}"> <td valign="top" rowspan="{count(current-group())}">
<xref linkend="{current-grouping-key()}"/> <xref linkend="{current-grouping-key()}"/>
</td> </td>
...@@ -132,7 +184,8 @@ ...@@ -132,7 +184,8 @@
<td> <td>
<xsl:apply-templates select="." mode="selectOwnOrInheritedTitle"/> <xsl:apply-templates select="." mode="selectOwnOrInheritedTitle"/>
</td> </td>
<td/> <!-- empty status of completion --> <td/>
<!-- empty status of completion -->
</tr> </tr>
</xsl:for-each> </xsl:for-each>
...@@ -149,7 +202,8 @@ ...@@ -149,7 +202,8 @@
<xsl:template match="db:qandaset" mode="qandaNumber"> <xsl:template match="db:qandaset" mode="qandaNumber">
<xsl:variable name="parentId" select="ancestor::db:part/@xml:id"/> <xsl:variable name="parentId" select="ancestor::db:part/@xml:id"/>
<xsl:value-of select="count(preceding::db:qandaset[ancestor::db:part/@xml:id = $parentId]) + 1"/> <xsl:value-of select="count(preceding::db:qandaset[ancestor::db:part/@xml:id = $parentId]) + 1"
/>
</xsl:template> </xsl:template>
<xsl:template match="db:chapter" mode="genQuandaset"> <xsl:template match="db:chapter" mode="genQuandaset">
...@@ -157,8 +211,8 @@ ...@@ -157,8 +211,8 @@
<title> <title>
<xsl:text>Exercises in </xsl:text> <xsl:text>Exercises in </xsl:text>
<emphasis> <emphasis>
<xsl:for-each select="db:title" > <xsl:for-each select="db:title">
<xsl:copy-of select="node()|text()"/> <xsl:copy-of select="node() | text()"/>
</xsl:for-each> </xsl:for-each>
</emphasis> </emphasis>
</title> </title>
...@@ -206,7 +260,8 @@ ...@@ -206,7 +260,8 @@
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="db:glossary/db:glosslist//db:glossentry[not(key('internRef', @xml:id)) and not(key('internRef', .//*/@xml:id))]"> <xsl:template
match="db:glossary/db:glosslist//db:glossentry[not(key('internRef', @xml:id)) and not(key('internRef', .//*/@xml:id))]">
<xsl:comment> <xsl:comment>
<xsl:text>Excluding non referenced glossary entry '</xsl:text> <xsl:text>Excluding non referenced glossary entry '</xsl:text>
<xsl:value-of select="db:glossterm"/> <xsl:value-of select="db:glossterm"/>
...@@ -232,17 +287,18 @@ ...@@ -232,17 +287,18 @@
--> -->
<!-- make annotations --> <!-- make annotations -->
<xsl:template match="db:annotation[@role='make']"> <xsl:template match="db:annotation[@role = 'make']">
<xsl:apply-templates select="*" mode="make"/> <xsl:apply-templates select="*" mode="make"/>
</xsl:template> </xsl:template>
<xsl:template match="db:para[@role='eclipse']" mode='make'> <xsl:template match="db:para[@role = 'eclipse']" mode="make">
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
<xsl:text>Maven module source code available at </xsl:text> <xsl:text>Maven module source code available at </xsl:text>
<filename xlink:href="https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures/tree/master/{.}"> <filename
xlink:href="https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures/tree/master/{.}">
<xsl:value-of select="."/> <xsl:value-of select="."/>
</filename> </filename>
<xsl:text>.</xsl:text> <xsl:text>.</xsl:text>
...@@ -252,7 +308,9 @@ ...@@ -252,7 +308,9 @@
<listitem> <listitem>
<para> <para>
<xsl:text>See </xsl:text> <xsl:text>See </xsl:text>
<link xlink:href="https://www.jetbrains.com/help/idea/maven-support.html#maven_import_project_start"> hints regarding import</link> <link
xlink:href="https://www.jetbrains.com/help/idea/maven-support.html#maven_import_project_start"
> hints regarding import</link>
<xsl:text>.</xsl:text> <xsl:text>.</xsl:text>
</para> </para>
</listitem> </listitem>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment