Class CmsTypografUtil
java.lang.Object
org.opencms.acacia.client.widgets.CmsTypografUtil
Helpers / utilities related to the 'typograf' typography library.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Native type for the Typograf class provided by the library of the same name. -
Field Summary
Modifier and TypeFieldDescriptionstatic final com.google.gwt.regexp.shared.RegExp
Pattern to match entities.static final com.google.gwt.regexp.shared.RegExp
Pattern to match safe tags. -
Method Summary
Modifier and TypeMethodDescriptionstatic CmsTypografUtil.Typograf
createLiveInstance
(String typografLocale) Creates a 'live' typograf instance to be used for typography while typing in an editor widget.static String
protectEntities
(String input) Wraps entities in safe tags.static String
restoreEntities
(String input) Removes the safe tags around entities.static String
transform
(CmsTypografUtil.Typograf typograf, String value) Transforms things with typograf, preserving all entities.
-
Field Details
-
ENTITY_PATTERN
Pattern to match entities. -
SAFE_TAG_PATTERN
Pattern to match safe tags.
-
-
Method Details
-
createLiveInstance
Creates a 'live' typograf instance to be used for typography while typing in an editor widget.- Parameters:
typografLocale
- the typograf locale (not the same format as OpenCms locales!)- Returns:
- the typograf instance for the locale, or null if it couldn't be created
-
protectEntities
Wraps entities in safe tags.- Parameters:
input
- the input string- Returns:
- the string with wrapped entities
-
restoreEntities
Removes the safe tags around entities.- Parameters:
input
- the input string- Returns:
- the transformed string
-
transform
Transforms things with typograf, preserving all entities.- Parameters:
typograf
- the typograf instancevalue
- the value to transform- Returns:
- the transformed value
-