本文整理汇总了Java中org.commonmark.renderer.NodeRenderer类的典型用法代码示例。如果您正苦于以下问题:Java NodeRenderer类的具体用法?Java NodeRenderer怎么用?Java NodeRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeRenderer类属于org.commonmark.renderer包,在下文中一共展示了NodeRenderer类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: HtmlRenderer
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
private HtmlRenderer(Builder builder) {
this.softbreak = builder.softbreak;
this.escapeHtml = builder.escapeHtml;
this.percentEncodeUrls = builder.percentEncodeUrls;
this.attributeProviderFactories = new ArrayList<>(builder.attributeProviderFactories);
this.nodeRendererFactories = new ArrayList<>(builder.nodeRendererFactories.size() + 1);
this.nodeRendererFactories.addAll(builder.nodeRendererFactories);
// Add as last. This means clients can override the rendering of core nodes if they want.
this.nodeRendererFactories.add(new HtmlNodeRendererFactory() {
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
return new CoreHtmlNodeRenderer(context);
}
});
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:17,代码来源:HtmlRenderer.java
示例2: overrideNodeRender
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Test
public void overrideNodeRender() {
HtmlNodeRendererFactory nodeRendererFactory = new HtmlNodeRendererFactory() {
@Override
public NodeRenderer create(final HtmlNodeRendererContext context) {
return new NodeRenderer() {
@Override
public Set<Class<? extends Node>> getNodeTypes() {
return Collections.<Class<? extends Node>>singleton(Link.class);
}
@Override
public void render(Node node) {
context.getWriter().text("test");
}
};
}
};
HtmlRenderer renderer = HtmlRenderer.builder().nodeRendererFactory(nodeRendererFactory).build();
String rendered = renderer.render(parse("foo [bar](/url)"));
assertEquals("<p>foo test</p>\n", rendered);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:24,代码来源:HtmlRendererTest.java
示例3: extend
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Override
public void extend(HtmlRenderer.Builder rendererBuilder) {
rendererBuilder.nodeRendererFactory(new HtmlNodeRendererFactory() {
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
return new StrikethroughHtmlNodeRenderer(context);
}
});
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:10,代码来源:StrikethroughExtension.java
示例4: extend
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Override
public void extend(HtmlRenderer.Builder rendererBuilder) {
rendererBuilder.nodeRendererFactory(new HtmlNodeRendererFactory() {
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
return new InsNodeRenderer(context);
}
});
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:10,代码来源:InsExtension.java
示例5: TextContentRenderer
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
private TextContentRenderer(Builder builder) {
this.stripNewlines = builder.stripNewlines;
this.nodeRendererFactories = new ArrayList<>(builder.nodeRendererFactories.size() + 1);
this.nodeRendererFactories.addAll(builder.nodeRendererFactories);
// Add as last. This means clients can override the rendering of core nodes if they want.
this.nodeRendererFactories.add(new TextContentNodeRendererFactory() {
@Override
public NodeRenderer create(TextContentNodeRendererContext context) {
return new CoreTextContentNodeRenderer(context);
}
});
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:14,代码来源:TextContentRenderer.java
示例6: RendererContext
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
private RendererContext(TextContentWriter textContentWriter) {
this.textContentWriter = textContentWriter;
// The first node renderer for a node type "wins".
for (int i = nodeRendererFactories.size() - 1; i >= 0; i--) {
TextContentNodeRendererFactory nodeRendererFactory = nodeRendererFactories.get(i);
NodeRenderer nodeRenderer = nodeRendererFactory.create(this);
nodeRendererMap.add(nodeRenderer);
}
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:11,代码来源:TextContentRenderer.java
示例7: RendererContext
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
private RendererContext(HtmlWriter htmlWriter) {
this.htmlWriter = htmlWriter;
attributeProviders = new ArrayList<>(attributeProviderFactories.size());
for (AttributeProviderFactory attributeProviderFactory : attributeProviderFactories) {
attributeProviders.add(attributeProviderFactory.create(this));
}
// The first node renderer for a node type "wins".
for (int i = nodeRendererFactories.size() - 1; i >= 0; i--) {
HtmlNodeRendererFactory nodeRendererFactory = nodeRendererFactories.get(i);
NodeRenderer nodeRenderer = nodeRendererFactory.create(this);
nodeRendererMap.add(nodeRenderer);
}
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:16,代码来源:HtmlRenderer.java
示例8: customizeRendering
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Test
public void customizeRendering() {
Parser parser = Parser.builder().build();
HtmlRenderer renderer = HtmlRenderer.builder()
.nodeRendererFactory(new HtmlNodeRendererFactory() {
public NodeRenderer create(HtmlNodeRendererContext context) {
return new IndentedCodeBlockNodeRenderer(context);
}
})
.build();
Node document = parser.parse("Example:\n\n code");
assertEquals("<p>Example:</p>\n<pre>code\n</pre>\n", renderer.render(document));
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:15,代码来源:UsageExampleTest.java
示例9: extend
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Override
public void extend(HtmlRenderer.Builder rendererBuilder) {
rendererBuilder.nodeRendererFactory(new HtmlNodeRendererFactory() {
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
return new TableHtmlNodeRenderer(context);
}
});
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:10,代码来源:TablesExtension.java
示例10: create
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
// Compact paragraphs
return new DashCompactHtmlRenderer(context);
}
开发者ID:andresth,项目名称:Kandroid,代码行数:6,代码来源:DashProjectsAdapter.java
示例11: create
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
return new CompactHtmlRenderer(context);
}
开发者ID:andresth,项目名称:Kandroid,代码行数:5,代码来源:ProjectOverviewFragment.java
示例12: create
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
return new BlockRenderer(
context);
}
开发者ID:tpb1908,项目名称:AndroidProjectsClient,代码行数:6,代码来源:Markdown.java
示例13: add
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
public void add(NodeRenderer nodeRenderer) {
for (Class<? extends Node> nodeType : nodeRenderer.getNodeTypes()) {
// Overwrite existing renderer
renderers.put(nodeType, nodeRenderer);
}
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:7,代码来源:NodeRendererMap.java
示例14: render
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
public void render(Node node) {
NodeRenderer nodeRenderer = renderers.get(node.getClass());
if (nodeRenderer != null) {
nodeRenderer.render(node);
}
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:7,代码来源:NodeRendererMap.java
示例15: create
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
@Override
public NodeRenderer create(HtmlNodeRendererContext context) {
return new UpperCaseNodeRenderer(context);
}
开发者ID:atlassian,项目名称:commonmark-java,代码行数:5,代码来源:DelimiterProcessorTest.java
示例16: create
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
/**
* Create a new node renderer for the specified rendering context.
*
* @param context the context for rendering (normally passed on to the node renderer)
* @return a node renderer
*/
NodeRenderer create(TextContentNodeRendererContext context);
开发者ID:atlassian,项目名称:commonmark-java,代码行数:8,代码来源:TextContentNodeRendererFactory.java
示例17: create
import org.commonmark.renderer.NodeRenderer; //导入依赖的package包/类
/**
* Create a new node renderer for the specified rendering context.
*
* @param context the context for rendering (normally passed on to the node renderer)
* @return a node renderer
*/
NodeRenderer create(HtmlNodeRendererContext context);
开发者ID:atlassian,项目名称:commonmark-java,代码行数:8,代码来源:HtmlNodeRendererFactory.java
注:本文中的org.commonmark.renderer.NodeRenderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论