Hyphenate ViewHelper <lih:hyphenate>
This ViewHelper can be used to apply hyphenation to text.
Examples
Usage with simple StringContent
The ViewHelper can be used as tag as well as with inline syntax, here are some Examples used with a Variable set like this:
<f:variable name="stringContent">Some textcontent to apply hyphention to</f:variable>
Copied!
ViewHelper usage:
{stringContent -> lih:hyphenate()}
Copied!
or
{lih:hyphenate(value: stringContent)}
Copied!
or
<lih:hyphenate value="{stringContent}" />
Copied!
or
<lih:hyphenate>{stringContent}</lih:hyphenate>
Copied!
The output is the same for all examples:
Some text­con­tent to apply hy­phen­ti­on to
Copied!
Example with arguments
<lih:hyphenate value="{stringContent}" leftMin="2" rightMin="3" wordMin="4" defaultLocale="de_CH"></lih:hyphenate>
Copied!
This will use a german hyphenation dictionary with the settings for leftMin, rightMin and wordMin set as specified.
Inline example:
{stringContent -> lih:hyphenate(leftMin: 2, rightMin: 3, wordMin: 5)}
Copied!
This will set the values for the arguments leftMin, rightMin and wordMin.
Arguments
The following arguments are available for the hyphenate ViewHelper:
defaultLocale
-
- Type
- string
This parameter defines what dictionary to use by default for hyphenation. Defaults to the current locale.
hyphen
-
- Type
- string
String to use as hyphen (e.g. ­ / "\xAD" / "\u{00AD}").
leftMin
-
- Type
- int
How many characters have to be left unhyphenated to the left of the word. This has to be an integer value.
quality
-
- Type
- int
How good shal the hyphenation be. The higher the number the better. THis can be any integer from 0 (no Hyphenation at all) through 9 (berst hyphernation). This defaults to 9. .. warning:: Change this only if you know what you do!
rightMin
-
- Type
- int
How many characters have to be left unhyphenated to the right of the word. This has to be an integer value
value
-
- Type
- string
Text to apply hyphenation to.
wordMin
-
- Type
- int
Words under the given length will not be hyphenated altogether. It makes sense to set option to a higher value than the sum of rightMin and leftMin.