rdiscount 2.2.0.2 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51677d6198a4b3fa64990fb931e5b68651e0abfdfa8c1afdb16713fa52c66d6b
4
- data.tar.gz: a11a9a266cd0a749614ef2fb4ee02ddc6718f12b81902a2b0281688fb4acad6e
3
+ metadata.gz: '094c22178c083e6161282414c5c91b355d3982e92e8db075df6083b5e5618404'
4
+ data.tar.gz: d051989d5cb908c4753a5e6d05ead744e91031b98eda30a3a90a59568b6145ca
5
5
  SHA512:
6
- metadata.gz: 4f108c1762e520eb80b5b73585f01a4e8bd0317ecbcc6f62ac0ca80eeb4cce87a88c4861b2e0d762956e5d765b048e6e8e4621132511e33c811249888790876b
7
- data.tar.gz: 68af4be8ec06761fb3d34a9c66bdd6105436d1249bc23653cc3781510ba0fb9ed4e50da6d8aa09ec0194abaa83311d5a620ec46a311c5ce4e4d933e7b6a37779
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
- [![Build Status](https://travis-ci.org/davidfstr/rdiscount.svg?branch=master)](https://travis-ci.org/davidfstr/rdiscount)
4
- [![Build status](https://ci.appveyor.com/api/projects/status/47i0qxrnvjbg724f/branch/master?svg=true)](https://ci.appveyor.com/project/DavidFoster/rdiscount/branch/master)
3
+ [![Build Status](https://github.com/davidfstr/rdiscount/actions/workflows/main.yml/badge.svg)](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. It
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: <http://dafoster.net/projects/rdiscount/>
12
- DOCS: <http://rdoc.info/github/davidfstr/rdiscount/master/RDiscount>
13
- BUGS: <http://github.com/davidfstr/rdiscount/issues>
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]. The Ruby extension
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]: http://daringfireball.net/projects/markdown/syntax
19
- [2]: http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip
20
- [3]: http://www.pell.portland.or.us/~orc
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
- # Usage: rdiscount [<file>...]
3
- # Convert one or more Markdown files to HTML and write to standard output. With
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
- STDOUT.write(RDiscount.new(ARGF.read).to_html)
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, int flags)
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, 0, &f, 0);
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.0
1
+ 2.2.7c
data/ext/amalloc.c CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  #include <stdio.h>
7
7
  #include <stdlib.h>
8
+ #include "config.h"
8
9
 
9
10
  #define MAGIC 0x1f2e3d4c
10
11
 
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 29
34
+ #define NR_blocktags 30
data/ext/config.h CHANGED
@@ -7,6 +7,8 @@
7
7
  /* tabs are four spaces */
8
8
  #define TABSTOP 4
9
9
 
10
+ #define DESTRUCTOR __attribute__((__destructor__))
11
+
10
12
  /* these are setup by extconf.rb */
11
13
  #if HAVE_RANDOM
12
14
  #define COINTOSS() (random()&1)
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
- /* HACK ALERT! HACK ALERT! HACK ALERT! */
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
- else
65
- DELETE(f);
63
+ DELETE(f);
66
64
  return size;
67
65
  }
68
66
  return EOF;
data/ext/cstring.h CHANGED
@@ -72,6 +72,5 @@ typedef STRING(char) Cstring;
72
72
  extern void Csputc(int, Cstring *);
73
73
  extern int Csprintf(Cstring *, char *, ...);
74
74
  extern int Cswrite(Cstring *, char *, int);
75
- extern void Csreparse(Cstring *, char *, int, int);
76
75
 
77
76
  #endif/*_CSTRING_D*/
data/ext/docheader.c CHANGED
@@ -17,7 +17,12 @@
17
17
  static char *
18
18
  onlyifset(Line *l)
19
19
  {
20
- char *ret = T(l->text) + l->dle;
20
+ char *ret;
21
+
22
+ if ( l->dle < 0 || l->dle >= S(l->text) )
23
+ return 0;
24
+
25
+ ret = T(l->text) + l->dle;
21
26
 
22
27
  return ret[0] ? ret : 0;
23
28
  }
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
- d = fprintf(f, "[%s", Pptype(pp->typ));
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, int flags, char *title)
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
- DWORD flag;
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, DWORD flags, int htmlplease)
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;