Skip to content

Commit 4381875

Browse files
authored
Bring back the JSPs (#1018)
* Knock out properties.jsp * knock out UnicodeSet links for multivalued properties on character.jsp * Drop the now redundant UCharacter-based properties * Break things
1 parent a8284c9 commit 4381875

File tree

5 files changed

+33
-52
lines changed

5 files changed

+33
-52
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ public static String getSimpleSet(
166166
String a_out;
167167
a.clear();
168168
try {
169+
if (setA.length() > 4
170+
&& setA.startsWith("[:k")
171+
&& setA.endsWith(":]")
172+
&& setA.contains("=")
173+
&& !setA.substring(2, setA.length() - 2).contains(":]")
174+
&& XPropertyFactory.make()
175+
.getProperty(setA.substring(2, setA.indexOf("=")))
176+
.isMultivalued()) {
177+
throw new Exception(
178+
"POSIX-style queries for multivalued Unihan properties are temporarily disabled. Try \\p{"
179+
+ setA.substring(2, setA.length() - 2)
180+
+ "}");
181+
}
169182
// setA = UnicodeSetUtilities.MyNormalize(setA, Normalizer.NFC);
170183
a.addAll(UnicodeSetUtilities.parseUnicodeSet(setA));
171184
a_out = UnicodeUtilities.getPrettySet(a, abbreviate, escape);

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,7 @@ class PropertyAssignment {
16481648
VersionInfo last;
16491649
String value;
16501650
}
1651+
final boolean isMultivalued = getFactory().getProperty(propName).isMultivalued();
16511652
List<PropertyAssignment> history = new ArrayList<>();
16521653
// TODO(eggrobin): TUP normalization chokes on sufficiently old versions, but this is not
16531654
// worth debugging as we want to get rid of it.
@@ -1732,17 +1733,21 @@ class PropertyAssignment {
17321733
out.append(
17331734
"<td"
17341735
+ defaultClass
1735-
+ "><a target='u' "
1736-
+ (isNew ? "class='changed' " : "")
1737-
+ "href='list-unicodeset.jsp?a=[:"
1738-
+ (isCurrent ? "" : "U" + last + ":")
1739-
+ propName
1740-
+ "="
1741-
+ hValue
1742-
+ ":]'>"
1736+
+ ">"
1737+
+ (isMultivalued
1738+
? ""
1739+
: ("<a target='u' "
1740+
+ (isNew ? "class='changed' " : "")
1741+
+ "href='list-unicodeset.jsp?a=[:"
1742+
+ (isCurrent ? "" : "U" + last + ":")
1743+
+ propName
1744+
+ "="
1745+
+ hValue
1746+
+ ":]'>"))
17431747
+ versionRange
17441748
+ hValue
1745-
+ "</a></td>");
1749+
+ (isMultivalued ? "" : "</a>")
1750+
+ "</td>");
17461751
}
17471752
}
17481753
out.append("</tr>");

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

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -145,48 +145,6 @@ public String transform(Integer source) {
145145
},
146146
false)
147147
.setMain("toNFKD", "toNFKD", UnicodeProperty.STRING, "1.1"));
148-
149-
add(
150-
new StringTransformProperty(
151-
new StringTransform() {
152-
@Override
153-
public String transform(String source) {
154-
return UCharacter.foldCase(source, true);
155-
}
156-
},
157-
false)
158-
.setMain("toCasefold", "toCF", UnicodeProperty.STRING, "1.1"));
159-
add(
160-
new StringTransformProperty(
161-
new StringTransform() {
162-
@Override
163-
public String transform(String source) {
164-
return UCharacter.toLowerCase(ULocale.ROOT, source);
165-
}
166-
},
167-
false)
168-
.setMain("toLowercase", "toLC", UnicodeProperty.STRING, "1.1"));
169-
add(
170-
new StringTransformProperty(
171-
new StringTransform() {
172-
@Override
173-
public String transform(String source) {
174-
return UCharacter.toUpperCase(ULocale.ROOT, source);
175-
}
176-
},
177-
false)
178-
.setMain("toUppercase", "toUC", UnicodeProperty.STRING, "1.1"));
179-
add(
180-
new StringTransformProperty(
181-
new StringTransform() {
182-
@Override
183-
public String transform(String source) {
184-
return UCharacter.toTitleCase(ULocale.ROOT, source, null);
185-
}
186-
},
187-
false)
188-
.setMain("toTitlecase", "toTC", UnicodeProperty.STRING, "1.1"));
189-
190148
add(
191149
new StringTransformProperty(
192150
new StringTransform() {

UnicodeJsps/src/main/webapp/properties.jsp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ th { text-align: left }
2020
UtfParameters utfParameters = new UtfParameters(queryString);
2121
2222
String propForValues = utfParameters.getParameter("a");
23-
UnicodeJsp.showPropsTable(out, propForValues, "properties.jsp");
23+
// TODO(egg): Cache this page.
24+
//UnicodeJsp.showPropsTable(out, propForValues, "properties.jsp");
2425
%>
2526
<h2>Key</h2>
2627
<p>The Categories are from <a target='_blank' href='http://www.unicode.org/reports/tr44#Property_Index'>UCD

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ public UnicodeProperty setMultivalued(boolean value) {
164164
return this;
165165
}
166166

167+
public boolean isMultivalued() {
168+
return isMultivalued;
169+
}
170+
167171
public UnicodeProperty setDelimiter(String value) {
168172
delimiter = value;
169173
delimiterSplitter = Splitter.on(delimiter);

0 commit comments

Comments
 (0)