use of com.vladsch.flexmark.ast.HtmlInline in project jspwiki by apache.
the class NodePostProcessorStateCommonOperations method makeError.
static void makeError(final NodeTracker state, final Node node, final String errMsg) {
final HtmlInline error = new HtmlInline(CharSubSequence.of("<span class=\"error\">" + errMsg + "</span>"));
addContent(state, node, error);
}
use of com.vladsch.flexmark.ast.HtmlInline in project jspwiki by apache.
the class NodePostProcessorStateCommonOperations method inlineLinkTextOnWysiwyg.
static String inlineLinkTextOnWysiwyg(final NodeTracker state, final JSPWikiLink link, final boolean wysiwygEditorMode) {
final String line = link.getUrl().toString();
if (wysiwygEditorMode) {
final HtmlInline content = new HtmlInline(CharSubSequence.of("[" + line + "]()"));
addContent(state, link, content);
}
return line;
}
use of com.vladsch.flexmark.ast.HtmlInline in project jspwiki by apache.
the class PluginLinkNodePostProcessorState method handleTableOfContentsPlugin.
void handleTableOfContentsPlugin(final NodeTracker state, final JSPWikiLink link) {
if (!m_wysiwygEditorMode) {
final ResourceBundle rb = Preferences.getBundle(wikiContext, WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
final HtmlInline divToc = new HtmlInline(CharSubSequence.of("<div class=\"toc\">\n"));
final HtmlInline divCollapseBox = new HtmlInline(CharSubSequence.of("<div class=\"collapsebox\">\n"));
final HtmlInline divsClosing = new HtmlInline(CharSubSequence.of("</div>\n</div>\n"));
final HtmlInline h4Title = new HtmlInline(CharSubSequence.of(// FIXME proper plugin parameters handling
"<h4 id=\"section-TOC\">" + rb.getString("tableofcontents.title") + "</h4>\n"));
final TocBlock toc = new TocBlock(CharSubSequence.of("[TOC]"), CharSubSequence.of("levels=1-3"));
link.insertAfter(divToc);
divToc.insertAfter(divCollapseBox);
divCollapseBox.insertAfter(h4Title);
h4Title.insertAfter(toc);
toc.insertAfter(divsClosing);
} else {
NodePostProcessorStateCommonOperations.inlineLinkTextOnWysiwyg(state, link, m_wysiwygEditorMode);
}
removeLink(state, link);
}
use of com.vladsch.flexmark.ast.HtmlInline in project jspwiki by apache.
the class ImageLinkNodePostProcessorState method process.
/**
* {@inheritDoc}
*
* @see NodePostProcessorState#process(NodeTracker, JSPWikiLink)
*/
@Override
public void process(final NodeTracker state, final JSPWikiLink link) {
final HtmlInline img = new HtmlInline(CharSubSequence.of("<img class=\"inline\" " + "src=\"" + urlRef + "\" " + "alt=\"" + link.getText().toString() + "\" />"));
if ((isLinkFromText && linkOperations.isExternalLink(link.getText().toString())) || (isLinkFromText && linkOperations.linkExists(link.getText().toString()))) {
link.setUrl(CharSubSequence.of(urlRef));
link.removeChildren();
link.appendChild(img);
state.nodeAdded(img);
} else {
NodePostProcessorStateCommonOperations.addContent(state, link, img);
}
}
Aggregations