Add spec test to inline-parser module
This commit is contained in:
parent
f2f5026694
commit
136c6bd51b
@ -85,7 +85,8 @@ ext {
|
|||||||
'robolectric' : 'org.robolectric:robolectric:3.8',
|
'robolectric' : 'org.robolectric:robolectric:3.8',
|
||||||
'ix-java' : 'com.github.akarnokd:ixjava:1.0.0',
|
'ix-java' : 'com.github.akarnokd:ixjava:1.0.0',
|
||||||
'commons-io' : 'commons-io:commons-io:2.6',
|
'commons-io' : 'commons-io:commons-io:2.6',
|
||||||
'mockito' : 'org.mockito:mockito-core:2.21.0'
|
'mockito' : 'org.mockito:mockito-core:2.21.0',
|
||||||
|
'commonmark-test-util': "com.atlassian.commonmark:commonmark-test-util:$commonMarkVersion",
|
||||||
]
|
]
|
||||||
|
|
||||||
registerArtifact = this.®isterArtifact
|
registerArtifact = this.®isterArtifact
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
// this is a generated file, do not modify. To update it run 'collectArtifacts.js' script
|
// this is a generated file, do not modify. To update it run 'collectArtifacts.js' script
|
||||||
const artifacts = [{"id":"core","name":"Core","group":"io.noties.markwon","description":"Core Markwon artifact that includes basic markdown parsing and rendering"},{"id":"editor","name":"Editor","group":"io.noties.markwon","description":"Markdown editor based on Markwon"},{"id":"ext-latex","name":"LaTeX","group":"io.noties.markwon","description":"Extension to add LaTeX formulas to Markwon markdown"},{"id":"ext-strikethrough","name":"Strikethrough","group":"io.noties.markwon","description":"Extension to add strikethrough markup to Markwon markdown"},{"id":"ext-tables","name":"Tables","group":"io.noties.markwon","description":"Extension to add tables markup (GFM) to Markwon markdown"},{"id":"ext-tasklist","name":"Task List","group":"io.noties.markwon","description":"Extension to add task lists (GFM) to Markwon markdown"},{"id":"html","name":"HTML","group":"io.noties.markwon","description":"Provides HTML parsing functionality"},{"id":"image","name":"Image","group":"io.noties.markwon","description":"Markwon image loading module (with optional GIF and SVG support)"},{"id":"image-glide","name":"Image Glide","group":"io.noties.markwon","description":"Markwon image loading module (based on Glide library)"},{"id":"image-picasso","name":"Image Picasso","group":"io.noties.markwon","description":"Markwon image loading module (based on Picasso library)"},{"id":"linkify","name":"Linkify","group":"io.noties.markwon","description":"Markwon plugin to linkify text (based on Android Linkify)"},{"id":"recycler","name":"Recycler","group":"io.noties.markwon","description":"Provides RecyclerView.Adapter to display Markwon markdown"},{"id":"recycler-table","name":"Recycler Table","group":"io.noties.markwon","description":"Provides MarkwonAdapter.Entry to render TableBlocks inside Android-native TableLayout widget"},{"id":"simple-ext","name":"Simple Extension","group":"io.noties.markwon","description":"Custom extension based on simple delimiter usage"},{"id":"syntax-highlight","name":"Syntax Highlight","group":"io.noties.markwon","description":"Add syntax highlight to Markwon markdown via Prism4j library"}];
|
const artifacts = [{"id":"core","name":"Core","group":"io.noties.markwon","description":"Core Markwon artifact that includes basic markdown parsing and rendering"},{"id":"editor","name":"Editor","group":"io.noties.markwon","description":"Markdown editor based on Markwon"},{"id":"ext-latex","name":"LaTeX","group":"io.noties.markwon","description":"Extension to add LaTeX formulas to Markwon markdown"},{"id":"ext-strikethrough","name":"Strikethrough","group":"io.noties.markwon","description":"Extension to add strikethrough markup to Markwon markdown"},{"id":"ext-tables","name":"Tables","group":"io.noties.markwon","description":"Extension to add tables markup (GFM) to Markwon markdown"},{"id":"ext-tasklist","name":"Task List","group":"io.noties.markwon","description":"Extension to add task lists (GFM) to Markwon markdown"},{"id":"html","name":"HTML","group":"io.noties.markwon","description":"Provides HTML parsing functionality"},{"id":"image","name":"Image","group":"io.noties.markwon","description":"Markwon image loading module (with optional GIF and SVG support)"},{"id":"image-glide","name":"Image Glide","group":"io.noties.markwon","description":"Markwon image loading module (based on Glide library)"},{"id":"image-picasso","name":"Image Picasso","group":"io.noties.markwon","description":"Markwon image loading module (based on Picasso library)"},{"id":"inline-parser","name":"Inline Parser","group":"io.noties.markwon","description":"Markwon customizable commonmark-java InlineParser"},{"id":"linkify","name":"Linkify","group":"io.noties.markwon","description":"Markwon plugin to linkify text (based on Android Linkify)"},{"id":"recycler","name":"Recycler","group":"io.noties.markwon","description":"Provides RecyclerView.Adapter to display Markwon markdown"},{"id":"recycler-table","name":"Recycler Table","group":"io.noties.markwon","description":"Provides MarkwonAdapter.Entry to render TableBlocks inside Android-native TableLayout widget"},{"id":"simple-ext","name":"Simple Extension","group":"io.noties.markwon","description":"Custom extension based on simple delimiter usage"},{"id":"syntax-highlight","name":"Syntax Highlight","group":"io.noties.markwon","description":"Add syntax highlight to Markwon markdown via Prism4j library"}];
|
||||||
export { artifacts };
|
export { artifacts };
|
||||||
|
@ -16,6 +16,11 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
api deps['x-annotations']
|
api deps['x-annotations']
|
||||||
api deps['commonmark']
|
api deps['commonmark']
|
||||||
|
|
||||||
|
deps['test'].with {
|
||||||
|
testImplementation it['junit']
|
||||||
|
testImplementation it['commonmark-test-util']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registerArtifact(this)
|
registerArtifact(this)
|
@ -1,4 +1,4 @@
|
|||||||
POM_NAME=Inline Parser
|
POM_NAME=Inline Parser
|
||||||
POM_ARTIFACT_ID=inline-parser
|
POM_ARTIFACT_ID=inline-parser
|
||||||
POM_DESCRIPTION=Markwon customizable commonmark-java InlineParse
|
POM_DESCRIPTION=Markwon customizable commonmark-java InlineParser
|
||||||
POM_PACKAGING=aar
|
POM_PACKAGING=aar
|
@ -0,0 +1,25 @@
|
|||||||
|
package io.noties.markwon.inlineparser;
|
||||||
|
|
||||||
|
import org.commonmark.parser.Parser;
|
||||||
|
import org.commonmark.renderer.html.HtmlRenderer;
|
||||||
|
import org.commonmark.testutil.SpecTestCase;
|
||||||
|
import org.commonmark.testutil.example.Example;
|
||||||
|
|
||||||
|
public class InlineParserSpecTest extends SpecTestCase {
|
||||||
|
|
||||||
|
private static final Parser PARSER = Parser.builder()
|
||||||
|
.inlineParserFactory(MarkwonInlineParser.factoryBuilder().includeDefaults().build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// The spec says URL-escaping is optional, but the examples assume that it's enabled.
|
||||||
|
private static final HtmlRenderer RENDERER = HtmlRenderer.builder().percentEncodeUrls(true).build();
|
||||||
|
|
||||||
|
public InlineParserSpecTest(Example example) {
|
||||||
|
super(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String render(String source) {
|
||||||
|
return RENDERER.render(PARSER.parse(source));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user