From 465b9ffa457fd7ca22f58cb80cfa74a24c5b1b3c Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Fri, 7 Jun 2024 04:50:55 +0200 Subject: [PATCH] =?UTF-8?q?Allow=20U=CE=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/help/changes.md | 11 +++++++---- .../java/org/unicode/text/UCD/VersionedProperty.java | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/help/changes.md b/docs/help/changes.md index 55b656b7a2..44281b5f74 100644 --- a/docs/help/changes.md +++ b/docs/help/changes.md @@ -3,18 +3,21 @@ The Unicode Utilities have been modified to support both properties from the released version of Unicode (via ICU) and from the new Unicode beta. -To get the beta version of the property, U(version number)β *before* the property name. +To get the beta version of the property, insert `Uβ:` *before* the property name. +The explicit version number for the β can be used; +the resulting property is then only valid when that specific β is current. Examples: -| `\p{Word_Break=ALetter}` | Released version of Unicode | -| `\p{U16β:Word_Break=ALetter}` | Beta version of Unicode | +| `\p{Word_Break=ALetter}` | Released version of Unicode. | +| `\p{Uβ:Word_Break=ALetter}` | Beta version of Unicode; error outside of beta review. | +| `\p{U16β:Word_Break=ALetter}` | Beta version of Unicode 16.0; error during the beta review of any other version. | For example, to see additions to that property value in the beta version, use:
-[`\p{U16β:Word_Break=ALetter}-\p{Word_Break=ALetter}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5Cp%7BU16%CE%B2%3AWord_Break%3DALetter%7D-%5Cp%7BWord_Break%3DALetter%7D&g=&i=) +[`\p{Uβ:Word_Break=ALetter}-\p{Word_Break=ALetter}`](https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5Cp%7BU16%CE%B2%3AWord_Break%3DALetter%7D-%5Cp%7BWord_Break%3DALetter%7D&g=&i=)
diff --git a/unicodetools/src/main/java/org/unicode/text/UCD/VersionedProperty.java b/unicodetools/src/main/java/org/unicode/text/UCD/VersionedProperty.java index 903b2b0935..1aedb24105 100644 --- a/unicodetools/src/main/java/org/unicode/text/UCD/VersionedProperty.java +++ b/unicodetools/src/main/java/org/unicode/text/UCD/VersionedProperty.java @@ -8,6 +8,7 @@ import java.util.Set; import java.util.TreeMap; import java.util.function.Supplier; +import java.util.stream.Collectors; import org.unicode.props.IndexUnicodeProperties; import org.unicode.props.UnicodeProperty; import org.unicode.props.UnicodeProperty.Factory; @@ -51,6 +52,7 @@ public static VersionedProperty forJSPs(Supplier oldestLoadedUcd) { result.throwOnUnknownProperty = false; result.defaultVersion = Settings.lastVersion; result.versionAliases.put("dev", Settings.latestVersion); + result.versionAliases.put(Settings.latestVersionPhase.toString(), Settings.latestVersion); result.oldestLoadedUcd = oldestLoadedUcd; for (String latest = Settings.latestVersion; ; @@ -102,7 +104,9 @@ public VersionedProperty set(String xPropertyName) { "Unreleased version " + version + "; use suffix: " - + String.join(", ", versionAliases.keySet())); + + versionAliases.keySet().stream() + .map(v -> "U" + v) + .collect(Collectors.joining(", "))); } } xPropertyName = names[1];