Class Markup
java.lang.Object
ch.tocco.nice2.toolbox.api.markup.Markup
This utility class provides functionality to replace certain markup
pieces in a markup string.
Example with using the Freemarker markup
:
Now the markup can be parsed and modified. For example HTML entities can be encoded and it won't break any freemarker code.[@testmacro param="test"/]
[#macro testmacro param=""] param: ${param} [/#macro] is transformed to[replacement-
[replacement-] ] param: [replacement- ] [replacement- ]
Once all modifications are done, the extracted freemarker tags can
be reinserted by calling reinsert(Replaced)
.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Markup
Create an instance to replace all freemarker markup.reinsert
(Markup.Replaced replaced) Replace all [replacement-] strings with the corresponding extraction. Replace all strings matching the givenreplacePattern
with[replacement-<uuid>]
.
-
Constructor Details
-
Markup
-
-
Method Details
-
freemarker
Create an instance to replace all freemarker markup. This includes: - all tags like [#if ...], [/#if], [#assign .../], [#macro mymacro...], ... - macro calls like [@mymacro ...] - variable printing like ${myVar}- Returns:
- an instance of
Markup
to replace freemarker markup.
-
getReplacePattern
-
replace
Replace all strings matching the givenreplacePattern
with[replacement-<uuid>]
.- Parameters:
markup
- Any markup string.- Returns:
- an object containing the new markup string and a map with all replacements.
-
reinsert
Replace all [replacement-] strings with the corresponding extraction. - Returns:
- the markup string
-