rdiscount 2.2.0.1 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.markdown +11 -12
- data/Rakefile +11 -2
- data/bin/rdiscount +10 -3
- data/ext/Csio.c +2 -2
- data/ext/VERSION +1 -1
- data/ext/amalloc.c +1 -0
- data/ext/blocktags +2 -1
- data/ext/config.h +2 -0
- data/ext/css.c +5 -7
- data/ext/cstring.h +0 -1
- data/ext/docheader.c +6 -1
- data/ext/dumptree.c +11 -2
- data/ext/extconf.rb +1 -0
- data/ext/flags.c +4 -2
- data/ext/generate.c +339 -141
- data/ext/gethopt.c +286 -0
- data/ext/gethopt.h +43 -0
- data/ext/github_flavoured.c +8 -7
- data/ext/h1title.c +36 -0
- data/ext/html5.c +0 -1
- data/ext/markdown.c +189 -87
- data/ext/markdown.h +55 -27
- data/ext/mkdio.c +155 -58
- data/ext/mkdio.h +9 -5
- data/ext/mktags.c +3 -0
- data/ext/notspecial.c +44 -0
- data/ext/pgm_options.c +12 -12
- data/ext/pgm_options.h +2 -2
- data/ext/rdiscount.c +25 -22
- data/ext/resource.c +1 -0
- data/ext/setup.c +1 -1
- data/ext/tags.c +2 -0
- data/ext/toc.c +12 -14
- data/ext/version.c +3 -3
- data/ext/xml.c +6 -5
- data/ext/xmlpage.c +5 -8
- data/lib/rdiscount.rb +12 -1
- data/rdiscount.gemspec +8 -8
- data/test/markdown_test.rb +0 -1
- data/test/rdiscount_test.rb +46 -23
- metadata +14 -10
data/ext/pgm_options.c
CHANGED
@@ -8,9 +8,6 @@
|
|
8
8
|
#include <stdio.h>
|
9
9
|
#include <stdlib.h>
|
10
10
|
#include <limits.h>
|
11
|
-
#ifndef _MSC_VER
|
12
|
-
#include <unistd.h>
|
13
|
-
#endif
|
14
11
|
#include <mkdio.h>
|
15
12
|
#include <errno.h>
|
16
13
|
#include <string.h>
|
@@ -34,8 +31,8 @@ static struct _opt {
|
|
34
31
|
{ "tabstop", "default (4-space) tabstops", 0, 0, 1, MKD_TABSTOP },
|
35
32
|
{ "image", "images", 1, 0, 1, MKD_NOIMAGE },
|
36
33
|
{ "links", "links", 1, 0, 1, MKD_NOLINKS },
|
37
|
-
{ "relax", "
|
38
|
-
{ "strict", "
|
34
|
+
{ "relax", "Markdown.pl compatibility", 1, 1, 1, MKD_STRICT },
|
35
|
+
{ "strict", "Markdown.pl compatibility", 0, 0, 1, MKD_STRICT },
|
39
36
|
{ "tables", "tables", 1, 0, 1, MKD_NOTABLES },
|
40
37
|
{ "header", "pandoc-style headers", 1, 0, 1, MKD_NOHEADER },
|
41
38
|
{ "html", "raw html", 1, 0, 1, MKD_NOHTML },
|
@@ -62,7 +59,10 @@ static struct _opt {
|
|
62
59
|
{ "fencedcode", "fenced code blocks", 0, 0, 1, MKD_FENCEDCODE },
|
63
60
|
{ "idanchor", "id= anchors in TOC", 0, 0, 1, MKD_IDANCHOR },
|
64
61
|
{ "githubtags", "permit - and _ in element names", 0, 0, 0, MKD_GITHUBTAGS },
|
65
|
-
{ "urlencodedanchor", "
|
62
|
+
{ "urlencodedanchor", "html5-style anchors", 0, 0, 0, MKD_URLENCODEDANCHOR },
|
63
|
+
{ "html5anchor", "html5-style anchors", 0, 1, 0, MKD_URLENCODEDANCHOR },
|
64
|
+
{ "latex", "handle LaTeX escapes", 0, 0, 1, MKD_LATEX },
|
65
|
+
{ "explicitlist", "do not merge adjacent numeric/bullet lists", 0, 0, 1, MKD_EXPLICITLIST },
|
66
66
|
} ;
|
67
67
|
|
68
68
|
#define NR(x) (sizeof x / sizeof x[0])
|
@@ -84,7 +84,7 @@ sort_by_flag(struct _opt *a, struct _opt *b)
|
|
84
84
|
|
85
85
|
|
86
86
|
void
|
87
|
-
show_flags(int byname)
|
87
|
+
show_flags(int byname, int verbose)
|
88
88
|
{
|
89
89
|
int i;
|
90
90
|
|
@@ -92,14 +92,14 @@ show_flags(int byname)
|
|
92
92
|
qsort(opts, NR(opts), sizeof(opts[0]), (stfu)sort_by_name);
|
93
93
|
|
94
94
|
for (i=0; i < NR(opts); i++)
|
95
|
-
if ( !
|
95
|
+
if ( verbose || !opts[i].skip )
|
96
96
|
fprintf(stderr, "%16s : %s\n", opts[i].name, opts[i].desc);
|
97
97
|
}
|
98
98
|
else {
|
99
99
|
qsort(opts, NR(opts), sizeof(opts[0]), (stfu)sort_by_flag);
|
100
100
|
|
101
101
|
for (i=0; i < NR(opts); i++)
|
102
|
-
if ( !
|
102
|
+
if ( !opts[i].skip ) {
|
103
103
|
fprintf(stderr, "%08lx : ", (long)opts[i].flag);
|
104
104
|
if ( opts[i].sayenable )
|
105
105
|
fprintf(stderr, opts[i].off ? "disable " : "enable ");
|
@@ -109,7 +109,7 @@ show_flags(int byname)
|
|
109
109
|
}
|
110
110
|
|
111
111
|
|
112
|
-
|
112
|
+
char *
|
113
113
|
set_flag(mkd_flag_t *flags, char *optionstring)
|
114
114
|
{
|
115
115
|
int i;
|
@@ -140,7 +140,7 @@ set_flag(mkd_flag_t *flags, char *optionstring)
|
|
140
140
|
*flags &= ~opts[i].flag;
|
141
141
|
}
|
142
142
|
else
|
143
|
-
return
|
143
|
+
return arg;
|
144
144
|
}
|
145
|
-
return
|
145
|
+
return 0;
|
146
146
|
}
|
data/ext/pgm_options.h
CHANGED
data/ext/rdiscount.c
CHANGED
@@ -34,11 +34,36 @@ static AccessorFlagPair ACCESSOR_2_FLAG[] = {
|
|
34
34
|
{ "no_pseudo_protocols", MKD_NO_EXT },
|
35
35
|
{ "no_superscript", MKD_NOSUPERSCRIPT },
|
36
36
|
{ "no_strikethrough", MKD_NOSTRIKETHROUGH },
|
37
|
+
{ "latex", MKD_LATEX },
|
38
|
+
{ "explicitlist", MKD_EXPLICITLIST },
|
39
|
+
{ "md1compat", MKD_1_COMPAT },
|
37
40
|
{ NULL, 0 } /* sentinel */
|
38
41
|
};
|
39
42
|
|
40
43
|
static VALUE rb_cRDiscount;
|
41
44
|
|
45
|
+
int rb_rdiscount__get_flags(VALUE ruby_obj)
|
46
|
+
{
|
47
|
+
AccessorFlagPair *entry;
|
48
|
+
|
49
|
+
/* compile flags */
|
50
|
+
int flags = MKD_TABSTOP | MKD_NOHEADER | MKD_DLEXTRA | MKD_FENCEDCODE | MKD_GITHUBTAGS;
|
51
|
+
|
52
|
+
/* The "smart" accessor turns OFF the MKD_NOPANTS flag. */
|
53
|
+
if ( rb_funcall(ruby_obj, rb_intern("smart"), 0) != Qtrue ) {
|
54
|
+
flags = flags | MKD_NOPANTS;
|
55
|
+
}
|
56
|
+
|
57
|
+
/* Handle standard flags declared in ACCESSOR_2_FLAG */
|
58
|
+
for ( entry = ACCESSOR_2_FLAG; entry->accessor_name; entry++ ) {
|
59
|
+
if ( rb_funcall(ruby_obj, rb_intern(entry->accessor_name), 0) == Qtrue ) {
|
60
|
+
flags = flags | entry->flag;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
return flags;
|
65
|
+
}
|
66
|
+
|
42
67
|
static VALUE
|
43
68
|
rb_rdiscount_to_html(int argc, VALUE *argv, VALUE self)
|
44
69
|
{
|
@@ -117,28 +142,6 @@ rb_rdiscount_toc_content(int argc, VALUE *argv, VALUE self)
|
|
117
142
|
return buf;
|
118
143
|
}
|
119
144
|
|
120
|
-
int rb_rdiscount__get_flags(VALUE ruby_obj)
|
121
|
-
{
|
122
|
-
AccessorFlagPair *entry;
|
123
|
-
|
124
|
-
/* compile flags */
|
125
|
-
int flags = MKD_TABSTOP | MKD_NOHEADER | MKD_DLEXTRA | MKD_FENCEDCODE | MKD_GITHUBTAGS;
|
126
|
-
|
127
|
-
/* The "smart" accessor turns OFF the MKD_NOPANTS flag. */
|
128
|
-
if ( rb_funcall(ruby_obj, rb_intern("smart"), 0) != Qtrue ) {
|
129
|
-
flags = flags | MKD_NOPANTS;
|
130
|
-
}
|
131
|
-
|
132
|
-
/* Handle standard flags declared in ACCESSOR_2_FLAG */
|
133
|
-
for ( entry = ACCESSOR_2_FLAG; entry->accessor_name; entry++ ) {
|
134
|
-
if ( rb_funcall(ruby_obj, rb_intern(entry->accessor_name), 0) == Qtrue ) {
|
135
|
-
flags = flags | entry->flag;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
return flags;
|
140
|
-
}
|
141
|
-
|
142
145
|
|
143
146
|
void Init_rdiscount()
|
144
147
|
{
|
data/ext/resource.c
CHANGED
data/ext/setup.c
CHANGED
data/ext/tags.c
CHANGED
data/ext/toc.c
CHANGED
@@ -25,12 +25,14 @@ mkd_toc(Document *p, char **doc)
|
|
25
25
|
Cstring res;
|
26
26
|
int size;
|
27
27
|
int first = 1;
|
28
|
+
extern void Csreparse(Cstring *, char *, int, mkd_flag_t);
|
29
|
+
|
28
30
|
|
29
31
|
if ( !(doc && p && p->ctx) ) return -1;
|
30
32
|
|
31
33
|
*doc = 0;
|
32
34
|
|
33
|
-
if ( ! (p->ctx->flags
|
35
|
+
if ( ! is_flag_set(p->ctx->flags, MKD_TOC) ) return 0;
|
34
36
|
|
35
37
|
CREATE(res);
|
36
38
|
RESERVE(res, 100);
|
@@ -38,7 +40,7 @@ mkd_toc(Document *p, char **doc)
|
|
38
40
|
for ( tp = p->code; tp ; tp = tp->next ) {
|
39
41
|
if ( tp->typ == SOURCE ) {
|
40
42
|
for ( srcp = tp->down; srcp; srcp = srcp->next ) {
|
41
|
-
if ( srcp->typ == HDR && srcp->text ) {
|
43
|
+
if ( (srcp->typ == HDR) && srcp->text ) {
|
42
44
|
|
43
45
|
while ( last_hnumber > srcp->hnumber ) {
|
44
46
|
if ( (last_hnumber - srcp->hnumber) > 1 )
|
@@ -62,11 +64,11 @@ mkd_toc(Document *p, char **doc)
|
|
62
64
|
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, "");
|
63
65
|
mkd_string_to_anchor(T(srcp->text->text),
|
64
66
|
S(srcp->text->text),
|
65
|
-
(mkd_sta_function_t)Csputc,
|
67
|
+
(mkd_sta_function_t)Csputc,
|
68
|
+
&res,1,p->ctx);
|
66
69
|
Csprintf(&res, "\">");
|
67
|
-
|
68
|
-
|
69
|
-
(mkd_sta_function_t)Csputc, &res,0,p->ctx->flags);
|
70
|
+
Csreparse(&res, T(srcp->text->text),
|
71
|
+
S(srcp->text->text), IS_LABEL);
|
70
72
|
Csprintf(&res, "</a>");
|
71
73
|
|
72
74
|
first = 0;
|
@@ -82,16 +84,12 @@ mkd_toc(Document *p, char **doc)
|
|
82
84
|
}
|
83
85
|
|
84
86
|
if ( (size = S(res)) > 0 ) {
|
87
|
+
/* null-terminate & strdup into a free()able memory chunk
|
88
|
+
*/
|
85
89
|
EXPAND(res) = 0;
|
86
|
-
|
87
|
-
*doc = T(res); /* we know that a T(Cstring) is a character pointer
|
88
|
-
* so we can simply pick it up and carry it away,
|
89
|
-
* leaving the husk of the Ctring on the stack
|
90
|
-
* END HACK ALERT
|
91
|
-
*/
|
90
|
+
*doc = strdup(T(res));
|
92
91
|
}
|
93
|
-
|
94
|
-
DELETE(res);
|
92
|
+
DELETE(res);
|
95
93
|
return size;
|
96
94
|
}
|
97
95
|
|
data/ext/version.c
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
#include "config.h"
|
2
2
|
|
3
|
-
char markdown_version[] = VERSION
|
3
|
+
char markdown_version[] = BRANCH VERSION
|
4
4
|
#if 4 != 4
|
5
5
|
" TAB=4"
|
6
6
|
#endif
|
7
7
|
#if USE_AMALLOC
|
8
8
|
" DEBUG"
|
9
9
|
#endif
|
10
|
-
#if
|
11
|
-
"
|
10
|
+
#if GITHUB_CHECKBOX
|
11
|
+
" GITHUB_CHECKBOX"
|
12
12
|
#endif
|
13
13
|
;
|
data/ext/xml.c
CHANGED
@@ -74,9 +74,10 @@ mkd_xml(char *p, int size, char **res)
|
|
74
74
|
else
|
75
75
|
Csputc(c, &f);
|
76
76
|
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
/* null terminate, strdup() into a free()able memory block,
|
78
|
+
* and return the size of everything except the null terminator
|
79
|
+
*/
|
80
|
+
EXPAND(f) = 0;
|
81
|
+
*res = strdup(T(f));
|
82
|
+
return S(f)-1;
|
82
83
|
}
|
data/ext/xmlpage.c
CHANGED
@@ -5,18 +5,13 @@
|
|
5
5
|
* The redistribution terms are provided in the COPYRIGHT file that must
|
6
6
|
* be distributed with this source code.
|
7
7
|
*/
|
8
|
-
#include "config.h"
|
9
8
|
#include <stdio.h>
|
10
9
|
#include <stdlib.h>
|
11
|
-
#include <
|
12
|
-
|
13
|
-
#include "cstring.h"
|
14
|
-
#include "markdown.h"
|
15
|
-
#include "amalloc.h"
|
10
|
+
#include <markdown.h>
|
16
11
|
|
17
12
|
|
18
13
|
int
|
19
|
-
mkd_xhtmlpage(Document *p,
|
14
|
+
mkd_xhtmlpage(Document *p, mkd_flag_t flags, FILE *out)
|
20
15
|
{
|
21
16
|
char *title;
|
22
17
|
extern char *mkd_doc_title(Document *);
|
@@ -29,9 +24,11 @@ mkd_xhtmlpage(Document *p, int flags, FILE *out)
|
|
29
24
|
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n") );
|
30
25
|
|
31
26
|
DO_OR_DIE( fprintf(out, "<head>\n") );
|
27
|
+
DO_OR_DIE( fprintf(out, "<title>") );
|
32
28
|
if ( title = mkd_doc_title(p) ) {
|
33
|
-
DO_OR_DIE( fprintf(out, "
|
29
|
+
DO_OR_DIE( fprintf(out, "%s", title) );
|
34
30
|
}
|
31
|
+
DO_OR_DIE( fprintf(out, "</title>\n") );
|
35
32
|
DO_OR_DIE( mkd_generatecss(p, out) );
|
36
33
|
DO_OR_DIE( fprintf(out, "</head>\n"
|
37
34
|
"<body>\n") );
|
data/lib/rdiscount.rb
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
# end
|
25
25
|
#
|
26
26
|
class RDiscount
|
27
|
-
VERSION = '2.2.
|
27
|
+
VERSION = '2.2.7'
|
28
28
|
|
29
29
|
# Original Markdown formatted text.
|
30
30
|
attr_reader :text
|
@@ -75,6 +75,15 @@ class RDiscount
|
|
75
75
|
# Disable strikethrough processing.
|
76
76
|
attr_accessor :no_strikethrough
|
77
77
|
|
78
|
+
# Keep LaTeX inside $$ intact.
|
79
|
+
attr_accessor :latex
|
80
|
+
|
81
|
+
# Don't merge adjacent list into a single list.
|
82
|
+
attr_accessor :explicitlist
|
83
|
+
|
84
|
+
# Not documented: run in markdown 1 compat mode (only used for MarkdownTest1.0)
|
85
|
+
attr_accessor :md1compat
|
86
|
+
|
78
87
|
# Create a RDiscount Markdown processor. The +text+ argument
|
79
88
|
# should be a string containing Markdown text. Additional arguments may be
|
80
89
|
# supplied to set various processing options:
|
@@ -95,6 +104,8 @@ class RDiscount
|
|
95
104
|
# * <tt>:no_pseudo_protocols</tt> - Do not process pseudo-protocols.
|
96
105
|
# * <tt>:no_superscript</tt> - Disable superscript processing.
|
97
106
|
# * <tt>:no_strikethrough</tt> - Disable strikethrough processing.
|
107
|
+
# * <tt>:latex</tt> - Keep LaTeX inside $$ intact.
|
108
|
+
# * <tt>:explicitlist</tt> - Don't merge adjacent list into a single list.
|
98
109
|
#
|
99
110
|
def initialize(text, *extensions)
|
100
111
|
@text = text
|
data/rdiscount.gemspec
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rdiscount'
|
3
|
-
s.version = '2.2.
|
3
|
+
s.version = '2.2.7'
|
4
4
|
s.summary = "Fast Implementation of Gruber's Markdown in C"
|
5
|
-
s.date = '2016-05-07'
|
6
5
|
s.email = 'david@dafoster.net'
|
7
6
|
s.homepage = 'http://dafoster.net/projects/rdiscount/'
|
8
|
-
s.authors = ["Ryan Tomayko", "David Loren Parsons", "Andrew White", "David Foster"]
|
7
|
+
s.authors = ["Ryan Tomayko", "David Loren Parsons", "Andrew White", "David Foster", "l33tname"]
|
9
8
|
s.license = "BSD-3-Clause"
|
10
9
|
# = MANIFEST =
|
11
10
|
s.files = %w[
|
@@ -15,13 +14,12 @@ Gem::Specification.new do |s|
|
|
15
14
|
Rakefile
|
16
15
|
bin/rdiscount
|
17
16
|
discount
|
18
|
-
ext/Csio.c
|
19
|
-
ext/VERSION
|
20
17
|
ext/amalloc.c
|
21
18
|
ext/amalloc.h
|
22
19
|
ext/basename.c
|
23
20
|
ext/blocktags
|
24
21
|
ext/config.h
|
22
|
+
ext/Csio.c
|
25
23
|
ext/css.c
|
26
24
|
ext/cstring.h
|
27
25
|
ext/docheader.c
|
@@ -30,13 +28,17 @@ Gem::Specification.new do |s|
|
|
30
28
|
ext/extconf.rb
|
31
29
|
ext/flags.c
|
32
30
|
ext/generate.c
|
31
|
+
ext/gethopt.c
|
32
|
+
ext/gethopt.h
|
33
33
|
ext/github_flavoured.c
|
34
|
+
ext/h1title.c
|
34
35
|
ext/html5.c
|
35
36
|
ext/markdown.c
|
36
37
|
ext/markdown.h
|
37
38
|
ext/mkdio.c
|
38
39
|
ext/mkdio.h
|
39
40
|
ext/mktags.c
|
41
|
+
ext/notspecial.c
|
40
42
|
ext/pgm_options.c
|
41
43
|
ext/pgm_options.h
|
42
44
|
ext/rdiscount.c
|
@@ -45,6 +47,7 @@ Gem::Specification.new do |s|
|
|
45
47
|
ext/tags.c
|
46
48
|
ext/tags.h
|
47
49
|
ext/toc.c
|
50
|
+
ext/VERSION
|
48
51
|
ext/version.c
|
49
52
|
ext/xml.c
|
50
53
|
ext/xmlpage.c
|
@@ -65,7 +68,4 @@ Gem::Specification.new do |s|
|
|
65
68
|
s.extensions = ["ext/extconf.rb"]
|
66
69
|
s.executables = ["rdiscount"]
|
67
70
|
s.require_paths = ["lib"]
|
68
|
-
s.rubyforge_project = 'wink'
|
69
|
-
# Ruby 1.9.2 has a known bug in mkmf. Ruby 1.9.3 or later is fine.
|
70
|
-
s.required_ruby_version = '!= 1.9.2'
|
71
71
|
end
|
data/test/markdown_test.rb
CHANGED
@@ -138,7 +138,6 @@ class MarkdownTest < Test::Unit::TestCase
|
|
138
138
|
Dir["#{MARKDOWN_TEST_DIR}/Tests/*.text"].each do |text_file|
|
139
139
|
|
140
140
|
basename = File.basename(text_file).sub(/\.text$/, '')
|
141
|
-
html_file = text_file.sub(/text$/, 'html')
|
142
141
|
method_name = basename.gsub(/[-,()]/, '').gsub(/\s+/, '_').downcase
|
143
142
|
|
144
143
|
define_method "test_#{method_name}" do
|
data/test/rdiscount_test.rb
CHANGED
@@ -7,7 +7,7 @@ require 'rdiscount'
|
|
7
7
|
|
8
8
|
class RDiscountTest < Test::Unit::TestCase
|
9
9
|
def test_that_version_looks_valid
|
10
|
-
if not /^[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$/ =~ RDiscount::VERSION
|
10
|
+
if not (/^[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$/) =~ RDiscount::VERSION
|
11
11
|
assert false, 'Expected RDiscount::VERSION to be a 3 or 4 component version string but found ' + RDiscount::VERSION.to_s
|
12
12
|
end
|
13
13
|
end
|
@@ -54,24 +54,24 @@ class RDiscountTest < Test::Unit::TestCase
|
|
54
54
|
def test_that_generate_toc_sets_toc_ids
|
55
55
|
rd = RDiscount.new("# Level 1\n\n## Level 2", :generate_toc)
|
56
56
|
assert rd.generate_toc
|
57
|
-
assert_equal %(<a name="Level
|
57
|
+
assert_equal %(<a name="Level-1"></a>\n<h1>Level 1</h1>\n\n<a name="Level-2"></a>\n<h2>Level 2</h2>\n), rd.to_html
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_should_get_the_generated_toc
|
61
61
|
rd = RDiscount.new("# Level 1\n\n## Level 2", :generate_toc)
|
62
|
-
exp = %(<ul>\n <li><a href=\"#Level
|
62
|
+
exp = %(<ul>\n <li><a href=\"#Level-1\">Level 1</a>\n <ul>\n <li><a href=\"#Level-2\">Level 2</a></li>\n </ul>\n </li>\n</ul>)
|
63
63
|
assert_equal exp, rd.toc_content.strip
|
64
64
|
end
|
65
65
|
|
66
66
|
def test_toc_should_escape_apostropes
|
67
67
|
rd = RDiscount.new("# A'B\n\n## C", :generate_toc)
|
68
|
-
exp = %(<ul>\n <li><a href=\"#A
|
68
|
+
exp = %(<ul>\n <li><a href=\"#A-27-B\">A'B</a>\n <ul>\n <li><a href=\"#C\">C</a></li>\n </ul>\n </li>\n</ul>)
|
69
69
|
assert_equal exp, rd.toc_content.strip
|
70
70
|
end
|
71
71
|
|
72
72
|
def test_toc_should_escape_question_marks
|
73
73
|
rd = RDiscount.new("# A?B\n\n## C", :generate_toc)
|
74
|
-
exp = %(<ul>\n <li><a href=\"#A
|
74
|
+
exp = %(<ul>\n <li><a href=\"#A-3f-B\">A?B</a>\n <ul>\n <li><a href=\"#C\">C</a></li>\n </ul>\n </li>\n</ul>)
|
75
75
|
assert_equal exp, rd.toc_content.strip
|
76
76
|
end
|
77
77
|
|
@@ -139,12 +139,6 @@ EOS
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def test_that_tags_can_have_dashes_and_underscores
|
142
|
-
if RDiscount::VERSION.start_with? "2.0.7"
|
143
|
-
# Skip test for 2.0.7.x series due to upstream behavioral change in
|
144
|
-
# Discount 2.0.7. This test can be fixed in Discount 2.1.5 using the
|
145
|
-
# WITH_GITHUB_TAGS compile-time flag.
|
146
|
-
return
|
147
|
-
end
|
148
142
|
rd = RDiscount.new("foo <asdf-qwerty>bar</asdf-qwerty> and <a_b>baz</a_b>")
|
149
143
|
assert_equal "<p>foo <asdf-qwerty>bar</asdf-qwerty> and <a_b>baz</a_b></p>\n", rd.to_html
|
150
144
|
end
|
@@ -249,7 +243,47 @@ EOS
|
|
249
243
|
</dl>
|
250
244
|
EOS
|
251
245
|
end
|
252
|
-
|
246
|
+
|
247
|
+
def test_latex_passtrough_dont_render_link
|
248
|
+
rd = RDiscount.new("$$[(1+2)*3-4](1-2)$$", :latex)
|
249
|
+
assert_equal "<p>$$[(1+2)*3-4](1-2)$$</p>\n", rd.to_html
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_that_emphasis_beside_international_characters_detected
|
253
|
+
rd = RDiscount.new(%(*foo ä bar*))
|
254
|
+
assert_equal %(<p><em>foo ä bar</em></p>\n), rd.to_html
|
255
|
+
|
256
|
+
rd = RDiscount.new(%(*ä foobar*))
|
257
|
+
assert_equal %(<p><em>ä foobar</em></p>\n), rd.to_html
|
258
|
+
|
259
|
+
rd = RDiscount.new(%(*foobar ä*))
|
260
|
+
assert_equal %(<p><em>foobar ä</em></p>\n), rd.to_html
|
261
|
+
end
|
262
|
+
|
263
|
+
def test_taht
|
264
|
+
rd = RDiscount.new(<<EOS, :explicitlist)
|
265
|
+
- Bullet
|
266
|
+
- Bullet
|
267
|
+
|
268
|
+
1. Numbered
|
269
|
+
2. Numbered
|
270
|
+
EOS
|
271
|
+
|
272
|
+
assert_equal <<EOS, rd.to_html
|
273
|
+
<ul>
|
274
|
+
<li>Bullet</li>
|
275
|
+
<li>Bullet</li>
|
276
|
+
</ul>
|
277
|
+
|
278
|
+
|
279
|
+
<ol>
|
280
|
+
<li>Numbered</li>
|
281
|
+
<li>Numbered</li>
|
282
|
+
</ol>
|
283
|
+
|
284
|
+
EOS
|
285
|
+
end
|
286
|
+
|
253
287
|
def test_that_extra_definition_lists_work
|
254
288
|
rd = RDiscount.new(<<EOS)
|
255
289
|
tag1
|
@@ -262,15 +296,4 @@ EOS
|
|
262
296
|
</dl>
|
263
297
|
EOS
|
264
298
|
end
|
265
|
-
|
266
|
-
def test_that_emphasis_beside_international_characters_detected
|
267
|
-
rd = RDiscount.new(%(*foo ä bar*))
|
268
|
-
assert_equal %(<p><em>foo ä bar</em></p>\n), rd.to_html
|
269
|
-
|
270
|
-
rd = RDiscount.new(%(*ä foobar*))
|
271
|
-
assert_equal %(<p><em>ä foobar</em></p>\n), rd.to_html
|
272
|
-
|
273
|
-
rd = RDiscount.new(%(*foobar ä*))
|
274
|
-
assert_equal %(<p><em>foobar ä</em></p>\n), rd.to_html
|
275
|
-
end
|
276
299
|
end
|
metadata
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdiscount
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
8
8
|
- David Loren Parsons
|
9
9
|
- Andrew White
|
10
10
|
- David Foster
|
11
|
-
|
11
|
+
- l33tname
|
12
|
+
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
|
-
date:
|
15
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
15
16
|
dependencies: []
|
16
|
-
description:
|
17
|
+
description:
|
17
18
|
email: david@dafoster.net
|
18
19
|
executables:
|
19
20
|
- rdiscount
|
@@ -42,13 +43,17 @@ files:
|
|
42
43
|
- ext/extconf.rb
|
43
44
|
- ext/flags.c
|
44
45
|
- ext/generate.c
|
46
|
+
- ext/gethopt.c
|
47
|
+
- ext/gethopt.h
|
45
48
|
- ext/github_flavoured.c
|
49
|
+
- ext/h1title.c
|
46
50
|
- ext/html5.c
|
47
51
|
- ext/markdown.c
|
48
52
|
- ext/markdown.h
|
49
53
|
- ext/mkdio.c
|
50
54
|
- ext/mkdio.h
|
51
55
|
- ext/mktags.c
|
56
|
+
- ext/notspecial.c
|
52
57
|
- ext/pgm_options.c
|
53
58
|
- ext/pgm_options.h
|
54
59
|
- ext/rdiscount.c
|
@@ -74,24 +79,23 @@ homepage: http://dafoster.net/projects/rdiscount/
|
|
74
79
|
licenses:
|
75
80
|
- BSD-3-Clause
|
76
81
|
metadata: {}
|
77
|
-
post_install_message:
|
82
|
+
post_install_message:
|
78
83
|
rdoc_options: []
|
79
84
|
require_paths:
|
80
85
|
- lib
|
81
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
87
|
requirements:
|
83
|
-
- - "
|
88
|
+
- - ">="
|
84
89
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
90
|
+
version: '0'
|
86
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
92
|
requirements:
|
88
93
|
- - ">="
|
89
94
|
- !ruby/object:Gem::Version
|
90
95
|
version: '0'
|
91
96
|
requirements: []
|
92
|
-
|
93
|
-
|
94
|
-
signing_key:
|
97
|
+
rubygems_version: 3.2.3
|
98
|
+
signing_key:
|
95
99
|
specification_version: 4
|
96
100
|
summary: Fast Implementation of Gruber's Markdown in C
|
97
101
|
test_files:
|