• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NodeRendererContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vladsch.flexmark.html.renderer.NodeRendererContext的典型用法代码示例。如果您正苦于以下问题:Java NodeRendererContext类的具体用法?Java NodeRendererContext怎么用?Java NodeRendererContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NodeRendererContext类属于com.vladsch.flexmark.html.renderer包,在下文中一共展示了NodeRendererContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseBuildAndRender

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private String parseBuildAndRender(String text) {
    Parser parser = Parser.builder(OPTIONS)
            .extensions(EXTENSIONS)
            .build();

    HtmlRenderer renderer = HtmlRenderer.builder(OPTIONS)
            .escapeHtml(mEscapeHtml)
            .attributeProviderFactory(new IndependentAttributeProviderFactory() {
                @Override
                public AttributeProvider create(NodeRendererContext context) {
                    return new CustomAttributeProvider();
                }
            })
            .nodeRendererFactory(new NodeRendererFactoryImpl())
            .extensions(EXTENSIONS)
            .build();

    return renderer.render(parser.parse(text));
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:20,代码来源:MarkdownView.java


示例2: render

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void render(final Button node, final NodeRendererContext context, final HtmlWriter html) {
    final String id = node.getUrl().toString();

    if (!TextUtils.isEmpty(id)) {
        html.attr("id", id);
        html.attr("onclick", String.format("javascript:android.onButtonTap('%s');", id));
        html.srcPos(node.getChars()).withAttr().tag("button");
        context.renderChildren(node);
        html.tag("/button");
    } else {
        context.renderChildren(node);
    }
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:14,代码来源:ButtonNodeRenderer.java


示例3: render

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void render(Emoji node, NodeRendererContext context, HtmlWriter html) {
    Emoji emoji = (Emoji) node;
    EmojiCheatSheet.EmojiShortcut shortcut = EmojiCheatSheet.getImageShortcut(emoji.getText().toString());

    if (shortcut == null) {
        // output as text
        html.text(":");
        context.renderChildren(node);
        html.text(":");
    } else {
        ResolvedLink resolvedLink = context.resolveLink(LinkType.LINK, rootImagePath + shortcut.image + "." + extImage, null);

        html.attr("src", resolvedLink.getUrl());
        html.attr("alt", "emoji " + shortcut.category + ":" + shortcut.name);
        if (!attrImageSize.isEmpty())
            html.attr("height", attrImageSize).attr("width", attrImageSize);
        if (!attrAlign.isEmpty()) html.attr("align", attrAlign);
        html.withAttr(resolvedLink);
        html.tagVoid("img");
    }
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:22,代码来源:EmojiNodeRenderer.java


示例4: render

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void render(final VideoLink node, final NodeRendererContext context, final HtmlWriter html) {
    final String name = node.getText().toString();

    if (context.isDoNotRenderLinks()) {
        context.renderChildren(node);
    } else if (!TextUtils.isEmpty(name)) {
        ResolvedLink resolvedLink = context.resolveLink(LinkType.LINK, node.getUrl().unescape(), null);
        if (name.equals("youtube") ||
                name.equals("yt")) {
            html.attr("class", "player yt-player");
            html.withAttr().tag("div");
            html.attr("type", "text/html");
            html.attr("frameborder", "0");

            html.attr("allowfullscreen", "");
            html.attr("src", String.format("https://www.youtube.com/embed/%s", resolvedLink.getUrl()));
            html.srcPos(node.getChars()).withAttr(resolvedLink).tag("iframe");
            html.tag("/iframe");
            html.tag("/div");
        } else {
            context.renderChildren(node);
        }
    }
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:25,代码来源:VideoLinkNodeRenderer.java


示例5: renderHeading

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void renderHeading(final Heading node, final NodeRendererContext context, final HtmlWriter html) {
    if (context.getHtmlOptions().renderHeaderId) {
        String id = context.getNodeId(node);
        if (id != null) {
            html.attr("id", id);
        }
    }

    if (context.getHtmlOptions().sourcePositionParagraphLines) {
        html.srcPos(node.getChars()).withAttr().tagLine("h" + (node.getLevel()+renderContext.incrementHeading()), new Runnable() {
            @Override
            public void run() {
                html.srcPos(node.getText()).withAttr().tag("span");
                context.renderChildren(node);
                html.tag("/span");
            }
        });
    } else {
        html.srcPos(node.getText()).withAttr().tagLine("h" + (node.getLevel()+renderContext.incrementHeading()), new Runnable() {
            @Override
            public void run() {
                context.renderChildren(node);
            }
        });
    }
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:27,代码来源:Markdown2Html.java


示例6: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(Localization.class, new CustomNodeRenderer<Localization>() {
        @Override
        public void render(Localization node, NodeRendererContext context, HtmlWriter html) {
            LocalizationNodeRenderer.this.render(node, context, html);
        }
    }));

    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:13,代码来源:LocalizationNodeRenderer.java


示例7: render

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void render(Localization node, NodeRendererContext context, HtmlWriter html) {
    if (mContext != null) {
        String packageName = mContext.getPackageName();
        String name = node.getText().toString().trim();
        int identifier = mContext.getResources().getIdentifier(name, "string", packageName);
        if (identifier > 0) {
            html.attr("class", "localization");
            html.withAttr().tag("span");
            html.append(mContext.getString(identifier));
            html.tag("/span");
        }
    }
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:14,代码来源:LocalizationNodeRenderer.java


示例8: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(Twitter.class, new CustomNodeRenderer<Twitter>() {
        @Override
        public void render(Twitter node, NodeRendererContext context, HtmlWriter html) {
            TwitterNodeRenderer.this.render(node, context, html);
        }
    }));
    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:12,代码来源:TwitterNodeRenderer.java


示例9: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(Keystroke.class, new CustomNodeRenderer<Keystroke>() {
        @Override
        public void render(Keystroke node, NodeRendererContext context, HtmlWriter html) {
            KeystrokeNodeRenderer.this.render(node, context, html);
        }
    }));

    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:13,代码来源:KeystrokeNodeRenderer.java


示例10: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(Mark.class, new CustomNodeRenderer<Mark>() {
        @Override
        public void render(Mark node, NodeRendererContext context, HtmlWriter html) {
            MarkNodeRenderer.this.render(node, context, html);
        }
    }));

    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:13,代码来源:MarkNodeRenderer.java


示例11: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(Button.class, new CustomNodeRenderer<Button>() {
        @Override
        public void render(Button node, NodeRendererContext context, HtmlWriter html) {
            ButtonNodeRenderer.this.render(node, context, html);
        }
    }));
    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:12,代码来源:ButtonNodeRenderer.java


示例12: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(MathJax.class, new CustomNodeRenderer<MathJax>() {
        @Override
        public void render(MathJax node, NodeRendererContext context, HtmlWriter html) {
            MathJaxNodeRenderer.this.render(node, context, html);
        }
    }));

    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:13,代码来源:MathJaxNodeRenderer.java


