| Package | Description |
|---|---|
| com.google.template.soy.data |
Java representation of Soy data types.
|
| com.google.template.soy.internal.i18n |
Libraries for internationalization (i18n).
|
| com.google.template.soy.shared.restricted |
| Modifier and Type | Method and Description |
|---|---|
Dir |
SanitizedContent.getContentDirection()
Returns the content's direction; null indicates that the direction is unknown, and is to be
estimated when necessary.
|
static Dir |
Dir.valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Dir[] |
Dir.values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
| Modifier and Type | Method and Description |
|---|---|
static SanitizedContent |
UnsafeSanitizedContentOrdainer.ordainAsSafe(String value,
SanitizedContent.ContentKind kind,
Dir dir)
Faithfully assumes the provided value is "safe" and marks it not to be re-escaped.
|
static SanitizedContent |
SanitizedContents.unsanitizedText(String text,
Dir dir)
Creates a SanitizedContent object of kind TEXT of a given direction (null if unknown).
|
| Modifier and Type | Method and Description |
|---|---|
static Dir |
BidiUtils.estimateDirection(String str)
Estimates the directionality of a string based on relative word counts, as detailed below.
|
static Dir |
BidiUtils.estimateDirection(String str,
boolean isHtml)
Like
BidiUtils.estimateDirection(String), but can treat str as HTML,
ignoring HTML tags and escapes that would otherwise be mistaken for LTR text. |
static Dir |
BidiFormatter.estimateDirection(String str,
boolean isHtml)
Estimates the directionality of a string using the best known general-purpose method, i.e.
|
Dir |
BidiFormatter.getContextDir() |
static Dir |
BidiUtils.getEntryDir(String str)
Like
BidiUtils.getEntryDir(String, boolean), but assumes str is not HTML or
HTML-escaped. |
static Dir |
BidiUtils.getEntryDir(String str,
boolean isHtml)
Returns the directionality of the first character with strong directionality in the string,
or Dir.NEUTRAL if none was encountered.
|
static Dir |
BidiUtils.getExitDir(String str)
Like
BidiUtils.getExitDir(String, boolean), but assumes str is not HTML or
HTML-escaped. |
static Dir |
BidiUtils.getExitDir(String str,
boolean isHtml)
Returns the directionality of the last character with strong directionality in the string, or
Dir.NEUTRAL if none was encountered.
|
static Dir |
BidiUtils.getUnicodeDir(String str)
Like
BidiUtils.getUnicodeDir(String, boolean), but assumes str is not HTML or
HTML-escaped. |
static Dir |
BidiUtils.getUnicodeDir(String str,
boolean isHtml)
Returns the directionality of a string as defined by the UBA's rules P2 and P3, i.e.
|
static Dir |
BidiUtils.languageDir(String locale)
Returns the directionality of a locale, given as a string in the ICU syntax.
|
static Dir |
BidiUtils.languageDir(com.ibm.icu.util.ULocale locale)
Returns the directionality of a locale.
|
| Modifier and Type | Method and Description |
|---|---|
static BidiFormatter |
BidiFormatter.getInstance(Dir contextDir)
Factory for creating an instance of BidiFormatter given the context directionality.
|
String |
BidiFormatter.knownDirAttr(Dir dir)
Returns "dir=\"ltr\"" or "dir=\"rtl\"", depending on the given directionality, if it is not
NEUTRAL or the same as the context directionality.
|
String |
BidiFormatter.knownDirAttrValue(Dir dir)
Returns "rtl" if the given directionality is RTL, and "ltr" if it is LTR.
|
String |
BidiFormatter.markAfterKnownDir(Dir dir,
String str)
Operates like
BidiFormatter.markAfterKnownDir(Dir, String, boolean), but assumes that
isHtml is false. |
String |
BidiFormatter.markAfterKnownDir(Dir dir,
String str,
boolean isHtml)
Returns a Unicode bidi mark matching the context directionality (LRM or RLM) if either the
overall or the exit directionality of a given string is opposite to the context directionality.
|
String |
BidiFormatter.markBeforeKnownDir(Dir dir,
String str)
Operates like
BidiFormatter.markBeforeKnownDir(Dir, String, boolean), but assumes that
isHtml is false. |
String |
BidiFormatter.markBeforeKnownDir(Dir dir,
String str,
boolean isHtml)
Returns a Unicode bidi mark matching the context directionality (LRM or RLM) if either the
overall or the entry directionality of a given string is opposite to the context
directionality.
|
String |
BidiFormatter.spanWrapWithKnownDir(Dir dir,
String str)
Operates like
BidiFormatter.spanWrapWithKnownDir(Dir, String, boolean, boolean), but
assumes isHtml is false and isolate is true. |
String |
BidiFormatter.spanWrapWithKnownDir(Dir dir,
String str,
boolean isHtml)
Operates like
BidiFormatter.spanWrapWithKnownDir(Dir, String, boolean, boolean), but
assumes isolate is true. |
String |
BidiFormatter.spanWrapWithKnownDir(Dir dir,
String str,
boolean isHtml,
boolean isolate)
Formats a string of given directionality for use in HTML output of the context directionality,
so an opposite-directionality string is neither garbled nor garbles its surroundings.
|
String |
BidiFormatter.unicodeWrapWithKnownDir(Dir dir,
String str)
Operates like
BidiFormatter.unicodeWrapWithKnownDir(Dir, String, boolean, boolean), but
assumes isHtml is false and isolate is true. |
String |
BidiFormatter.unicodeWrapWithKnownDir(Dir dir,
String str,
boolean isHtml)
Operates like
BidiFormatter.unicodeWrapWithKnownDir(Dir, String, boolean, boolean), but
assumes isolate is true. |
String |
BidiFormatter.unicodeWrapWithKnownDir(Dir dir,
String str,
boolean isHtml,
boolean isolate)
Formats a string of given directionality for use in plain-text output of the context
directionality, so an opposite-directionality string is neither garbled nor garbles its
surroundings.
|
| Constructor and Description |
|---|
BidiFormatter.Builder(Dir contextDir)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static SanitizedContent |
Sanitizers.cleanHtml(String value,
Dir contentDir,
Collection<? extends TagWhitelist.OptionalSafeTag> optionalSafeTags)
Normalizes the input HTML of a given directionality while preserving "safe" tags.
|