51
51
import org .unicode .idna .IdnaTypes ;
52
52
import org .unicode .idna .Punycode ;
53
53
import org .unicode .idna .Uts46 ;
54
+ import org .unicode .props .DerivedPropertyStatus ;
55
+ import org .unicode .props .UcdProperty ;
54
56
import org .unicode .props .UcdPropertyValues .Age_Values ;
55
57
import org .unicode .props .UnicodeProperty ;
56
58
import org .unicode .props .UnicodeProperty .UnicodeMapProperty ;
@@ -1440,6 +1442,42 @@ public static void showProperties(
1440
1442
1441
1443
String kRSUnicode = getFactory ().getProperty ("kRSUnicode" ).getValue (cp );
1442
1444
boolean isUnihan = kRSUnicode != null ;
1445
+ List <UcdProperty > indexedProperties =
1446
+ sortedProps .stream ()
1447
+ .map (UcdProperty ::forString )
1448
+ .filter (p -> p != null )
1449
+ .collect (Collectors .toList ());
1450
+ List <UcdProperty > ucdProperties =
1451
+ indexedProperties .stream ()
1452
+ .filter (
1453
+ p ->
1454
+ p .getDerivedStatus () == DerivedPropertyStatus .Approved
1455
+ || p .getDerivedStatus ()
1456
+ == DerivedPropertyStatus .Provisional )
1457
+ .collect (Collectors .toList ());
1458
+ List <UcdProperty > nonUCDProperties =
1459
+ indexedProperties .stream ()
1460
+ .filter (p -> p .getDerivedStatus () == DerivedPropertyStatus .NonUCDProperty )
1461
+ .collect (Collectors .toList ());
1462
+ List <UcdProperty > ucdNonProperties =
1463
+ indexedProperties .stream ()
1464
+ .filter (p -> p .getDerivedStatus () == DerivedPropertyStatus .UCDNonProperty )
1465
+ .collect (Collectors .toList ());
1466
+ // Non-UCD non-properties, and things added directly in the tools.
1467
+ List <String > otherData =
1468
+ sortedProps .stream ()
1469
+ .filter (
1470
+ p ->
1471
+ UcdProperty .forString (p ) == null
1472
+ || UcdProperty .forString (p ).getDerivedStatus ()
1473
+ == DerivedPropertyStatus .NonUCDNonProperty )
1474
+ .collect (Collectors .toList ());
1475
+
1476
+ List <UcdProperty > cjkProperties =
1477
+ ucdProperties .stream ()
1478
+ .filter (p -> p .getNames ().getShortName ().startsWith ("cjk" ))
1479
+ .collect (Collectors .toList ());
1480
+ ucdProperties .removeIf (p -> p .getNames ().getShortName ().startsWith ("cjk" ));
1443
1481
1444
1482
Age_Values age = Age_Values .forName (getFactory ().getProperty ("Age" ).getValue (cp ));
1445
1483
VersionInfo minVersion =
@@ -1456,71 +1494,86 @@ public static void showProperties(
1456
1494
+ "</p>" );
1457
1495
}
1458
1496
1459
- out .append (
1460
- "<table class='propTable'>"
1461
- + "<caption>"
1462
- + (isUnihan ? "non-Unihan properties for U+" : "Properties for U+" )
1463
- + hex
1464
- + "</caption>"
1465
- + "<tr><th>With Non-Default Values</th><th>With Default Values</th></tr>"
1466
- + "<tr><td width='50%'>\n " );
1467
- out .append ("<table width='100%'>\n " );
1468
-
1469
- List <String > unihanProperties = new ArrayList <>();
1470
1497
VersionInfo maxVersion =
1471
1498
showDevProperties ? Settings .LATEST_VERSION_INFO : Settings .LAST_VERSION_INFO ;
1472
- for (String propName : sortedProps ) {
1473
- UnicodeProperty prop = getFactory ().getProperty (propName );
1499
+ out .append ("<table class='propTable'>" );
1500
+ showProperties (
1501
+ ucdProperties .stream ().map (UcdProperty ::toString ).collect (Collectors .toList ()),
1502
+ (isUnihan ? "Non-Unihan " : "" )
1503
+ + "Normative, Informative, Contributory, and (Provisional) UCD properties for U+"
1504
+ + hex ,
1505
+ cp ,
1506
+ minVersion ,
1507
+ maxVersion ,
1508
+ showDevProperties ,
1509
+ out );
1510
+ showProperties (
1511
+ nonUCDProperties .stream ().map (UcdProperty ::toString ).collect (Collectors .toList ()),
1512
+ "Non-UCD properties for U+" + hex ,
1513
+ cp ,
1514
+ minVersion ,
1515
+ maxVersion ,
1516
+ showDevProperties ,
1517
+ out );
1518
+ showProperties (
1519
+ ucdNonProperties .stream ().map (UcdProperty ::toString ).collect (Collectors .toList ()),
1520
+ "Other " + (isUnihan ? "non-Unihan " : "" ) + "UCD data for U+" + hex ,
1521
+ cp ,
1522
+ minVersion ,
1523
+ maxVersion ,
1524
+ showDevProperties ,
1525
+ out );
1526
+ if (isUnihan ) {
1527
+ showProperties (
1528
+ cjkProperties .stream ().map (UcdProperty ::toString ).collect (Collectors .toList ()),
1529
+ "Unihan Normative, Informative, and (Provisional) properties for U+" + hex ,
1530
+ cp ,
1531
+ minVersion ,
1532
+ maxVersion ,
1533
+ showDevProperties ,
1534
+ out );
1535
+ }
1536
+ showProperties (
1537
+ otherData ,
1538
+ "Other information on U+" + hex ,
1539
+ cp ,
1540
+ minVersion ,
1541
+ maxVersion ,
1542
+ showDevProperties ,
1543
+ out );
1544
+ out .append ("</table>\n " );
1545
+ }
1546
+
1547
+ private static void showProperties (
1548
+ List <String > properties ,
1549
+ String title ,
1550
+ int cp ,
1551
+ VersionInfo minVersion ,
1552
+ VersionInfo maxVersion ,
1553
+ boolean showDevProperties ,
1554
+ Appendable out )
1555
+ throws IOException {
1556
+ out .append ("<tr><th colspan=2>" + title + "</th></tr>" + "<tr><td width='50%'>\n " );
1557
+ out .append ("<table width='100%'>\n " );
1558
+ for (int i = 0 ; i < properties .size () / 2 ; ++i ) {
1559
+ UnicodeProperty prop = getFactory ().getProperty (properties .get (i ));
1474
1560
if (prop .getName ().equals ("confusable" )) continue ;
1475
- if (prop .getFirstNameAlias ().startsWith ("cjk" )) {
1476
- unihanProperties .add (propName );
1477
- continue ;
1478
- }
1479
1561
1480
- boolean isDefault = prop .isDefault (cp );
1481
- if (isDefault ) continue ;
1482
- showPropertyValue (propName , cp , minVersion , maxVersion , isDefault , out );
1562
+ showPropertyValue (properties .get (i ), cp , minVersion , maxVersion , out );
1483
1563
}
1484
1564
out .append ("</table>\n " );
1485
1565
1486
1566
out .append ("</td><td width='50%'>\n " );
1487
1567
1488
1568
out .append ("<table width='100%'>\n " );
1489
- for (String propName : sortedProps ) {
1490
- UnicodeProperty prop = getFactory ().getProperty (propName );
1569
+ for (int i = properties . size () / 2 ; i < properties . size (); ++ i ) {
1570
+ UnicodeProperty prop = getFactory ().getProperty (properties . get ( i ) );
1491
1571
if (prop .getName ().equals ("confusable" )) continue ;
1492
- if (prop .getFirstNameAlias ().startsWith ("cjk" )) {
1493
- continue ;
1494
- }
1495
1572
1496
- boolean isDefault = prop .isDefault (cp );
1497
- if (!isDefault ) continue ;
1498
- showPropertyValue (propName , cp , minVersion , maxVersion , isDefault , out );
1573
+ showPropertyValue (properties .get (i ), cp , minVersion , maxVersion , out );
1499
1574
}
1500
1575
out .append ("</table>\n " );
1501
-
1502
- out .append ("</td></tr></table>\n " );
1503
- if (isUnihan ) {
1504
- out .append (
1505
- "<table class='propTable'>"
1506
- + "<caption>"
1507
- + "Unihan properties for U+"
1508
- + hex
1509
- + "</caption>"
1510
- + "<tr><td width='50%'>\n " );
1511
- out .append ("<table width='100%'>\n " );
1512
- for (int i = 0 ; i < unihanProperties .size () / 2 ; ++i ) {
1513
- showPropertyValue (unihanProperties .get (i ), cp , minVersion , maxVersion , false , out );
1514
- }
1515
- out .append ("</table>\n " );
1516
- out .append ("</td><td width='50%'>\n " );
1517
- out .append ("<table width='100%'>\n " );
1518
- for (int i = unihanProperties .size () / 2 ; i < unihanProperties .size (); ++i ) {
1519
- showPropertyValue (unihanProperties .get (i ), cp , minVersion , maxVersion , false , out );
1520
- }
1521
- out .append ("</table>\n " );
1522
- out .append ("</td></tr></table>\n " );
1523
- }
1576
+ out .append ("</td></tr>\n " );
1524
1577
}
1525
1578
1526
1579
private static StringBuilder displayConfusables (int codepoint ) {
@@ -1648,10 +1701,14 @@ private static void showPropertyValue(
1648
1701
int codePoint ,
1649
1702
VersionInfo minVersion ,
1650
1703
VersionInfo maxVersion ,
1651
- boolean isDefault ,
1652
1704
Appendable out )
1653
1705
throws IOException {
1654
- String defaultClass = isDefault ? " class='default'" : "" ;
1706
+ String defaultClass =
1707
+ getFactory ().getProperty (propName ).isDefault (codePoint ) ? " class='default'" : "" ;
1708
+ var indexedProperty = UcdProperty .forString (propName );
1709
+ final boolean provisional =
1710
+ indexedProperty != null
1711
+ && indexedProperty .getDerivedStatus () == DerivedPropertyStatus .Provisional ;
1655
1712
class PropertyAssignment {
1656
1713
VersionInfo first ;
1657
1714
VersionInfo last ;
@@ -1709,12 +1766,12 @@ class PropertyAssignment {
1709
1766
history .add (current );
1710
1767
}
1711
1768
out .append (
1712
- "<tr><th><a target='c' href='properties.jsp?a="
1769
+ "<tr><th width='50%' ><a target='c' href='properties.jsp?a="
1713
1770
+ propName
1714
1771
+ "#"
1715
1772
+ propName
1716
1773
+ "'>"
1717
- + propName
1774
+ + ( provisional ? "(" + propName + ")" : propName )
1718
1775
+ "</a></th>" );
1719
1776
for (PropertyAssignment assignment : history ) {
1720
1777
String first =
0 commit comments