本文整理汇总了Java中org.pegdown.Extensions.ALL属性的典型用法代码示例。如果您正苦于以下问题:Java Extensions.ALL属性的具体用法?Java Extensions.ALL怎么用?Java Extensions.ALL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.pegdown.Extensions
的用法示例。
在下文中一共展示了Extensions.ALL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: check
private void check(PegDownPlugins.Builder extraPluginsBuilder, String markdown, String expectedAst) {
Reference<Parser> parserRef = new Reference<Parser>();
PegDownPlugins plugins =
(extraPluginsBuilder == null ? PegDownPlugins.builder() : extraPluginsBuilder)
.withPlugin(GenericBoxPlugin.class, parserRef)
.build();
// ---
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
parserRef.set(processor.parser);
RootNode rootNode = processor.parseMarkdown(normalize(markdown).toCharArray());
String s = dumpAST(rootNode);
System.out.println("GenericBoxPluginTest.check::" + s);
assertThat(normalize(s.trim())).isEqualTo(normalize(expectedAst));
}
示例2: check
private void check(String markdown, String expectedAst) {
Reference<Parser> parserRef = new Reference<Parser>();
PegDownPlugins plugins =
PegDownPlugins.builder()
.withPlugin(LinkContentPlugin.class, parserRef)
.build();
// ---
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
parserRef.set(processor.parser);
RootNode rootNode = processor.parseMarkdown(normalize(markdown).toCharArray());
String s = dumpAST(rootNode);
assertThat(normalize(s.trim())).isEqualTo(normalize(expectedAst));
}
示例3: astBuild_simpleCase
@Test
public void astBuild_simpleCase() throws IOException {
String mkd = loadResource("attributesText-simple.md").trim();
String ast = loadResource("attributesText-simple.ast").trim();
PegDownPlugins plugins = PegDownPlugins
.builder()
.withPlugin(AttributesPlugin.class)
.build();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
RootNode rootNode = processor.parseMarkdown(normalize(mkd).toCharArray());
String s = dumpAST(rootNode);
assertThat(normalize(s.trim())).isEqualTo(normalize(ast));
}
示例4: astBuild_advancedCase
@Test
public void astBuild_advancedCase() throws IOException {
String mkd = loadResource("attributesText.md").trim();
String ast = loadResource("attributesText.ast").trim();
PegDownPlugins plugins = PegDownPlugins
.builder()
.withPlugin(AttributesPlugin.class)
.build();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
RootNode rootNode = processor.parseMarkdown(normalize(mkd).toCharArray());
String s = dumpAST(rootNode);
assertThat(normalize(s.trim())).isEqualTo(normalize(ast));
}
示例5: processString
private void processString(String usecase, String mkd, Function<InvocationContext, InvocationContext> customizer) throws Exception {
Reference<Parser> parserRef = new Reference<Parser>();
ITextContext iTextContext = openDocument(usecase);
PegDownPlugins plugins = PegDownPlugins
.builder()
.withPlugin(AttributesPlugin.class)
.withPlugin(GenericBoxPlugin.class, parserRef)
.build();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
parserRef.set(processor.parser);
RootNode rootNode = processor.parseMarkdown(mkd.toCharArray());
InvocationContext context = customizer.apply(new InvocationContext(iTextContext));
if (context == null) {
fail("No context");
return;
}
context.process(0, rootNode);
context.flushPendingChapter();
iTextContext.close();
}
示例6: dumpAST
@Test
@Parameters({
"astText.md, astText.ast",
})
public void dumpAST(String mkdSrc, String astSrc) throws IOException {
String mkd = loadResource(mkdSrc).trim();
String ast = loadResource(astSrc).trim();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL);
RootNode rootNode = processor.parseMarkdown(normalize(mkd).toCharArray());
String s = dumpAST(rootNode);
assertThat(normalize(s.trim())).isEqualTo(normalize(ast));
}
示例7: table_multi_line_cell
@Test
@Ignore("Multiline cell not supported")
public void table_multi_line_cell() throws Exception {
String mkd = loadResource("table-multiline-cells.md").trim();
String ast = loadResource("table-multiline-cells.ast").trim();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL);
RootNode rootNode = processor.parseMarkdown(mkd.toCharArray());
String s = dumpAST(rootNode);
assertThat(normalize(s.trim())).isEqualTo(normalize(ast));
}
示例8: table1AST__with_caption_column_alignment_colspan
@Test
public void table1AST__with_caption_column_alignment_colspan() throws Exception {
String mkd = loadResource("table1.md").trim();
String ast = loadResource("table1.ast").trim();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL);
RootNode rootNode = processor.parseMarkdown(normalize(mkd).toCharArray());
String s = new Dumper(normalize(mkd)).dump(rootNode).out.toString();
assertThat(normalize(s.trim())).isEqualTo(normalize(ast));
}
示例9: line_break_within_paragraph
@Test
public void line_break_within_paragraph() throws Exception {
String mkd = "" +
"Two empty space at the end of the line \n" +
"should act as a new line in the paragraph\n" +
"\n" +
"This should be an other paragraph...\n" +
"but with no space at the end of the line\n" +
"\n" +
"\n" +
"And yet another one";
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL);
RootNode rootNode = processor.parseMarkdown(normalize(mkd).toCharArray());
String s = new Dumper(normalize(mkd)).dump(rootNode).out.toString();
assertThat(normalize(s.trim())).isEqualTo(normalize("" +
"RootNode [0-185]\n" +
" ParaNode [0-84]\n" +
" SuperNode [0-82]\n" +
" TextNode [0-38] 'Two empty space at the end of the line'\n" +
" SimpleNode [38-41] Linebreak\n" +
" TextNode [41-82] 'should act as a new line in the paragraph'\n" +
" ParaNode [84-164]\n" +
" SuperNode [84-161]\n" +
" TextNode [84-117] 'This should be an other paragraph'\n" +
" SimpleNode [117-120] Ellipsis\n" +
" SimpleNode [120-121] Linebreak\n" +
" TextNode [121-161] 'but with no space at the end of the line'\n" +
" ParaNode [164-185]\n" +
" SuperNode [164-183]\n" +
" TextNode [164-183] 'And yet another one'"));
}
示例10: parseMarkdown
private RootNode parseMarkdown(String resourcePath) throws IOException {
String mkd = loadResource(resourcePath).trim();
PegDownPlugins plugins = PegDownPlugins
.builder()
.withPlugin(AttributesPlugin.class)
.build();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
return processor.parseMarkdown(mkd.toCharArray());
}
示例11: usecase__sibling_then_of_type
@Test
@SuppressWarnings("unchecked")
public void usecase__sibling_then_of_type() throws Exception {
String mkd = loadResource("image-04-ref.md").trim();
PegDownPlugins plugins = PegDownPlugins
.builder()
.withPlugin(AttributesPlugin.class)
.build();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
RootNode rootNode = processor.parseMarkdown(mkd.toCharArray());
TreeNavigation nav;
nav = new TreeNavigation();
nav.push(rootNode);
nav.pushChild(3);
assertThat(nav.peek()).isInstanceOf(ParaNode.class);
//
//
Optional<TreeNavigation> result =
siblingBefore()
.then(ofType(AttributesNode.class))
.query(nav);
assertThat(result.isPresent()).isTrue();
assertThat(result.get().peek()).isInstanceOf(AttributesNode.class);
}
示例12: extensionFor
private int extensionFor(String name) {
int extension = Extensions.NONE;
if (name.equals("HARDWRAPS")) {
extension = Extensions.HARDWRAPS;
} else if (name.equals("AUTOLINKS")) {
extension = Extensions.AUTOLINKS;
} else if (name.equals("FENCED_CODE_BLOCKS")) {
extension = Extensions.FENCED_CODE_BLOCKS;
} else if (name.equals("DEFINITIONS")) {
extension = Extensions.DEFINITIONS;
} else if (name.equals("ABBREVIATIONS")) {
extension = Extensions.ABBREVIATIONS;
} else if (name.equals("QUOTES")) {
extension = Extensions.QUOTES;
} else if (name.equals("SMARTS")) {
extension = Extensions.SMARTS;
} else if (name.equals("SMARTYPANTS")) {
extension = Extensions.SMARTYPANTS;
} else if (name.equals("SUPPRESS_ALL_HTML")) {
extension = Extensions.SUPPRESS_ALL_HTML;
} else if (name.equals("SUPPRESS_HTML_BLOCKS")) {
extension = Extensions.SUPPRESS_HTML_BLOCKS;
} else if (name.equals("SUPPRESS_INLINE_HTML")) {
extension = Extensions.SUPPRESS_INLINE_HTML;
} else if (name.equals("TABLES")) {
extension = Extensions.TABLES;
} else if (name.equals("WIKILINKS")) {
extension = Extensions.WIKILINKS;
} else if (name.equals("ANCHORLINKS")) {
extension = Extensions.ANCHORLINKS;
} else if (name.equals("STRIKETHROUGH")) {
extension = Extensions.STRIKETHROUGH;
}else if (name.equals("ATXHEADERSPACE")) {
extension = Extensions.ATXHEADERSPACE;
}else if (name.equals("FORCELISTITEMPARA")) {
extension = Extensions.FORCELISTITEMPARA;
}else if (name.equals("RELAXEDHRULES")) {
extension = Extensions.RELAXEDHRULES;
}else if (name.equals("TASKLISTITEMS")) {
extension = Extensions.TASKLISTITEMS;
}else if (name.equals("EXTANCHORLINKS")) {
extension = Extensions.EXTANCHORLINKS;
} else if (name.equals("ALL")) {
extension = Extensions.ALL;
} else if (name.equals("ALL_OPTIONALS")) {
extension = Extensions.ALL_OPTIONALS;
} else if (name.equals("ALL_WITH_OPTIONALS")) {
extension = Extensions.ALL_WITH_OPTIONALS;
}
return extension;
}
示例13: MarkdownViewRenderer
public MarkdownViewRenderer() {
this(new PegDownProcessor(Extensions.ALL & ~Extensions.ANCHORLINKS));
}
示例14: fileResourceProcessor
private static Function<FileResourceParameters, FileResourceProcessorOutput> fileResourceProcessor() {
PegDownProcessor pegDownProcessor = new PegDownProcessor(Extensions.ALL);
return params -> new FileResourceProcessorOutput(pegDownProcessor.markdownToHtml(params.fileResource.getContent().orElseThrow(IllegalArgumentException::new)), params.fileResource.getPath(), "markdown", params.locale);
}
示例15: usecase__ancestor_sibling_and_of_type
@Test
@SuppressWarnings("unchecked")
public void usecase__ancestor_sibling_and_of_type() throws Exception {
String mkd = loadResource("image-04-ref.md").trim();
PegDownPlugins plugins = PegDownPlugins
.builder()
.withPlugin(AttributesPlugin.class)
.build();
PegDownProcessor processor = new PegDownProcessor(Extensions.ALL, plugins);
RootNode rootNode = processor.parseMarkdown(mkd.toCharArray());
TreeNavigation nav;
nav = new TreeNavigation();
nav.push(rootNode);
nav.pushChild(3);
nav.pushChild();
nav.pushChild();
assertThat(nav.peek()).isInstanceOf(RefImageNode.class);
//
//
Optional<TreeNavigation> result1 =
ancestor(RefImageNode.class, SuperNode.class, ParaNode.class)
.query(nav);
assertThat(result1.isPresent()).isTrue();
assertThat(result1.get().peek()).isInstanceOf(ParaNode.class);
//
//
Optional<TreeNavigation> result2 =
ancestor(RefImageNode.class, SuperNode.class, ParaNode.class)
.then(siblingBefore())
.query(nav);
assertThat(result2.isPresent()).isTrue();
assertThat(result2.get().peek()).isInstanceOf(AttributesNode.class);
//
//
Optional<TreeNavigation> result3 =
firstAncestorOfType(ParaNode.class)
.then(siblingBefore())
.query(nav);
assertThat(result3.isPresent()).isTrue();
assertThat(result3.get().peek()).isInstanceOf(AttributesNode.class);
//System.out.println("TreeNavigationTest.usecase" + dumpAST(rootNode));
}