Skip to content

Commit

Permalink
Merge pull request #4403 from dita-ot/hotfix/4.2.1
Browse files Browse the repository at this point in the history
Release 4.2.1
  • Loading branch information
jelovirt committed Mar 1, 2024
2 parents a530db7 + ca6551d commit ee4d6ac
Show file tree
Hide file tree
Showing 19 changed files with 283 additions and 58 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- "release/**"
- "hotfix/**"
jobs:
distribution:
if: ${{ github.repository == 'dita-ot/dita-ot' }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ jobs:
needs: dist
runs-on: ubuntu-latest
steps:
- name: Set tag name
run: |
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ apply plugin: 'signing'
group = 'org.dita-ot'
archivesBaseName = 'dost'
/** Semver version number */
version = '4.2.0'
version = '4.2.1'

description = """DITA Open Toolkit"""

Expand Down
41 changes: 26 additions & 15 deletions src/main/java/org/dita/dost/log/AbstractLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,24 @@ protected void log(final String msg, final Object[] args, final Throwable t, fin
}
StringBuilder buf = null;
if (!legacyFormat) {
if (useColor && level == Project.MSG_ERR) {
buf =
new StringBuilder()
.append(ANSI_RED)
.append(Main.locale.getString("error_msg").formatted(""))
.append(ANSI_RESET);
} else if (useColor && level == Project.MSG_WARN) {
buf =
new StringBuilder()
.append(ANSI_YELLOW)
.append(Main.locale.getString("warn_msg").formatted(""))
.append(ANSI_RESET);
if (level == Project.MSG_ERR) {
buf = new StringBuilder();
if (useColor) {
buf.append(ANSI_RED);
}
buf.append(Main.locale.getString("error_msg").formatted(""));
if (useColor) {
buf.append(ANSI_RESET);
}
} else if (level == Project.MSG_WARN) {
buf = new StringBuilder();
if (useColor) {
buf.append(ANSI_YELLOW);
}
buf.append(Main.locale.getString("warn_msg").formatted(""));
if (useColor) {
buf.append(ANSI_RESET);
}
}
}
if (args.length > 0) {
Expand Down Expand Up @@ -279,7 +285,10 @@ protected static String removeLevelPrefix(String msg) {
if (end == -1) {
return msg;
}
return msg.substring(0, start) + msg.substring(end);
return switch (msg.substring(start + 2, end)) {
case "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL" -> msg.substring(0, start) + msg.substring(end);
default -> msg;
};
}

protected static StringBuilder removeLevelPrefix(StringBuilder msg) {
Expand All @@ -291,8 +300,10 @@ protected static StringBuilder removeLevelPrefix(StringBuilder msg) {
if (end == -1) {
return msg;
}
msg.replace(start, end, "");
return msg;
return switch (msg.substring(start + 2, end)) {
case "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL" -> msg.replace(start, end, "");
default -> msg;
};
}

private static final Pattern ARGUMENT = Pattern.compile("\\{}|%s");
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/dita/dost/store/CacheStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ public ContentHandler getContentHandler(final URI outputFile) throws SaxonApiExc

final Destination dst = getDestination(outputFile);
final Receiver receiver = dst.getReceiver(pipelineConfiguration, new SerializationProperties());
try {
receiver.open();
} catch (XPathException e) {
throw new SaxonApiException("Failed to open receiver for %s".formatted(outputFile), e);
}

final ReceivingContentHandler receivingContentHandler = new ReceivingContentHandler();
receivingContentHandler.setPipelineConfiguration(pipelineConfiguration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ See the accompanying LICENSE file for applicable license.
<echo level="info">${log-prefix}input = ${args.input}</echo>
<echo level="info" if:set="args.resources">* resources = ${args.resources}</echo>
<echo level="info" if:true="${legacy-format}">*****************************************************************</echo>


<!-- TODO: change property initialization to not use physical files -->
<mkdir dir="${dita.temp.dir}"/>
<echoxml file="${dita.temp.dir}/.job.xml">
<job>
<property name="temp-file-name-scheme">
Expand Down
37 changes: 20 additions & 17 deletions src/main/plugins/org.dita.html5/xsl/get-meta.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ See the accompanying LICENSE file for applicable license.

<!-- Get each value in each <keywords>. Nested indexterms should have unique entries. Other
elements (based on keyword) cannot nest. -->
<!-- Deprecated since 4.2.1 -->
<xsl:key name="meta-keywords" match="*[ancestor::*[contains(@class,' topic/keywords ')]]" use="text()[1]"/>

<!-- Deprecated since 3.6 -->
Expand Down Expand Up @@ -244,24 +245,26 @@ See the accompanying LICENSE file for applicable license.
</xsl:template>

<!-- CONTENT: Subject - prolog/metadata/keywords -->
<xsl:template match="*" mode="gen-keywords-metadata">
<xsl:variable name="keywords-content">
<!-- for each item inside keywords (including nested index terms) -->
<xsl:for-each select="descendant::*[contains(@class,' topic/prolog ')]/*[contains(@class,' topic/metadata ')]/*[contains(@class,' topic/keywords ')]/descendant-or-self::* |
descendant::*[contains(@class,' map/topicmeta ')]/*[contains(@class,' topic/keywords ')]/descendant-or-self::* |
descendant::*[contains(@class,' map/topicmeta ')]/*[contains(@class,' topic/metadata ')]/*[contains(@class,' topic/keywords ')]/descendant-or-self::*">
<!-- If this is the first term or keyword with this value -->
<xsl:if test="generate-id(key('meta-keywords',text()[1])[1]) = generate-id(.)">
<xsl:if test="position() > 2">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="normalize-space(text()[1])"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:template match="*[contains(@class, ' topic/topic ')]" mode="gen-keywords-metadata">
<xsl:variable name="keywords" as="element()*"
select="descendant::*[contains(@class,' topic/prolog ')]/
*[contains(@class,' topic/metadata ')]/
*[contains(@class,' topic/keywords ')]/
*[contains(@class,' topic/keyword ')][normalize-space()]"/>
<xsl:if test="exists($keywords)">
<meta name="keywords" content="{string-join(distinct-values($keywords/normalize-space()), ', ')}"/>
</xsl:if>
</xsl:template>

<xsl:if test="string-length($keywords-content) > 0">
<meta name="keywords" content="{$keywords-content}"/>
<xsl:template match="*[contains(@class, ' map/map ')]" mode="gen-keywords-metadata">
<xsl:variable name="topicmeta" as="element()*"
select="*[contains(@class,' map/topicmeta ')]"/>
<xsl:variable name="keywords" as="element()*"
select="($topicmeta | $topicmeta/*[contains(@class,' topic/metadata ')])/
*[contains(@class,' topic/keywords ')]/
*[contains(@class,' topic/keyword ')][normalize-space()]"/>
<xsl:if test="exists($keywords)">
<meta name="keywords" content="{string-join(distinct-values($keywords/normalize-space()), ', ')}"/>
</xsl:if>
</xsl:template>

Expand Down
5 changes: 4 additions & 1 deletion src/test/java/org/dita/dost/log/AbstractLoggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ static List<Arguments> removeLevelPrefix() {
return List.of(
Arguments.of("[DOTJ037W][INFO] Message", "[DOTJ037W] Message"),
Arguments.of("[DOTJ037W][INFO]: Message", "[DOTJ037W]: Message"),
Arguments.of("[DOTJ037W] Message", "[DOTJ037W] Message")
Arguments.of("[DOTJ037W] Message", "[DOTJ037W] Message"),
Arguments.of("[DOTJ037W][Warning]: Message", "[DOTJ037W][Warning]: Message"),
Arguments.of("[WARN][DOTJ037W]: Message", "[WARN][DOTJ037W]: Message"),
Arguments.of("[WARN] Message", "[WARN] Message")
);
}

Expand Down
18 changes: 15 additions & 3 deletions src/test/resources/html5/exp/html5/concept.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@
<meta charset="UTF-8">
<meta name="copyright" content="(C) Copyright 2024">
<meta name="generator" content="DITA-OT">
<meta content="topicref concept, concept, nested concept" name="keywords" />
<title>Concept</title>
<link rel="stylesheet" type="text/css" href="commonltr.css">
<link href="commonltr.css" rel="stylesheet" type="text/css" />
</head>
<body id="concept">
<main role="main">
<article role="article" aria-labelledby="ariaid-title1">
<article aria-labelledby="ariaid-title1" role="article">
<h1 class="title topictitle1" id="ariaid-title1">Concept</h1>
<div class="body conbody">
<p class="p">Body.</p>
</div>
<nav class="related-links" role="navigation">
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="topic.html">Topic</a></div>
</div>
</nav>
<article aria-labelledby="ariaid-title2" class="topic concept nested1" id="nested-concept">
<h2 class="title topictitle2" id="ariaid-title2">Nested Concept</h2>
<div class="body conbody">
<p class="p">Body.</p>
</div>
</article>
</article>
</main>
</body>
</html>
</html>
15 changes: 9 additions & 6 deletions src/test/resources/html5/exp/html5/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
<meta charset="UTF-8">
<meta name="copyright" content="(C) Copyright 2024">
<meta name="generator" content="DITA-OT">
<meta content="metadata, topicmeta" name="keywords" />
<title>Map</title>
<link rel="stylesheet" type="text/css" href="commonltr.css">
<link href="commonltr.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 class="title topictitle1">Map</h1>
<nav>
<ul class="map">
<li class="topicref"><a href="topic.html">Topic</a></li>
<li class="topicref"><a href="concept.html">Concept</a></li>
<li class="topicref"><a href="task.html">Task</a></li>
<li class="topicref"><a href="reference.html">Reference</a></li>
<li class="topicref"><a href="topic.html">Topic</a><ul>
<li class="topicref"><a href="concept.html">Concept</a></li>
<li class="topicref"><a href="task.html">Task</a></li>
<li class="topicref"><a href="reference.html">Reference</a></li>
</ul>
</li>
</ul>
</nav>
</body>
</html>
</html>
24 changes: 20 additions & 4 deletions src/test/resources/html5/exp/html5/reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@
<meta charset="UTF-8">
<meta name="copyright" content="(C) Copyright 2024">
<meta name="generator" content="DITA-OT">
<meta content="topicref reference, reference, nested reference" name="keywords" />
<title>Reference</title>
<link rel="stylesheet" type="text/css" href="commonltr.css">
<link href="commonltr.css" rel="stylesheet" type="text/css" />
</head>
<body id="reference">
<main role="main">
<article role="article" aria-labelledby="ariaid-title1">
<article aria-labelledby="ariaid-title1" role="article">
<h1 class="title topictitle1" id="ariaid-title1">Reference</h1>
<div class="body refbody">
<section class="section"><h2 class="title sectiontitle">Section title</h2>
<section class="section">
<h2 class="title sectiontitle">Section title</h2>
<p class="p">Body.</p>
</section>
</div>
<nav class="related-links" role="navigation">
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="topic.html">Topic</a></div>
</div>
</nav>
<article aria-labelledby="ariaid-title2" class="topic reference nested1" id="nested-reference">
<h2 class="title topictitle2" id="ariaid-title2">Nested Reference</h2>
<div class="body refbody">
<section class="section">
<h3 class="title sectiontitle">Section title</h3>
<p class="p">Body.</p>
</section>
</div>
</article>
</article>
</main>
</body>
</html>
</html>
34 changes: 31 additions & 3 deletions src/test/resources/html5/exp/html5/task.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
<head>
<meta charset="UTF-8">
<meta name="copyright" content="(C) Copyright 2024">
<meta name="generator" content="DITA-OT">
<meta content="DITA-OT" name="generator">
<meta content="topicref task, task, nested task" name="keywords">
<title>Task</title>
<link rel="stylesheet" type="text/css" href="commonltr.css">
<link href="commonltr.css" rel="stylesheet" type="text/css">
</head>
<body id="task">
<main role="main">
Expand All @@ -30,7 +31,34 @@ <h2 class="sectiontitle tasklabel">Procedure</h2>
</div>
</section>
</div>

<nav class="related-links" role="navigation">
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="topic.html">Topic</a></div>
</div>
</nav>
<article aria-labelledby="ariaid-title2" class="topic task nested1" id="nested-task">
<h2 class="title topictitle2" id="ariaid-title2">Nested Task</h2>
<div class="body taskbody">
<section class="section context">
<div class="tasklabel">
<h3 class="sectiontitle tasklabel">About this task</h3>
</div>
<p class="p">Context.</p>
</section>
<section>
<div class="tasklabel">
<h3 class="sectiontitle tasklabel">Procedure</h3>
</div>
<div class="ol steps">
<div class="li step p">
<span class="ph cmd">Command.</span>
</div>
</div>
</section>
</div>
</article>
</article>
</main>
</body>
</html>
</html>
18 changes: 16 additions & 2 deletions src/test/resources/html5/exp/html5/topic.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,30 @@
<meta charset="UTF-8">
<meta name="copyright" content="(C) Copyright 2024">
<meta name="generator" content="DITA-OT">
<meta content="topicref topic, topic, nested topic" name="keywords" />
<title>Topic</title>
<link rel="stylesheet" type="text/css" href="commonltr.css">
<link href="commonltr.css" rel="stylesheet" type="text/css" />
</head>
<body id="topic">
<main role="main">
<article role="article" aria-labelledby="ariaid-title1">
<article aria-labelledby="ariaid-title1" role="article">
<h1 class="title topictitle1" id="ariaid-title1">Topic</h1>
<div class="body">
<p class="p">Body.</p>
</div>
<nav class="related-links" role="navigation">
<ul class="ullinks">
<li class="link ulchildlink"><strong><a href="concept.html">Concept</a></strong><br /></li>
<li class="link ulchildlink"><strong><a href="task.html">Task</a></strong><br /></li>
<li class="link ulchildlink"><strong><a href="reference.html">Reference</a></strong><br /></li>
</ul>
</nav>
<article aria-labelledby="ariaid-title2" class="topic nested1" id="nested-topic">
<h2 class="title topictitle2" id="ariaid-title2">Nested Topic</h2>
<div class="body">
<p class="p">Body.</p>
</div>
</article>
</article>
</main>
</body>
Expand Down
20 changes: 20 additions & 0 deletions src/test/resources/html5/src/concept.dita
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,27 @@
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="concept">
<title>Concept</title>
<prolog>
<metadata>
<keywords>
<keyword>concept</keyword>
</keywords>
</metadata>
</prolog>
<conbody>
<p>Body.</p>
</conbody>
<concept id="nested-concept">
<title>Nested Concept</title>
<prolog>
<metadata>
<keywords>
<keyword>nested concept</keyword>
</keywords>
</metadata>
</prolog>
<conbody>
<p>Body.</p>
</conbody>
</concept>
</concept>

0 comments on commit ee4d6ac

Please sign in to comment.