Search in sources :

Example 6 with HtmlInline

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);
}
Also used : HtmlInline(com.vladsch.flexmark.ast.HtmlInline)

Example 7 with HtmlInline

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;
}
Also used : HtmlInline(com.vladsch.flexmark.ast.HtmlInline)

Example 8 with HtmlInline

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);
}
Also used : HtmlInline(com.vladsch.flexmark.ast.HtmlInline) ResourceBundle(java.util.ResourceBundle) TocBlock(com.vladsch.flexmark.ext.toc.TocBlock)

Example 9 with HtmlInline

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);
    }
}
Also used : HtmlInline(com.vladsch.flexmark.ast.HtmlInline)

Aggregations

HtmlInline (com.vladsch.flexmark.ast.HtmlInline)9 ResourceBundle (java.util.ResourceBundle)2 TocBlock (com.vladsch.flexmark.ext.toc.TocBlock)1 NoSuchVariableException (org.apache.wiki.api.exceptions.NoSuchVariableException)1 PluginException (org.apache.wiki.api.exceptions.PluginException)1 PluginContent (org.apache.wiki.parser.PluginContent)1