Skip to content

Commit 6520922

Browse files
authored
Improvements to property history (#1105)
* Align history columns * We like Unilib
1 parent dfea3ca commit 6520922

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,9 +1702,12 @@ class PropertyAssignment {
17021702
VersionInfo first;
17031703
VersionInfo last;
17041704
ArrayList<String> values;
1705+
int span;
17051706
}
17061707
final boolean isMultivalued = getFactory().getProperty(propName).isMultivalued();
17071708
List<PropertyAssignment> history = new ArrayList<>();
1709+
int prehistoricSpan = 0;
1710+
int posthistoricSpan = 0;
17081711
if (getFactory().getProperty(propName)
17091712
instanceof IndexUnicodeProperties.IndexUnicodeProperty) {
17101713
for (int i = Utility.UNICODE_VERSIONS.size() - 1; i >= 0; --i) {
@@ -1724,9 +1727,12 @@ class PropertyAssignment {
17241727
final var property = IndexUnicodeProperties.make(version).getProperty(propName);
17251728
// Skip properties prior to their creation, as well as properties that no longer
17261729
// exist on the range minVersion..maxVersion.
1727-
if (property.isTrivial()
1728-
&& !property.getName().equals("ISO_Comment")
1729-
&& history.isEmpty()) {
1730+
if (property.isTrivial() && !property.getName().equals("ISO_Comment")) {
1731+
if (history.isEmpty()) {
1732+
++prehistoricSpan;
1733+
} else {
1734+
++posthistoricSpan;
1735+
}
17301736
continue;
17311737
}
17321738
ArrayList<String> values = new ArrayList<>();
@@ -1738,9 +1744,11 @@ class PropertyAssignment {
17381744
assignment.first = version;
17391745
assignment.last = version;
17401746
assignment.values = values;
1747+
assignment.span = 1;
17411748
history.add(assignment);
17421749
} else {
17431750
lastAssignment.last = version;
1751+
++lastAssignment.span;
17441752
}
17451753
}
17461754
} else {
@@ -1760,6 +1768,9 @@ class PropertyAssignment {
17601768
+ "'>"
17611769
+ (provisional ? "(" + propName + ")" : propName)
17621770
+ "</a></th>");
1771+
if (prehistoricSpan > 0) {
1772+
out.append("<td class='nonexistent' colspan=" + prehistoricSpan + "></td>");
1773+
}
17631774
for (PropertyAssignment assignment : history) {
17641775
String first =
17651776
assignment.first.getVersionString(2, 4)
@@ -1787,6 +1798,8 @@ class PropertyAssignment {
17871798
out.append(
17881799
"<td"
17891800
+ defaultClass
1801+
+ " colspan="
1802+
+ assignment.span
17901803
+ ">"
17911804
+ (isMultivalued || htmlValue.contains("<")
17921805
? "<span" + (isNew ? " class='changed'" : "") + ">"
@@ -1803,6 +1816,9 @@ class PropertyAssignment {
18031816
+ (isMultivalued || htmlValue.contains("<") ? "</span>" : "</a>")
18041817
+ "</td>");
18051818
}
1819+
if (posthistoricSpan > 0) {
1820+
out.append("<td class='nonexistent' colspan=" + posthistoricSpan + "></td>");
1821+
}
18061822
out.append("</tr>");
18071823
}
18081824
}

UnicodeJsps/src/main/webapp/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ h3 {background-color: #EEEEEE}
3131
.L1 {background-color: #CCCCCC}
3232
.L0 {background-color: #C8C8C8}
3333
.default { background-color: #C8C8C8}
34+
.nonexistent { background-color: #FFC8C8}
3435
.control {
3536
font-family: 'Last Resort'
3637
}

unicodetools/src/main/java/org/unicode/props/PropertyParsingInfo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,13 @@ private static void parsePropertyDumpFile(
800800
}
801801
continue;
802802
}
803+
if (line.trim().equals("Discrepancy B: UnicodeData but not Unilib")) {
804+
// Unicode 2.1.8 includes a diff between Unilib properties used in 2.1.5 and 2.1.9
805+
// and something resembling the derivations that would later be used in Unicode 3.1,
806+
// but without the Other_* exceptions introduced in Unicode 3.1.
807+
// We follow Unilib for continuity.
808+
propInfo = null;
809+
}
803810
if (propInfo != null && dataLine.matcher(line).matches()) {
804811
var range = new UcdLineParser.IntRange();
805812
range.set(line.split(" ", 2)[0]);

0 commit comments

Comments
 (0)