Skip to content

Commit

Permalink
Merge pull request #178 from spdx/issue165
Browse files Browse the repository at this point in the history
Add hover text and explanation of red/blue text
  • Loading branch information
goneall authored Dec 29, 2023
2 parents e98bf23 + 5d35ce8 commit f9298f0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
14 changes: 13 additions & 1 deletion resources/htmlTemplate/ExceptionHTMLTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,19 @@ <h2 id="notes">Notes</h2>
<p style="margin-left: 20px;">{{notes}}</p>

<h2 id="licenseExceptionText">Text</h2>


<blockquote cite="https://spdx.github.io/spdx-spec/v2.3/license-matching-guidelines-and-templates/">
<div style="border: 2px solid grey; padding: 8px">
Text in italicized blue is omittable (see <a href="https://spdx.github.io/spdx-spec/v2.3/license-matching-guidelines-and-templates/#b35-guideline-omittable-text">Matching Guidelines B.3.5</a>).
License or exception text will match to the text for the specified identifier if it either includes or excludes this omittable text.
<br/>
<br/>
Text in red is replaceable (see <a href="https://spdx.github.io/spdx-spec/v2.3/license-matching-guidelines-and-templates/#b34-guideline-replaceable-text">Matching Guidelines B.3.4</a>).
License or exception text will match to the text for the specified identifier if it includes a permitted variant of this replaceable text.
The permitted variants can be found in the corresponding regular expression as shown in title text visible by hovering over the red text.
</div>
</blockquote>

<div property="spdx:licenseExceptionText" class="exception-text">
{{&text}}
</div>
Expand Down
12 changes: 12 additions & 0 deletions resources/htmlTemplate/LicenseHTMLTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ <h2 id="notes">Notes</h2>
<p style="margin-left: 20px;">{{notes}}{{^notes}}None{{/notes}}</p>

<h2 id="licenseText">Text</h2>

<blockquote cite="https://spdx.github.io/spdx-spec/v2.3/license-matching-guidelines-and-templates/">
<div style="border: 2px solid grey; padding: 8px">
Text in italicized blue is omittable (see <a href="https://spdx.github.io/spdx-spec/v2.3/license-matching-guidelines-and-templates/#b35-guideline-omittable-text">Matching Guidelines B.3.5</a>).
License or exception text will match to the text for the specified identifier if it either includes or excludes this omittable text.
<br/>
<br/>
Text in red is replaceable (see <a href="https://spdx.github.io/spdx-spec/v2.3/license-matching-guidelines-and-templates/#b34-guideline-replaceable-text">Matching Guidelines B.3.4</a>).
License or exception text will match to the text for the specified identifier if it includes a permitted variant of this replaceable text.
The permitted variants can be found in the corresponding regular expression as shown in title text visible by hovering over the red text.
</div>
</blockquote>

<div property="spdx:licenseText" class="license-text">
{{&licenseText}}
Expand Down
3 changes: 3 additions & 0 deletions src/org/spdx/licensexml/LicenseXmlHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ private static boolean appendAltText(Element element, String altName, String mat
sb.append("<var class=\"");
}
sb.append(HtmlTemplateOutputHandler.REPLACEABLE_LICENSE_TEXT_CLASS);
sb.append("\"><span title=\"can be replaced with the pattern ");
sb.append(match);
sb.append("\">");
if (sb.length() > 0 && !Character.isWhitespace(sb.charAt(sb.length()-1)) &&
!noSpace && (SPACING_BOTH.equals(spacing) || SPACING_BEFORE.equals(spacing) || SPACING_DEFAULT.equals(spacing))) {
Expand All @@ -474,6 +476,7 @@ private static boolean appendAltText(Element element, String altName, String mat
if (SPACING_BOTH.equals(spacing) || SPACING_AFTER.equals(spacing)) {
sb.append(' ');
}
sb.append("</span>");
if (includesFlowControl(element)) {
sb.append("</div>");
} else {
Expand Down

0 comments on commit f9298f0

Please sign in to comment.