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

Add hover text and explanation of red/blue text #178

Merged
merged 1 commit into from
Dec 29, 2023
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
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
Loading