com.jalios.jcms
Class WikiRenderer

java.lang.Object
  extended by com.jalios.jcms.WikiRenderer
All Implemented Interfaces:
JcmsConstants, JaliosConstants

public class WikiRenderer
extends Object
implements JcmsConstants

This class contains a set of utility static methods to process wiki text.

Since:
jcms-5.5.0
Version:
$Revision: 34270 $
Author:
Olivier Dedieu , Olivier Jaquemet

Field Summary
static String LINK_TARGET_ATTRIBUTE
           
static String REVISION
           
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Constructor Summary
WikiRenderer()
           
 
Method Summary
static String encodeSection(Data data, String field, String update)
           
static Set<Publication> extractPubSetFromUrl(String text)
          Returns the set of publication referenced through URL in the given text.
static Set<Publication> extractPubSetFromWiki(String text)
          Returns the set of publication referenced through wiki link in the given text.
static String extractSection(String text, String section)
           
static String updateSection(String text, String section, String update)
           
static String wiki2html(String text)
          Deprecated. use wiki2html(String, Locale, WikiRenderingHints)
static String wiki2html(String text, Locale userLocale, WikiRenderingHints hints)
          Transform a given string formatted according the wiki text formatting rules in an HTML string.
static String wiki2html(String text, String css, boolean isSpan, Locale userLocale)
          Deprecated. use wiki2html(String, Locale, WikiRenderingHints)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

LINK_TARGET_ATTRIBUTE

public static final String LINK_TARGET_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

WikiRenderer

public WikiRenderer()
Method Detail

wiki2html

@Deprecated
public static String wiki2html(String text)
Deprecated. use wiki2html(String, Locale, WikiRenderingHints)

Transform a given string formatted according the wiki text formatting rules in an HTML string.

Parameters:
text - the wiki text to format
Returns:
an HTML formatted text

wiki2html

@Deprecated
public static String wiki2html(String text,
                                          String css,
                                          boolean isSpan,
                                          Locale userLocale)
Deprecated. use wiki2html(String, Locale, WikiRenderingHints)

Transform a given string formatted according the wiki text formatting rules in an HTML string.

Parameters:
text - the wiki text to format
css - the name of the CSS class to use
isSpan - if true generate a span instead of div
userLocale - an optionnal (though highly recommended) Locale of the user for which the text will be generated
Returns:
an HTML formatted text
Since:
jcms-5.5.0

wiki2html

public static String wiki2html(String text,
                               Locale userLocale,
                               WikiRenderingHints hints)
Transform a given string formatted according the wiki text formatting rules in an HTML string. The wiki formatting rules used follows the twiki.org text formatting rules:
Wiki formatHTML output
*bold*<b>italic</b>
_italic_<i>bold</i>
__bold italic__<b><i>bold italic</i></b>
=fixed font=<code>fixed font</code>
==bold fixed font==<code><b>bold fixed font</b></code>
Paragraphe
A blank line
<p>
Heading
At least three dashes at the beginning of a line, followed by plus sign and the heading text. One plus creates a level 1 heading (most important), two pluses a level 2 heading ; the maximum is 6.
---++ 1. A title
---+++ 1.1 A subtitle
<h1>A title</h1>
<h2>A subtitle</h2>
Separator
At least 3 dashes at the beginning of a line
---------
<hr>
List item
A multiple of three spaces and an asterisk
   * A list item
* A nested list item
<ul>
<li>A list item
<ul>
<li>A nested list item
</ul>
</ul>
Oredered list
A multiple of three spaces and a number
   1 A first item
2 A second item
<ol>
<li>A first item
<li>A second item
</ol>
Definition list
Three spaces, the term, a colon, followed by the definition

Note: Terms with spaces are not supported. In case you do have a term with more than one word, separate the words with dashes or with the &nbsp; non-breaking-space entity.

   USB: Universal Serial Bus
Firewire&nbsp;(IEEE&nbsp;1394): High Performance Serial Bus
<dl>
<dt>USB</dt><dd>Universal Serial Bus</dd>
<dt>Firewire&nbsp;(IEEE&nbsp;1394)</dt><dd>High Performance Serial Bus</dd>
</dl>
Publication Links
A publication's title or id enclosed in double square brackets.
[[The title of a publication]]
[[c_1234]]
<a href="link to the publication">Title of the publication</a>
Images insertion
A valid image file name (ending with .jpg, .gif or .png)
upload/gallery/image.jpg
<img src="upload/gallery/image.jpg">
File Links
A valid image file name enclosed in double square brackets.
[[upload/pdf/overview.pdf]]
<a href="upload/pdf/overview.pdf">overview.pdf</a>

Parameters:
text - the wiki text to format. if null or empty, an empty string is immediately returned.
userLocale - an optionnal (though highly recommended) Locale of the user for which the text will be generated. if null, the channel default locale will be used.
hints - the rendering options to use, if null, the default options will be used.
Returns:
an HTML formatted text.
Since:
jcms-5.7.0

extractSection

public static String extractSection(String text,
                                    String section)

updateSection

public static String updateSection(String text,
                                   String section,
                                   String update)

encodeSection

public static String encodeSection(Data data,
                                   String field,
                                   String update)

extractPubSetFromWiki

public static Set<Publication> extractPubSetFromWiki(String text)
Returns the set of publication referenced through wiki link in the given text.

Parameters:
text - the text
Returns:
the set of publication referenced through wiki link in the given text.
Since:
jcms-5.5.0

extractPubSetFromUrl

public static Set<Publication> extractPubSetFromUrl(String text)
Returns the set of publication referenced through URL in the given text.

Parameters:
text - the text
Returns:
the set of publication referenced through URL in the given text.
Since:
jcms-5.5.0


Copyright © 2001-2010 Jalios SA. All Rights Reserved.