Added boilerplate and a class comment and traded in tabs for four
spaces. A unittest and an example would be great, but this is a start.
This commit is contained in:
parent
8ccd68789a
commit
bef1d1b625
1 changed files with 230 additions and 200 deletions
|
@ -1,11 +1,41 @@
|
||||||
|
/*
|
||||||
|
The contents of this file are subject to the THDL Open Community License
|
||||||
|
Version 1.0 (the "License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License on the THDL web site
|
||||||
|
(http://www.thdl.org/).
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||||
|
License for the specific terms governing rights and limitations under the
|
||||||
|
License.
|
||||||
|
|
||||||
|
The Initial Developer of this software is the Tibetan and Himalayan Digital
|
||||||
|
Library (THDL). Portions created by the THDL are Copyright 2001-2005 THDL.
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s): ______________________________________.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.thdl.tib.text;
|
package org.thdl.tib.text;
|
||||||
|
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
/** A class that can create HTML that uses the Tibetan Machine Web
|
||||||
|
* font, which is really ten font files. This is intended to be used
|
||||||
|
* by Xalan XSLT to convert an XML document that uses Wylie into HTML
|
||||||
|
* that uses TMW. Or something like that -- I, David Chandler,
|
||||||
|
* didn't write this class, Edward Garrett did. But now that
|
||||||
|
* EWTS->TMW conversion is best done by org.thdl.tib.text.ttt, this
|
||||||
|
* class is deprecated.
|
||||||
|
* @author Edward Garrett, Tibetan and Himalayan Digital Library
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
public class TibetanHTML {
|
public class TibetanHTML {
|
||||||
static String[] styleNames =
|
static String[] styleNames =
|
||||||
{"tmw","tmw1","tmw2","tmw3","tmw4","tmw5","tmw6","tmw7","tmw8","tmw9"};
|
{"tmw","tmw1","tmw2","tmw3","tmw4","tmw5","tmw6","tmw7","tmw8","tmw9"};
|
||||||
|
|
||||||
|
/** Returns CSS needed if you use other functions in this class.
|
||||||
|
* @param fontSize the base-10 integral font size. */
|
||||||
public static String getStyles(String fontSize) {
|
public static String getStyles(String fontSize) {
|
||||||
return ".tmw {font: "+fontSize+"pt TibetanMachineWeb}\n"+
|
return ".tmw {font: "+fontSize+"pt TibetanMachineWeb}\n"+
|
||||||
".tmw1 {font: "+fontSize+"pt TibetanMachineWeb1}\n"+
|
".tmw1 {font: "+fontSize+"pt TibetanMachineWeb1}\n"+
|
||||||
|
@ -26,7 +56,7 @@ public class TibetanHTML {
|
||||||
String next = tokenizer.nextToken();
|
String next = tokenizer.nextToken();
|
||||||
if (next.equals("\t") || next.equals("\n")) {
|
if (next.equals("\t") || next.equals("\n")) {
|
||||||
buffer.append("<wbr/>");
|
buffer.append("<wbr/>");
|
||||||
buffer.append(getHTML(TibTextUtils.getTibetanMachineWebForEWTS("_")));
|
buffer.append(getHTML(TibTextUtils.getTibetanMachineWebForEWTS("_"))); // hard-coded EWTS
|
||||||
buffer.append("<wbr/>");
|
buffer.append("<wbr/>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -85,7 +115,7 @@ public class TibetanHTML {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getIndentedHTML(String wylie) {
|
public static String getIndentedHTML(String wylie) {
|
||||||
return getHTML("_" + wylie);
|
return getHTML("_" + wylie); // hard-coded EWTS
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getHTML(String wylie) {
|
public static String getHTML(String wylie) {
|
||||||
|
@ -95,7 +125,7 @@ public class TibetanHTML {
|
||||||
String next = tokenizer.nextToken();
|
String next = tokenizer.nextToken();
|
||||||
if (next.equals("\t") || next.equals("\n")) {
|
if (next.equals("\t") || next.equals("\n")) {
|
||||||
buffer.append("<wbr/>");
|
buffer.append("<wbr/>");
|
||||||
buffer.append(getHTML(TibTextUtils.getTibetanMachineWebForEWTS("_")));
|
buffer.append(getHTML(TibTextUtils.getTibetanMachineWebForEWTS("_"))); // hard-coded EWTS
|
||||||
buffer.append("<wbr/>");
|
buffer.append("<wbr/>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue