@DefaultKey(value="templateTool") public class NoteTemplateTool extends Object
Constructor and Description |
---|
NoteTemplateTool() |
Modifier and Type | Method and Description |
---|---|
String |
blogAsJson(MinimalBlogData blog,
boolean xmlEncode)
Create a JSON with blog details.
|
String |
formatDate(String dateStyle,
String timeStyle,
Number timestamp,
NoteRenderContext renderContext)
Render a date localized date.
|
boolean |
isHtml(NoteRenderContext renderContext)
Helper for checking whether the current render mode is the HTML mode.
|
boolean |
isPlain(NoteRenderContext renderContext)
Helper for checking whether the current render mode is the PLAIN_TEXT mode.
|
boolean |
isPortal(NoteRenderContext renderContext)
Helper for checking whether the current render mode is the PORTAL mode.
|
boolean |
isRepost(NoteRenderContext renderContext)
Helper for checking whether the current render mode is one of the repost modes.
|
boolean |
isRepostHtml(NoteRenderContext renderContext)
Helper for checking whether the current render mode is one of the repost HTML mode.
|
boolean |
isRepostPlain(NoteRenderContext renderContext)
Helper for checking whether the current render mode is the REPOST_PLAIN_TEXT mode.
|
String |
userAsJson(UserData user,
boolean xmlEncode)
Create a JSON with user details.
|
public String blogAsJson(MinimalBlogData blog, boolean xmlEncode)
blog
- the blog to processxmlEncode
- whether characters that are reserved in XML should be encoded in the returned
stringpublic String formatDate(String dateStyle, String timeStyle, Number timestamp, NoteRenderContext renderContext)
dateStyle
- style string as it is supported by DateTool
timeStyle
- style string as it is supported by DateTool
timestamp
- the number of milliseconds since epochrenderContext
- the current render contextpublic boolean isHtml(NoteRenderContext renderContext)
renderContext
- the render contextpublic boolean isPlain(NoteRenderContext renderContext)
renderContext
- the render contextpublic boolean isPortal(NoteRenderContext renderContext)
renderContext
- the render contextpublic boolean isRepost(NoteRenderContext renderContext)
renderContext
- the render contextpublic boolean isRepostHtml(NoteRenderContext renderContext)
renderContext
- the render contextpublic boolean isRepostPlain(NoteRenderContext renderContext)
renderContext
- the render contextCopyright © 2019 Communote team. All rights reserved.