commonmarker 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/commonmarker/cmark/CMakeLists.txt +2 -1
- data/ext/commonmarker/cmark/Makefile +2 -2
- data/ext/commonmarker/cmark/api_test/main.c +45 -0
- data/ext/commonmarker/cmark/build/CMakeCache.txt +473 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeCCompiler.cmake +68 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeCXXCompiler.cmake +70 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeSystem.cmake +15 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdC/CMakeCCompilerId.c +567 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdC/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdCXX/CMakeCXXCompilerId.cpp +539 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdCXX/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +14 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +637 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +156 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +390 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +48 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/cmake.check_cache +1 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.c +34 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.cxx +405 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/CTestTestfile.cmake +11 -0
- data/ext/commonmarker/cmark/build/Makefile +280 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +35 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +168 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +17 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/progress.make +5 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/api_test/Makefile +302 -0
- data/ext/commonmarker/cmark/build/api_test/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/build/cmake_install.cmake +49 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake +36 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/build.make +253 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake +16 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make +8 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/C.includecache +220 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake +29 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/autolink.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/build.make +249 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake +15 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/core-extensions.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.internal +100 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make +100 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/ext_scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make +8 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/strikethrough.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/table.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/tagfilter.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/extensions/Makefile +426 -0
- data/ext/commonmarker/cmark/build/extensions/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/build/extensions/cmarkextensions_export.h +42 -0
- data/ext/commonmarker/cmark/build/extensions/libcmark-gfmextensions.a +0 -0
- data/ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/man/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/man/Makefile +196 -0
- data/ext/commonmarker/cmark/build/man/cmake_install.cmake +37 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark-release.cmake +38 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark.cmake +95 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake +30 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/build.make +115 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/progress.make +3 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake +58 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/build.make +765 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake +35 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/progress.make +27 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/C.includecache +622 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake +52 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/arena.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/buffer.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/build.make +762 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake +34 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark_ctype.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.internal +310 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make +310 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_href_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_u.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/latex.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/linked_list.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plaintext.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plugin.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/progress.make +27 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/references.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/registry.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/render.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/syntax_extension.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/utf8.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/src/Makefile +1099 -0
- data/ext/commonmarker/cmark/build/src/cmake_install.cmake +100 -0
- data/ext/commonmarker/cmark/build/src/cmark_export.h +42 -0
- data/ext/commonmarker/cmark/build/src/cmark_version.h +7 -0
- data/ext/commonmarker/cmark/build/src/config.h +76 -0
- data/ext/commonmarker/cmark/build/src/libcmark-gfm.a +0 -0
- data/ext/commonmarker/cmark/build/src/libcmark-gfm.pc +10 -0
- data/ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/testdir/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +17 -0
- data/ext/commonmarker/cmark/build/testdir/Makefile +196 -0
- data/ext/commonmarker/cmark/build/testdir/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/changelog.txt +7 -0
- data/ext/commonmarker/cmark/extensions/CMakeLists.txt +1 -1
- data/ext/commonmarker/cmark/extensions/table.c +1 -0
- data/ext/commonmarker/cmark/man/man3/cmark-gfm.3 +1 -13
- data/ext/commonmarker/cmark/src/CMakeLists.txt +2 -1
- data/ext/commonmarker/cmark/src/blocks.c +1 -3
- data/ext/commonmarker/cmark/src/cmark.h +16 -4
- data/ext/commonmarker/cmark/src/cmark_extension_api.h +6 -0
- data/ext/commonmarker/cmark/src/cmark_version.h.in +2 -2
- data/ext/commonmarker/cmark/src/inlines.c +11 -2
- data/ext/commonmarker/cmark/src/main.c +9 -4
- data/ext/commonmarker/cmark/src/plaintext.c +212 -0
- data/ext/commonmarker/cmark/src/scanners.c +10919 -7141
- data/ext/commonmarker/cmark/src/scanners.h +2 -0
- data/ext/commonmarker/cmark/src/scanners.re +11 -0
- data/ext/commonmarker/cmark/src/syntax_extension.c +5 -0
- data/ext/commonmarker/cmark/src/syntax_extension.h +1 -0
- data/ext/commonmarker/commonmarker.c +20 -0
- data/lib/commonmarker/config.rb +1 -1
- data/lib/commonmarker/node.rb +10 -0
- data/lib/commonmarker/version.rb +1 -1
- data/test/test_node.rb +5 -5
- data/test/test_plaintext.rb +44 -0
- metadata +138 -2
@@ -14,6 +14,7 @@ bufsize_t _scan_scheme(const unsigned char *p);
|
|
14
14
|
bufsize_t _scan_autolink_uri(const unsigned char *p);
|
15
15
|
bufsize_t _scan_autolink_email(const unsigned char *p);
|
16
16
|
bufsize_t _scan_html_tag(const unsigned char *p);
|
17
|
+
bufsize_t _scan_liberal_html_tag(const unsigned char *p);
|
17
18
|
bufsize_t _scan_html_block_start(const unsigned char *p);
|
18
19
|
bufsize_t _scan_html_block_start_7(const unsigned char *p);
|
19
20
|
bufsize_t _scan_html_block_end_1(const unsigned char *p);
|
@@ -35,6 +36,7 @@ bufsize_t _scan_dangerous_url(const unsigned char *p);
|
|
35
36
|
#define scan_autolink_uri(c, n) _scan_at(&_scan_autolink_uri, c, n)
|
36
37
|
#define scan_autolink_email(c, n) _scan_at(&_scan_autolink_email, c, n)
|
37
38
|
#define scan_html_tag(c, n) _scan_at(&_scan_html_tag, c, n)
|
39
|
+
#define scan_liberal_html_tag(c, n) _scan_at(&_scan_liberal_html_tag, c, n)
|
38
40
|
#define scan_html_block_start(c, n) _scan_at(&_scan_html_block_start, c, n)
|
39
41
|
#define scan_html_block_start_7(c, n) _scan_at(&_scan_html_block_start_7, c, n)
|
40
42
|
#define scan_html_block_end_1(c, n) _scan_at(&_scan_html_block_end_1, c, n)
|
@@ -122,6 +122,17 @@ bufsize_t _scan_html_tag(const unsigned char *p)
|
|
122
122
|
*/
|
123
123
|
}
|
124
124
|
|
125
|
+
// Try to (liberally) match an HTML tag after first <, returning num of chars matched.
|
126
|
+
bufsize_t _scan_liberal_html_tag(const unsigned char *p)
|
127
|
+
{
|
128
|
+
const unsigned char *marker = NULL;
|
129
|
+
const unsigned char *start = p;
|
130
|
+
/*!re2c
|
131
|
+
.+ [>] { return (bufsize_t)(p - start); }
|
132
|
+
* { return 0; }
|
133
|
+
*/
|
134
|
+
}
|
135
|
+
|
125
136
|
// Try to match an HTML block tag start line, returning
|
126
137
|
// an integer code for the type of block (1-6, matching the spec).
|
127
138
|
// #7 is handled by a separate function, below.
|
@@ -81,6 +81,11 @@ void cmark_syntax_extension_set_commonmark_render_func(cmark_syntax_extension *e
|
|
81
81
|
extension->commonmark_render_func = func;
|
82
82
|
}
|
83
83
|
|
84
|
+
void cmark_syntax_extension_set_plaintext_render_func(cmark_syntax_extension *extension,
|
85
|
+
cmark_common_render_func func) {
|
86
|
+
extension->plaintext_render_func = func;
|
87
|
+
}
|
88
|
+
|
84
89
|
void cmark_syntax_extension_set_latex_render_func(cmark_syntax_extension *extension,
|
85
90
|
cmark_common_render_func func) {
|
86
91
|
extension->latex_render_func = func;
|
@@ -17,6 +17,7 @@ struct cmark_syntax_extension {
|
|
17
17
|
cmark_can_contain_func can_contain_func;
|
18
18
|
cmark_contains_inlines_func contains_inlines_func;
|
19
19
|
cmark_common_render_func commonmark_render_func;
|
20
|
+
cmark_common_render_func plaintext_render_func;
|
20
21
|
cmark_common_render_func latex_render_func;
|
21
22
|
cmark_common_render_func man_render_func;
|
22
23
|
cmark_html_render_func html_render_func;
|
@@ -570,6 +570,25 @@ static VALUE rb_render_commonmark(VALUE n, VALUE rb_options) {
|
|
570
570
|
return ruby_cmark;
|
571
571
|
}
|
572
572
|
|
573
|
+
/* Internal: Convert the node to a plain textstring.
|
574
|
+
*
|
575
|
+
* Returns a {String}.
|
576
|
+
*/
|
577
|
+
static VALUE rb_render_plaintext(VALUE n, VALUE rb_options) {
|
578
|
+
int options;
|
579
|
+
cmark_node *node;
|
580
|
+
Check_Type(rb_options, T_FIXNUM);
|
581
|
+
|
582
|
+
options = FIX2INT(rb_options);
|
583
|
+
Data_Get_Struct(n, cmark_node, node);
|
584
|
+
|
585
|
+
char *text = cmark_render_plaintext(node, options, 120);
|
586
|
+
VALUE ruby_text = rb_str_new2(text);
|
587
|
+
free(text);
|
588
|
+
|
589
|
+
return ruby_text;
|
590
|
+
}
|
591
|
+
|
573
592
|
/*
|
574
593
|
* Public: Inserts a node as a sibling after the current node.
|
575
594
|
*
|
@@ -1080,6 +1099,7 @@ __attribute__((visibility("default"))) void Init_commonmarker() {
|
|
1080
1099
|
rb_define_method(rb_mNode, "insert_before", rb_node_insert_before, 1);
|
1081
1100
|
rb_define_method(rb_mNode, "_render_html", rb_render_html, 2);
|
1082
1101
|
rb_define_method(rb_mNode, "_render_commonmark", rb_render_commonmark, 1);
|
1102
|
+
rb_define_method(rb_mNode, "_render_plaintext", rb_render_plaintext, 1);
|
1083
1103
|
rb_define_method(rb_mNode, "insert_after", rb_node_insert_after, 1);
|
1084
1104
|
rb_define_method(rb_mNode, "prepend_child", rb_node_prepend_child, 1);
|
1085
1105
|
rb_define_method(rb_mNode, "append_child", rb_node_append_child, 1);
|
data/lib/commonmarker/config.rb
CHANGED
data/lib/commonmarker/node.rb
CHANGED
@@ -38,6 +38,16 @@ module CommonMarker
|
|
38
38
|
_render_commonmark(opts).force_encoding('utf-8')
|
39
39
|
end
|
40
40
|
|
41
|
+
# Public: Convert the node to a plain text string.
|
42
|
+
#
|
43
|
+
# options - A {Symbol} or {Array of Symbol}s indicating the render options
|
44
|
+
#
|
45
|
+
# Returns a {String}.
|
46
|
+
def to_plaintext(options = :DEFAULT)
|
47
|
+
opts = Config.process_options(options, :render)
|
48
|
+
_render_plaintext(opts).force_encoding('utf-8')
|
49
|
+
end
|
50
|
+
|
41
51
|
# Public: Iterate over the children (if any) of the current pointer.
|
42
52
|
def each(&block)
|
43
53
|
return enum_for(:each) unless block_given?
|
data/lib/commonmarker/version.rb
CHANGED
data/test/test_node.rb
CHANGED
@@ -10,7 +10,7 @@ class TestNode < Minitest::Test
|
|
10
10
|
@doc.walk do |node|
|
11
11
|
nodes << node.type
|
12
12
|
end
|
13
|
-
assert_equal [:document, :paragraph, :text, :emph, :text, :text
|
13
|
+
assert_equal [:document, :paragraph, :text, :emph, :text, :text], nodes
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_each
|
@@ -18,7 +18,7 @@ class TestNode < Minitest::Test
|
|
18
18
|
@doc.first_child.each do |node|
|
19
19
|
nodes << node.type
|
20
20
|
end
|
21
|
-
assert_equal [:text, :emph, :text
|
21
|
+
assert_equal [:text, :emph, :text], nodes
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_deprecated_each_child
|
@@ -28,19 +28,19 @@ class TestNode < Minitest::Test
|
|
28
28
|
nodes << node.type
|
29
29
|
end
|
30
30
|
end
|
31
|
-
assert_equal [:text, :emph, :text
|
31
|
+
assert_equal [:text, :emph, :text], nodes
|
32
32
|
assert_match /`each_child` is deprecated/, err
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_select
|
36
36
|
nodes = @doc.first_child.select { |node| node.type == :text }
|
37
37
|
assert_equal CommonMarker::Node, nodes.first.class
|
38
|
-
assert_equal [:text, :text
|
38
|
+
assert_equal [:text, :text], nodes.map(&:type)
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_map
|
42
42
|
nodes = @doc.first_child.map(&:type)
|
43
|
-
assert_equal [:text, :emph, :text
|
43
|
+
assert_equal [:text, :emph, :text], nodes
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_insert_illegal
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestPlaintext < Minitest::Test
|
4
|
+
def setup
|
5
|
+
@markdown = <<-MD
|
6
|
+
Hi *there*!
|
7
|
+
|
8
|
+
1. I am a numeric list.
|
9
|
+
2. I continue the list.
|
10
|
+
* Suddenly, an unordered list!
|
11
|
+
* What fun!
|
12
|
+
|
13
|
+
Okay, _enough_.
|
14
|
+
|
15
|
+
| a | b |
|
16
|
+
| --- | --- |
|
17
|
+
| c | d |
|
18
|
+
MD
|
19
|
+
end
|
20
|
+
|
21
|
+
def render_doc(doc)
|
22
|
+
CommonMarker.render_doc(doc, :DEFAULT, %i[table])
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_to_commonmark
|
26
|
+
compare = render_doc(@markdown).to_plaintext
|
27
|
+
|
28
|
+
assert_equal <<-PLAINTEXT, compare
|
29
|
+
Hi there!
|
30
|
+
|
31
|
+
1. I am a numeric list.
|
32
|
+
2. I continue the list.
|
33
|
+
|
34
|
+
- Suddenly, an unordered list!
|
35
|
+
- What fun!
|
36
|
+
|
37
|
+
Okay, enough.
|
38
|
+
|
39
|
+
| a | b |
|
40
|
+
| --- | --- |
|
41
|
+
| c | d |
|
42
|
+
PLAINTEXT
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmarker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-enum
|
@@ -164,6 +164,139 @@ files:
|
|
164
164
|
- ext/commonmarker/cmark/bench/statistics.py
|
165
165
|
- ext/commonmarker/cmark/bench/stats.py
|
166
166
|
- ext/commonmarker/cmark/benchmarks.md
|
167
|
+
- ext/commonmarker/cmark/build/CMakeCache.txt
|
168
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeCCompiler.cmake
|
169
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeCXXCompiler.cmake
|
170
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeDetermineCompilerABI_C.bin
|
171
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeDetermineCompilerABI_CXX.bin
|
172
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeSystem.cmake
|
173
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdC/CMakeCCompilerId.c
|
174
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdC/a.out
|
175
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdCXX/CMakeCXXCompilerId.cpp
|
176
|
+
- ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdCXX/a.out
|
177
|
+
- ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake
|
178
|
+
- ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log
|
179
|
+
- ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log
|
180
|
+
- ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake
|
181
|
+
- ext/commonmarker/cmark/build/CMakeFiles/Makefile2
|
182
|
+
- ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt
|
183
|
+
- ext/commonmarker/cmark/build/CMakeFiles/cmake.check_cache
|
184
|
+
- ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin
|
185
|
+
- ext/commonmarker/cmark/build/CMakeFiles/feature_tests.c
|
186
|
+
- ext/commonmarker/cmark/build/CMakeFiles/feature_tests.cxx
|
187
|
+
- ext/commonmarker/cmark/build/CMakeFiles/progress.marks
|
188
|
+
- ext/commonmarker/cmark/build/CTestTestfile.cmake
|
189
|
+
- ext/commonmarker/cmark/build/Makefile
|
190
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake
|
191
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake
|
192
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make
|
193
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake
|
194
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.make
|
195
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make
|
196
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt
|
197
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/progress.make
|
198
|
+
- ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks
|
199
|
+
- ext/commonmarker/cmark/build/api_test/Makefile
|
200
|
+
- ext/commonmarker/cmark/build/api_test/cmake_install.cmake
|
201
|
+
- ext/commonmarker/cmark/build/cmake_install.cmake
|
202
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake
|
203
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake
|
204
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/build.make
|
205
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake
|
206
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make
|
207
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/flags.make
|
208
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt
|
209
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make
|
210
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/C.includecache
|
211
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake
|
212
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/autolink.c.o
|
213
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/build.make
|
214
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake
|
215
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake
|
216
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/core-extensions.c.o
|
217
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.internal
|
218
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make
|
219
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/ext_scanners.c.o
|
220
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/flags.make
|
221
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt
|
222
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make
|
223
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/strikethrough.c.o
|
224
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/table.c.o
|
225
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/tagfilter.c.o
|
226
|
+
- ext/commonmarker/cmark/build/extensions/CMakeFiles/progress.marks
|
227
|
+
- ext/commonmarker/cmark/build/extensions/Makefile
|
228
|
+
- ext/commonmarker/cmark/build/extensions/cmake_install.cmake
|
229
|
+
- ext/commonmarker/cmark/build/extensions/cmarkextensions_export.h
|
230
|
+
- ext/commonmarker/cmark/build/extensions/libcmark-gfmextensions.a
|
231
|
+
- ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake
|
232
|
+
- ext/commonmarker/cmark/build/man/CMakeFiles/progress.marks
|
233
|
+
- ext/commonmarker/cmark/build/man/Makefile
|
234
|
+
- ext/commonmarker/cmark/build/man/cmake_install.cmake
|
235
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake
|
236
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark-release.cmake
|
237
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark.cmake
|
238
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake
|
239
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/build.make
|
240
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake
|
241
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/depend.make
|
242
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/flags.make
|
243
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/link.txt
|
244
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/progress.make
|
245
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake
|
246
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/build.make
|
247
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake
|
248
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/depend.make
|
249
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/flags.make
|
250
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/link.txt
|
251
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/progress.make
|
252
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/C.includecache
|
253
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake
|
254
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/arena.c.o
|
255
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/blocks.c.o
|
256
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/buffer.c.o
|
257
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/build.make
|
258
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake
|
259
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake
|
260
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark.c.o
|
261
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark_ctype.c.o
|
262
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/commonmark.c.o
|
263
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.internal
|
264
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make
|
265
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make
|
266
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_href_e.c.o
|
267
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_e.c.o
|
268
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_u.c.o
|
269
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/html.c.o
|
270
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/inlines.c.o
|
271
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/iterator.c.o
|
272
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/latex.c.o
|
273
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/link.txt
|
274
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/linked_list.c.o
|
275
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/man.c.o
|
276
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/node.c.o
|
277
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plaintext.c.o
|
278
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plugin.c.o
|
279
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/progress.make
|
280
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/references.c.o
|
281
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/registry.c.o
|
282
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/render.c.o
|
283
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/scanners.c.o
|
284
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/syntax_extension.c.o
|
285
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/utf8.c.o
|
286
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/xml.c.o
|
287
|
+
- ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks
|
288
|
+
- ext/commonmarker/cmark/build/src/Makefile
|
289
|
+
- ext/commonmarker/cmark/build/src/cmake_install.cmake
|
290
|
+
- ext/commonmarker/cmark/build/src/cmark_export.h
|
291
|
+
- ext/commonmarker/cmark/build/src/cmark_version.h
|
292
|
+
- ext/commonmarker/cmark/build/src/config.h
|
293
|
+
- ext/commonmarker/cmark/build/src/libcmark-gfm.a
|
294
|
+
- ext/commonmarker/cmark/build/src/libcmark-gfm.pc
|
295
|
+
- ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake
|
296
|
+
- ext/commonmarker/cmark/build/testdir/CMakeFiles/progress.marks
|
297
|
+
- ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake
|
298
|
+
- ext/commonmarker/cmark/build/testdir/Makefile
|
299
|
+
- ext/commonmarker/cmark/build/testdir/cmake_install.cmake
|
167
300
|
- ext/commonmarker/cmark/changelog.txt
|
168
301
|
- ext/commonmarker/cmark/data/CaseFolding.txt
|
169
302
|
- ext/commonmarker/cmark/extensions/CMakeLists.txt
|
@@ -219,6 +352,7 @@ files:
|
|
219
352
|
- ext/commonmarker/cmark/src/node.c
|
220
353
|
- ext/commonmarker/cmark/src/node.h
|
221
354
|
- ext/commonmarker/cmark/src/parser.h
|
355
|
+
- ext/commonmarker/cmark/src/plaintext.c
|
222
356
|
- ext/commonmarker/cmark/src/plugin.c
|
223
357
|
- ext/commonmarker/cmark/src/plugin.h
|
224
358
|
- ext/commonmarker/cmark/src/references.c
|
@@ -331,6 +465,7 @@ files:
|
|
331
465
|
- test/test_maliciousness.rb
|
332
466
|
- test/test_node.rb
|
333
467
|
- test/test_pathological_inputs.rb
|
468
|
+
- test/test_plaintext.rb
|
334
469
|
- test/test_renderer.rb
|
335
470
|
- test/test_smartpunct.rb
|
336
471
|
- test/test_spec.rb
|
@@ -377,6 +512,7 @@ test_files:
|
|
377
512
|
- test/test_maliciousness.rb
|
378
513
|
- test/test_node.rb
|
379
514
|
- test/test_pathological_inputs.rb
|
515
|
+
- test/test_plaintext.rb
|
380
516
|
- test/test_renderer.rb
|
381
517
|
- test/test_smartpunct.rb
|
382
518
|
- test/test_spec.rb
|