示例13: render

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void render(MathJax node, NodeRendererContext context, HtmlWriter html) {
    html.withAttr().tag("math");
    html.append("$");
    context.renderChildren(node);
    html.append("$");
    html.tag("/math");
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:8,代码来源:MathJaxNodeRenderer.java


示例14: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(Label.class, new CustomNodeRenderer<Label>() {
        @Override
        public void render(Label node, NodeRendererContext context, HtmlWriter html) {
            LabelNodeRenderer.this.render(node, context, html);
        }
    }));

    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:13,代码来源:LabelNodeRenderer.java


示例15: render

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void render(Label node, NodeRendererContext context, HtmlWriter html) {
    if (node.getType() == 3) html.attr("class", "lbl-success");
    else if (node.getType() == 4) html.attr("class", "lbl-warning");
    else if (node.getType() == 5) html.attr("class", "lbl-danger");
    html.withAttr().tag("lbl");
    context.renderChildren(node);
    html.tag("/lbl");
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:9,代码来源:LabelNodeRenderer.java


示例16: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(Emoji.class, new CustomNodeRenderer<Emoji>() {
        @Override
        public void render(Emoji node, NodeRendererContext context, HtmlWriter html) {
            EmojiNodeRenderer.this.render(node, context, html);
        }
    }));
    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:12,代码来源:EmojiNodeRenderer.java


示例17: getNodeRenderingHandlers

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
@Override
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
    HashSet<NodeRenderingHandler<?>> set = new HashSet<>();
    set.add(new NodeRenderingHandler<>(VideoLink.class, new CustomNodeRenderer<VideoLink>() {
        @Override
        public void render(VideoLink node, NodeRendererContext context, HtmlWriter html) {
            VideoLinkNodeRenderer.this.render(node, context, html);
        }
    }));
    return set;
}
 
开发者ID:tiagohm,项目名称:MarkdownView,代码行数:12,代码来源:VideoLinkNodeRenderer.java


示例18: renderBlockQuote

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
protected void renderBlockQuote(BlockQuote node, NodeRendererContext context, HtmlWriter html) {
    	html.withAttr().tagLineIndent("blockquote", new Runnable() {
        @Override
        public void run() {
//        	html.text(Escaping.escapeHtml(node.getChars(), false));
            context.renderChildren(node);
        }
    	});
		}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:10,代码来源:Markdown2Html.java


示例19: parseBuildAndRender

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private String parseBuildAndRender(String text) {
    Parser parser = Parser.builder(OPTIONS).extensions(EXTENSIONS).build();
    HtmlRenderer renderer = HtmlRenderer.builder(OPTIONS).escapeHtml(mEscapeHtml)
            .attributeProviderFactory(new IndependentAttributeProviderFactory() {
                public AttributeProvider create(NodeRendererContext context) {
                    return new CustomAttributeProvider();
                }
            }).nodeRendererFactory(
                    new MarkdownView.NodeRendererFactoryImpl())
            .extensions(EXTENSIONS).build();
    return renderer.render(parser.parse(text));
}
 
开发者ID:sorcererXW,项目名称:SorceryIconPack,代码行数:13,代码来源:AsynMarkdownView.java


示例20: renderFencedCodeBlock

import com.vladsch.flexmark.html.renderer.NodeRendererContext; //导入依赖的package包/类
private void renderFencedCodeBlock(FencedCodeBlock fencedCodeBlock, NodeRendererContext context, HtmlWriter htmlWriter) {
    String language = fencedCodeBlock.getInfo().toString();
    if (language.isEmpty()) {
        // confluence defaults to java
        language = "java";
    }
    String code = fencedCodeBlock.getChildChars().toString();

    write(code, language, htmlWriter);
}
 
开发者ID:borisdiakur,项目名称:marked,代码行数:11,代码来源:ConfluenceCodeBlockExtension.java



注:本文中的com.vladsch.flexmark.html.renderer.NodeRendererContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConnectorMetadata类代码示例发布时间:2022-05-23
下一篇:
Java HorizontalBarChartRenderer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap