Skip to content

Improvements to property history #1105

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

Merged
merged 2 commits into from
Apr 25, 2025
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
22 changes: 19 additions & 3 deletions UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -1702,9 +1702,12 @@ class PropertyAssignment {
VersionInfo first;
VersionInfo last;
ArrayList<String> values;
int span;
}
final boolean isMultivalued = getFactory().getProperty(propName).isMultivalued();
List<PropertyAssignment> history = new ArrayList<>();
int prehistoricSpan = 0;
int posthistoricSpan = 0;
if (getFactory().getProperty(propName)
instanceof IndexUnicodeProperties.IndexUnicodeProperty) {
for (int i = Utility.UNICODE_VERSIONS.size() - 1; i >= 0; --i) {
Expand All @@ -1724,9 +1727,12 @@ class PropertyAssignment {
final var property = IndexUnicodeProperties.make(version).getProperty(propName);
// Skip properties prior to their creation, as well as properties that no longer
// exist on the range minVersion..maxVersion.
if (property.isTrivial()
&& !property.getName().equals("ISO_Comment")
&& history.isEmpty()) {
if (property.isTrivial() && !property.getName().equals("ISO_Comment")) {
if (history.isEmpty()) {
++prehistoricSpan;
} else {
++posthistoricSpan;
}
continue;
}
ArrayList<String> values = new ArrayList<>();
Expand All @@ -1738,9 +1744,11 @@ class PropertyAssignment {
assignment.first = version;
assignment.last = version;
assignment.values = values;
assignment.span = 1;
history.add(assignment);
} else {
lastAssignment.last = version;
++lastAssignment.span;
}
}
} else {
Expand All @@ -1760,6 +1768,9 @@ class PropertyAssignment {
+ "'>"
+ (provisional ? "(" + propName + ")" : propName)
+ "</a></th>");
if (prehistoricSpan > 0) {
out.append("<td class='nonexistent' colspan=" + prehistoricSpan + "></td>");
}
for (PropertyAssignment assignment : history) {
String first =
assignment.first.getVersionString(2, 4)
Expand Down Expand Up @@ -1787,6 +1798,8 @@ class PropertyAssignment {
out.append(
"<td"
+ defaultClass
+ " colspan="
+ assignment.span
+ ">"
+ (isMultivalued || htmlValue.contains("<")
? "<span" + (isNew ? " class='changed'" : "") + ">"
Expand All @@ -1803,6 +1816,9 @@ class PropertyAssignment {
+ (isMultivalued || htmlValue.contains("<") ? "</span>" : "</a>")
+ "</td>");
}
if (posthistoricSpan > 0) {
out.append("<td class='nonexistent' colspan=" + posthistoricSpan + "></td>");
}
out.append("</tr>");
}
}
Expand Down
1 change: 1 addition & 0 deletions UnicodeJsps/src/main/webapp/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ h3 {background-color: #EEEEEE}
.L1 {background-color: #CCCCCC}
.L0 {background-color: #C8C8C8}
.default { background-color: #C8C8C8}
.nonexistent { background-color: #FFC8C8}
.control {
font-family: 'Last Resort'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,13 @@ private static void parsePropertyDumpFile(
}
continue;
}
if (line.trim().equals("Discrepancy B: UnicodeData but not Unilib")) {
// Unicode 2.1.8 includes a diff between Unilib properties used in 2.1.5 and 2.1.9
// and something resembling the derivations that would later be used in Unicode 3.1,
// but without the Other_* exceptions introduced in Unicode 3.1.
// We follow Unilib for continuity.
propInfo = null;
}
if (propInfo != null && dataLine.matcher(line).matches()) {
var range = new UcdLineParser.IntRange();
range.set(line.split(" ", 2)[0]);
Expand Down
Loading