| java.lang.Object org.mmbase.util.transformers.StringTransformer org.mmbase.util.transformers.ConfigurableStringTransformer org.mmbase.util.transformers.XmlField
XmlField | public class XmlField extends ConfigurableStringTransformer implements CharTransformer(Code) | | XMLFields in MMBase. This class can encode such a field to several other formats.
author: Michiel Meeuwissen version: $Id: XmlField.java,v 1.51 2007/08/04 08:09:14 michiel Exp $ |
Method Summary | |
protected static String | XSLTransform(String xslFile, String data) Base function for XSL conversions. | static void | cleanupText(StringObject obj) Removes all new lines and space which are too much. | public String | getEncoding() | static void | handleEmph(StringObject obj, char ch, String tag) If you want to add a _ in your text, that should be possible too...
Should be done last, because no tags can appear in
Parameters: ch - This is '_' or e.g. | protected static void | handleFormat(StringObject obj, boolean format) Only escape, clean up. | static void | handleHeaders(StringObject obj) Some paragraphs are are really \sections. | static void | handleList(StringObject obj) | static void | handleNewlines(StringObject obj) | static void | handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP) Make tags.
Parameters: leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. | static void | handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP) Make <p> </p> tags.
Note that if placeListsInsideP is false , the code generated with lists becomes akin to:
<p>...</p><ul>...</ul><p>...</p>
If placeListsInsideP is true , the code becomes:
<p>...<ul>...</ul>...</p>
If there is no content in front of the first list, or after the last list, those paragraphs are empty and may not be
added.
Parameters: leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. | protected static void | handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP) | protected static void | handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP) | static void | handleTables(StringObject obj) Wikipedia syntax for tables. | public static String | poorToHTMLInline(String data) So poor, that it actually generates pieces of XHTML 1.1 inlines (so, no use of section, br, p). | public static String | poorToXML(String data, boolean format, boolean placeListsInsideP) As richToXML but a little less rich. | public static String | poorToXML(String data, boolean format) | public static String | poorToXML(String data) | protected static StringObject | prepareData(String data) | protected static String | prepareDataString(String data) | public static String | richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP, boolean placeListsInsideP) So poor, that it actually generates pieces of XHTML 1.1 blocks (so, no use of sections). | public static String | richToHTMLBlock(String data) | public static String | richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP) | public static String | richToXML(String data, boolean format, boolean placeListsInsideP) Defines a kind of 'rich' text format. | public static String | richToXML(String data, boolean format) | public static String | richToXML(String data) | public String | transform(String data) | public String | transformBack(String r) | public Map<String, Config> | transformers() | protected static void | validate(String incoming) | public static String | wikiToXML(String data, boolean placeListsInsideP) | public static String | wikiToXML(String data) |
ASCII | final public static int ASCII(Code) | | |
HTML_BLOCK | final public static int HTML_BLOCK(Code) | | |
HTML_BLOCK_BR | final public static int HTML_BLOCK_BR(Code) | | |
HTML_BLOCK_BR_NOSURROUNDINGP | final public static int HTML_BLOCK_BR_NOSURROUNDINGP(Code) | | |
HTML_BLOCK_LIST | final public static int HTML_BLOCK_LIST(Code) | | |
HTML_BLOCK_LIST_BR | final public static int HTML_BLOCK_LIST_BR(Code) | | |
HTML_BLOCK_LIST_BR_NOSURROUNDINGP | final public static int HTML_BLOCK_LIST_BR_NOSURROUNDINGP(Code) | | |
HTML_BLOCK_LIST_NOSURROUNDINGP | final public static int HTML_BLOCK_LIST_NOSURROUNDINGP(Code) | | |
HTML_BLOCK_NOSURROUNDINGP | final public static int HTML_BLOCK_NOSURROUNDINGP(Code) | | |
HTML_INLINE | final public static int HTML_INLINE(Code) | | |
LEAVE_NEWLINES | final protected static boolean LEAVE_NEWLINES(Code) | | |
LISTS_INSIDE_P | final protected static boolean LISTS_INSIDE_P(Code) | | |
LISTS_OUTSIDE_P | final protected static boolean LISTS_OUTSIDE_P(Code) | | |
NO_SECTIONS | final protected static boolean NO_SECTIONS(Code) | | |
NO_SURROUNDING_P | final protected static boolean NO_SURROUNDING_P(Code) | | |
POORBODY | final public static int POORBODY(Code) | | |
REMOVE_NEWLINES | final protected static boolean REMOVE_NEWLINES(Code) | | |
RICHBODY | final public static int RICHBODY(Code) | | |
SURROUNDING_P | final protected static boolean SURROUNDING_P(Code) | | |
XHTML | final public static int XHTML(Code) | | |
XmlField | public XmlField()(Code) | | |
XmlField | public XmlField(int to)(Code) | | |
cleanupText | static void cleanupText(StringObject obj)(Code) | | Removes all new lines and space which are too much.
|
handleEmph | static void handleEmph(StringObject obj, char ch, String tag)(Code) | | If you want to add a _ in your text, that should be possible too...
Should be done last, because no tags can appear in
Parameters: ch - This is '_' or e.g. '*' Parameters: tag - The tag to produce, e.g. "em" or "strong" |
handleFormat | protected static void handleFormat(StringObject obj, boolean format)(Code) | | Only escape, clean up.
since: MMBase-1.7 |
handleHeaders | static void handleHeaders(StringObject obj)(Code) | | Some paragraphs are are really \sections. So this handler can
be done after handleParagraphs. It will search the paragraphs
which are really headers, and changes them. A header, in our
'rich' text format, is a paragraph starting with one or more $.
If there are more then one, the resulting tags are
going to be nested.
|
handleList | static void handleList(StringObject obj)(Code) | | Takes a string object, finds list structures and changes those to XML
|
handleParagraphs | static void handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP)(Code) | | Make tags.
Parameters: leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. If true, every 2 newlines starts new p, and every extra new line simply stays (inside the p). Parameters: surroundingP - (defaults to true) wether the surrounding <p> should be included too. |
handleParagraphs | static void handleParagraphs(StringObject obj, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)(Code) | | Make <p> </p> tags.
Note that if placeListsInsideP is false , the code generated with lists becomes akin to:
<p>...</p><ul>...</ul><p>...</p>
If placeListsInsideP is true , the code becomes:
<p>...<ul>...</ul>...</p>
If there is no content in front of the first list, or after the last list, those paragraphs are empty and may not be
added.
Parameters: leaveExtraNewLines - (defaults to false) if false, 2 or more newlines starts a new p. If true, every 2 newlines starts new p, and every extra new line simply stays (inside the p). Parameters: surroundingP - (defaults to true) wether the surrounding <p> should be included too. Parameters: placeListsInsideP - (defaults to false) wether a list should be placed inside a <p> (as allowed by xhtml2). |
handleRich | protected static void handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP)(Code) | | |
handleRich | protected static void handleRich(StringObject obj, boolean sections, boolean leaveExtraNewLines, boolean surroundingP, boolean placeListsInsideP)(Code) | | |
handleTables | static void handleTables(StringObject obj)(Code) | | Wikipedia syntax for tables. (simplified)
{|
| a || b || c
|-
| d || e || f
|}
or e.g.
{|-
|+ caption
! A !! B !! C
|-
| d
| e
| f
|}
since: MMBase 1.8 |
poorToHTMLInline | public static String poorToHTMLInline(String data)(Code) | | So poor, that it actually generates pieces of XHTML 1.1 inlines (so, no use of section, br, p).
since: MMBase-1.7 |
poorToXML | public static String poorToXML(String data, boolean format, boolean placeListsInsideP)(Code) | | As richToXML but a little less rich. Which means that only one new line is non significant.
See Also: XmlField.richToXML |
richToHTMLBlock | public static String richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP, boolean placeListsInsideP)(Code) | | So poor, that it actually generates pieces of XHTML 1.1 blocks (so, no use of sections).
See Also: XmlField.richToXML since: MMBase-1.7 |
richToHTMLBlock | public static String richToHTMLBlock(String data, boolean multipibleBrs, boolean surroundingP)(Code) | | |
richToXML | public static String richToXML(String data, boolean format, boolean placeListsInsideP)(Code) | | Defines a kind of 'rich' text format. This is a way to easily
type structured text in XML. The XML tags which can be
produced by this are all HTML as well.
This is a generalisation of the MMBase html() functions which
does similar duties, but hopefully this one is better, and more
powerfull too.
The following things are recognized:
- Firstly, XMLEscape is called.
- A line starting with an asterix (*) will start an unnumberd
list. The first new line not starting with a space or an other
asterix will end the list
- Underscores are translated to the emphasize HTML-tag
- You can create a header tag by by starting a line with a dollar signs
- A paragraph can be begun (and ended) with an empty line.
Test with commandline: java org.mmbase.util.Encode RICH_TEXT (reads from STDIN)
Parameters: data - text to convert Parameters: format - if the resulting XML must be nicely formatted (default: false) the converted text |
validate | protected static void validate(String incoming) throws FormatException(Code) | | |
Fields inherited from org.mmbase.util.transformers.ConfigurableStringTransformer | protected int to(Code)(Java Doc)
|
|
|