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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: '094c22178c083e6161282414c5c91b355d3982e92e8db075df6083b5e5618404'
|
|
4
|
+
data.tar.gz: d051989d5cb908c4753a5e6d05ead744e91031b98eda30a3a90a59568b6145ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61a686cfbad1d1a5e28801bbce4a456d7a409fe2e8f104a67791bb35304518fcb5f36fc5ed9cb4ed4963577f4e2862e636f916dd9259f8bfd273d2924bd7daef
|
|
7
|
+
data.tar.gz: 185f481096dd9f823473ed0dfae4161232631ab388828915e25831c842dc257be9fe45e987685eb653e1734f8787f9f11e59e24fdf3ad0780a96251bde21356d
|
data/README.markdown
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
Discount Markdown Processor for Ruby
|
|
2
2
|
====================================
|
|
3
|
-
[](https://ci.appveyor.com/project/DavidFoster/rdiscount/branch/master)
|
|
3
|
+
[](https://github.com/davidfstr/rdiscount/actions/workflows/main.yml)
|
|
5
4
|
|
|
6
|
-
Discount is an implementation of John Gruber's Markdown markup language in C.
|
|
7
|
-
implements all of the language described in [the markdown syntax document][1] and
|
|
5
|
+
Discount is an implementation of John Gruber's Markdown markup language in C.
|
|
6
|
+
It implements all of the language described in [the markdown syntax document][1] and
|
|
8
7
|
passes the [Markdown 1.0 test suite][2].
|
|
9
8
|
|
|
10
9
|
CODE: `git clone git://github.com/davidfstr/rdiscount.git`
|
|
11
|
-
HOME: <
|
|
12
|
-
DOCS: <
|
|
13
|
-
BUGS: <
|
|
10
|
+
HOME: <https://dafoster.net/projects/rdiscount/>
|
|
11
|
+
DOCS: <https://rdoc.info/github/davidfstr/rdiscount/master/RDiscount>
|
|
12
|
+
BUGS: <https://github.com/davidfstr/rdiscount/issues>
|
|
14
13
|
|
|
15
|
-
Discount was developed by [David Loren Parsons][3].
|
|
16
|
-
is maintained by [David Foster][4].
|
|
14
|
+
Discount was developed by [David Loren Parsons][3].
|
|
15
|
+
The Ruby extension is maintained by [David Foster][4].
|
|
17
16
|
|
|
18
|
-
[1]:
|
|
19
|
-
[2]:
|
|
20
|
-
[3]:
|
|
17
|
+
[1]: https://daringfireball.net/projects/markdown/syntax
|
|
18
|
+
[2]: https://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip
|
|
19
|
+
[3]: https://www.pell.portland.or.us/~orc
|
|
21
20
|
[4]: https://github.com/davidfstr
|
|
22
21
|
|
|
23
22
|
INSTALL, HACKING
|
data/Rakefile
CHANGED
|
@@ -53,7 +53,7 @@ task :man => 'man/rdiscount.1'
|
|
|
53
53
|
require 'rake/testtask'
|
|
54
54
|
Rake::TestTask.new('test:unit') do |t|
|
|
55
55
|
t.test_files = FileList['test/*_test.rb']
|
|
56
|
-
t.ruby_opts += ['-rubygems'] if defined? Gem
|
|
56
|
+
t.ruby_opts += ['-r rubygems'] if defined? Gem
|
|
57
57
|
end
|
|
58
58
|
task 'test:unit' => [:build]
|
|
59
59
|
|
|
@@ -67,11 +67,20 @@ task 'test:conformance' => [:build] do |t|
|
|
|
67
67
|
print result
|
|
68
68
|
fail unless result.include? "; 0 failed."
|
|
69
69
|
end
|
|
70
|
+
|
|
71
|
+
# Allow to run this rake tasks multiple times
|
|
72
|
+
# https://medium.com/@shaneilske/invoke-a-rake-task-multiple-times-1bcb01dee9d9
|
|
73
|
+
ENV.delete("MARKDOWN_TEST_VER")
|
|
74
|
+
ENV.delete("RDISCOUNT_EXTENSIONS")
|
|
75
|
+
Rake::Task["test:conformance"].reenable
|
|
70
76
|
end
|
|
71
77
|
|
|
72
78
|
desc 'Run version 1.0 conformance suite'
|
|
73
79
|
task 'test:conformance:1.0' => [:build] do |t|
|
|
74
80
|
ENV['MARKDOWN_TEST_VER'] = '1.0'
|
|
81
|
+
# see https://github.com/Orc/discount/issues/261
|
|
82
|
+
# requires flags -f1.0,tabstop,nopants
|
|
83
|
+
ENV['RDISCOUNT_EXTENSIONS'] = "md1compat"
|
|
75
84
|
Rake::Task['test:conformance'].invoke
|
|
76
85
|
end
|
|
77
86
|
|
|
@@ -82,7 +91,7 @@ task 'test:conformance:1.0.3' => [:build] do |t|
|
|
|
82
91
|
end
|
|
83
92
|
|
|
84
93
|
desc 'Run unit and conformance tests'
|
|
85
|
-
task :test => %w[test:unit test:conformance]
|
|
94
|
+
task :test => %w[test:unit test:conformance:1.0 test:conformance:1.0.3]
|
|
86
95
|
|
|
87
96
|
desc 'Run benchmarks'
|
|
88
97
|
task :benchmark => :build do |t|
|
data/bin/rdiscount
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
#
|
|
3
|
-
#
|
|
2
|
+
#
|
|
3
|
+
# Usage: [env RDISCOUNT_EXTENSIONS='<extension>,...'] rdiscount [<file>...]
|
|
4
4
|
# no <file> or when <file> is '-', read Markdown source text from standard input.
|
|
5
|
+
#
|
|
6
|
+
# Convert one or more Markdown files to HTML and write to standard output.
|
|
7
|
+
# With no <file> or when <file> is '-', read Markdown source text from
|
|
8
|
+
# standard input. Optionally, the RDISCOUNT_EXTENSIONS environment variable
|
|
9
|
+
# can specify a comma-separated list of extensions to enable in RDiscount.
|
|
10
|
+
#
|
|
5
11
|
if ARGV.include?('--help')
|
|
6
12
|
File.read(__FILE__).split("\n").grep(/^# /).each do |line|
|
|
7
13
|
puts line[2..-1]
|
|
@@ -10,4 +16,5 @@ if ARGV.include?('--help')
|
|
|
10
16
|
end
|
|
11
17
|
|
|
12
18
|
require 'rdiscount'
|
|
13
|
-
|
|
19
|
+
extensions = ENV['RDISCOUNT_EXTENSIONS'].to_s.split(',').map{ |key| key.to_sym }
|
|
20
|
+
STDOUT.write(RDiscount.new(ARGF.read, *extensions).to_html)
|
data/ext/Csio.c
CHANGED
|
@@ -50,11 +50,11 @@ Cswrite(Cstring *iot, char *bfr, int size)
|
|
|
50
50
|
/* reparse() into a cstring
|
|
51
51
|
*/
|
|
52
52
|
void
|
|
53
|
-
Csreparse(Cstring *iot, char *buf, int size,
|
|
53
|
+
Csreparse(Cstring *iot, char *buf, int size, mkd_flag_t flags)
|
|
54
54
|
{
|
|
55
55
|
MMIOT f;
|
|
56
56
|
___mkd_initmmiot(&f, 0);
|
|
57
|
-
___mkd_reparse(buf, size,
|
|
57
|
+
___mkd_reparse(buf, size, flags, &f, 0);
|
|
58
58
|
___mkd_emblock(&f);
|
|
59
59
|
SUFFIX(*iot, T(f.out), S(f.out));
|
|
60
60
|
___mkd_freemmiot(&f, 0);
|
data/ext/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.2.
|
|
1
|
+
2.2.7c
|
data/ext/amalloc.c
CHANGED
data/ext/blocktags
CHANGED
|
@@ -17,6 +17,7 @@ static struct kw blocktags[] = {
|
|
|
17
17
|
{ "PRE", 3, 0 },
|
|
18
18
|
{ "WBR", 3, 0 },
|
|
19
19
|
{ "XMP", 3, 0 },
|
|
20
|
+
{ "FORM", 4, 0 },
|
|
20
21
|
{ "NOBR", 4, 0 },
|
|
21
22
|
{ "STYLE", 5, 0 },
|
|
22
23
|
{ "TABLE", 5, 0 },
|
|
@@ -30,4 +31,4 @@ static struct kw blocktags[] = {
|
|
|
30
31
|
{ "BLOCKQUOTE", 10, 0 },
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
#define NR_blocktags
|
|
34
|
+
#define NR_blocktags 30
|
data/ext/config.h
CHANGED
data/ext/css.c
CHANGED
|
@@ -54,15 +54,13 @@ mkd_css(Document *d, char **res)
|
|
|
54
54
|
stylesheets(d->code, &f);
|
|
55
55
|
|
|
56
56
|
if ( (size = S(f)) > 0 ) {
|
|
57
|
+
/* null-terminate, then strdup() into a free()able memory
|
|
58
|
+
* chunk
|
|
59
|
+
*/
|
|
57
60
|
EXPAND(f) = 0;
|
|
58
|
-
|
|
59
|
-
*res = T(f);/* we know that a T(Cstring) is a character pointer */
|
|
60
|
-
/* so we can simply pick it up and carry it away, */
|
|
61
|
-
/* leaving the husk of the Ctring on the stack */
|
|
62
|
-
/* END HACK ALERT */
|
|
61
|
+
*res = strdup(T(f));
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
DELETE(f);
|
|
63
|
+
DELETE(f);
|
|
66
64
|
return size;
|
|
67
65
|
}
|
|
68
66
|
return EOF;
|
data/ext/cstring.h
CHANGED
data/ext/docheader.c
CHANGED
data/ext/dumptree.c
CHANGED
|
@@ -108,9 +108,18 @@ dumptree(Paragraph *pp, Stack *sp, FILE *f)
|
|
|
108
108
|
changepfx(sp, '`');
|
|
109
109
|
printpfx(sp, f);
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
if ( pp->typ == HDR )
|
|
112
|
+
d += fprintf(f, "[h%d", pp->hnumber);
|
|
113
|
+
else
|
|
114
|
+
d = fprintf(f, "[%s", Pptype(pp->typ));
|
|
112
115
|
if ( pp->ident )
|
|
113
116
|
d += fprintf(f, " %s", pp->ident);
|
|
117
|
+
|
|
118
|
+
#ifdef GITHUB_CHECKBOX
|
|
119
|
+
if ( pp->flags )
|
|
120
|
+
d += fprintf(f, " %x", pp->flags);
|
|
121
|
+
#endif
|
|
122
|
+
|
|
114
123
|
if ( pp->align > 1 )
|
|
115
124
|
d += fprintf(f, ", <%s>", Begin[pp->align]);
|
|
116
125
|
|
|
@@ -134,7 +143,7 @@ dumptree(Paragraph *pp, Stack *sp, FILE *f)
|
|
|
134
143
|
|
|
135
144
|
|
|
136
145
|
int
|
|
137
|
-
mkd_dump(Document *doc, FILE *out,
|
|
146
|
+
mkd_dump(Document *doc, FILE *out, mkd_flag_t flags, char *title)
|
|
138
147
|
{
|
|
139
148
|
Stack stack;
|
|
140
149
|
|
data/ext/extconf.rb
CHANGED
|
@@ -33,6 +33,7 @@ open(File.join(File.dirname(__FILE__), "ruby-config.h"), "wb") do |f|
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
$defs.push("-DVERSION=\\\"#{VERSION}\\\"")
|
|
36
|
+
$defs.push("-DBRANCH=\"\"")
|
|
36
37
|
|
|
37
38
|
# Post XCode 5.1 the command line tools on OS X treat unrecognised
|
|
38
39
|
# command line options as errors and it's been seen that
|
data/ext/flags.c
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#include "markdown.h"
|
|
3
3
|
|
|
4
4
|
struct flagnames {
|
|
5
|
-
|
|
5
|
+
mkd_flag_t flag;
|
|
6
6
|
char *name;
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -36,12 +36,14 @@ static struct flagnames flagnames[] = {
|
|
|
36
36
|
{ MKD_IDANCHOR, "IDANCHOR" },
|
|
37
37
|
{ MKD_GITHUBTAGS, "GITHUBTAGS" },
|
|
38
38
|
{ MKD_URLENCODEDANCHOR, "URLENCODEDANCHOR" },
|
|
39
|
+
{ MKD_LATEX, "LATEX" },
|
|
40
|
+
{ MKD_EXPLICITLIST, "EXPLICITLIST" },
|
|
39
41
|
};
|
|
40
42
|
#define NR(x) (sizeof x/sizeof x[0])
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
void
|
|
44
|
-
mkd_flags_are(FILE *f,
|
|
46
|
+
mkd_flags_are(FILE *f, mkd_flag_t flags, int htmlplease)
|
|
45
47
|
{
|
|
46
48
|
int i;
|
|
47
49
|
int not, set, even=1;
|