greenmat 3.2.2.1 → 3.2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/greenmat/autolink.c +5 -4
- data/ext/greenmat/houdini.h +3 -0
- data/ext/greenmat/html.c +1 -1
- data/greenmat.gemspec +1 -1
- data/lib/greenmat/version.rb +1 -1
- data/test/markdown_test.rb +24 -0
- metadata +12 -13
- data/tasks/generate_xcode_project.rake +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad510ebbbe81b765116b386b8ced689042d16bda
|
4
|
+
data.tar.gz: 8a9a99fea907d338c33f6191b67b2bf6824dc3ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d67f98f40aa8f3847189a345de7e38ee2852c372b91acc767d0e546c424d3e63e18aa6566de0fc21859d1894fc949fa70bf43cc04ddeceff3ed7efd8c6b021c3
|
7
|
+
data.tar.gz: 64b1a708033a21a9f4554b2d5d5fff44b2a1d116a46cd7331478410ea13ff37067a850925c4ca47434815620b63d8f8470fe2e1871460530012fe4a6b66a49bc
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/ext/greenmat/autolink.c
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
#include "buffer.h"
|
18
18
|
#include "autolink.h"
|
19
|
+
#include "houdini.h"
|
19
20
|
|
20
21
|
#include <string.h>
|
21
22
|
#include <stdlib.h>
|
@@ -169,7 +170,7 @@ sd_autolink__www(
|
|
169
170
|
{
|
170
171
|
size_t link_end;
|
171
172
|
|
172
|
-
if (max_rewind > 0 && !ispunct(data[-1]) &&
|
173
|
+
if (max_rewind > 0 && !ispunct(data[-1]) && is_non_space(data[-1]))
|
173
174
|
return 0;
|
174
175
|
|
175
176
|
if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
|
@@ -180,7 +181,7 @@ sd_autolink__www(
|
|
180
181
|
if (link_end == 0)
|
181
182
|
return 0;
|
182
183
|
|
183
|
-
while (link_end < size &&
|
184
|
+
while (link_end < size && is_non_space(data[link_end]))
|
184
185
|
link_end++;
|
185
186
|
|
186
187
|
link_end = autolink_delim(data, link_end, max_rewind, size);
|
@@ -222,7 +223,7 @@ sd_autolink__email(
|
|
222
223
|
return 0;
|
223
224
|
|
224
225
|
for (link_end = 0; link_end < size; ++link_end) {
|
225
|
-
|
226
|
+
char c = data[link_end];
|
226
227
|
|
227
228
|
if (isalnum(c))
|
228
229
|
continue;
|
@@ -280,7 +281,7 @@ sd_autolink__url(
|
|
280
281
|
return 0;
|
281
282
|
|
282
283
|
link_end += domain_len;
|
283
|
-
while (link_end < size &&
|
284
|
+
while (link_end < size && is_non_space(data[link_end]))
|
284
285
|
link_end++;
|
285
286
|
|
286
287
|
link_end = autolink_delim(data, link_end, max_rewind, size);
|
data/ext/greenmat/houdini.h
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#ifndef HOUDINI_H__
|
2
2
|
#define HOUDINI_H__
|
3
3
|
|
4
|
+
#include <stdlib.h>
|
4
5
|
#include "buffer.h"
|
5
6
|
|
6
7
|
#ifdef __cplusplus
|
@@ -22,6 +23,8 @@ extern void houdini_escape_html(struct buf *ob, const uint8_t *src, size_t size)
|
|
22
23
|
extern void houdini_escape_html0(struct buf *ob, const uint8_t *src, size_t size, int secure);
|
23
24
|
extern void houdini_escape_href(struct buf *ob, const uint8_t *src, size_t size);
|
24
25
|
|
26
|
+
#define is_non_space(c) (!isspace(c) || (c) >= 0x7f)
|
27
|
+
|
25
28
|
#ifdef __cplusplus
|
26
29
|
}
|
27
30
|
#endif
|
data/ext/greenmat/html.c
CHANGED
@@ -137,7 +137,7 @@ rndr_blockcode(struct buf *ob, const struct buf *text, const struct buf *lang, v
|
|
137
137
|
|
138
138
|
if (i < lang->size) {
|
139
139
|
size_t org = i;
|
140
|
-
while (i < lang->size &&
|
140
|
+
while (i < lang->size && is_non_space(lang->data[i]))
|
141
141
|
i++;
|
142
142
|
|
143
143
|
if (lang->data[org] == '.')
|
data/greenmat.gemspec
CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
|
24
24
|
s.add_development_dependency "nokogiri", "~> 1.6.0"
|
25
|
+
s.add_development_dependency "rake", "~> 10.0"
|
25
26
|
s.add_development_dependency "rake-compiler", "~> 0.8.3"
|
26
27
|
s.add_development_dependency "rspec", "~> 3.2"
|
27
|
-
s.add_development_dependency "rubygems-xcodeproj_generator", '~> 0.1'
|
28
28
|
s.add_development_dependency "test-unit", "~> 2.5.4"
|
29
29
|
end
|
data/lib/greenmat/version.rb
CHANGED
data/test/markdown_test.rb
CHANGED
@@ -131,6 +131,24 @@ HTML
|
|
131
131
|
html_equal exp, rd
|
132
132
|
end
|
133
133
|
|
134
|
+
def test_auto_linked_www_utf8_issue
|
135
|
+
rd = render_with({ autolink: true }, "www.example.com/码")
|
136
|
+
exp = %{<p><a href="http://www.example.com/%E7%A0%81">www.example.com/码</a></p>\n}
|
137
|
+
assert_equal exp, rd
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_auto_linked_url_utf8_issue
|
141
|
+
rd = render_with({ autolink: true }, "http://example.com/码")
|
142
|
+
exp = %{<p><a href="http://example.com/%E7%A0%81">http://example.com/码</a></p>\n}
|
143
|
+
assert_equal exp, rd
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_auto_linked_email_utf8_issue
|
147
|
+
rd = render_with({ autolink: true }, "r@example.comあ")
|
148
|
+
exp = %{<p><a href="mailto:r@example.com">r@example.com</a>あ</p>\n}
|
149
|
+
assert_equal exp, rd
|
150
|
+
end
|
151
|
+
|
134
152
|
def test_memory_leak_when_parsing_char_links
|
135
153
|
@markdown.render(<<-leaks)
|
136
154
|
2. Identify the wild-type cluster and determine all clusters
|
@@ -243,6 +261,12 @@ fenced
|
|
243
261
|
assert !out.include?("<pre><code>")
|
244
262
|
end
|
245
263
|
|
264
|
+
def test_that_fenced_flag_works_with_utf8
|
265
|
+
text = "```ム\ncode\n```"
|
266
|
+
out = Greenmat::Markdown.new(Greenmat::Render::HTML, :fenced_code_blocks => true).render(text)
|
267
|
+
assert out.include?(%{<pre><code class="ム">})
|
268
|
+
end
|
269
|
+
|
246
270
|
def test_that_indented_flag_works
|
247
271
|
text = <<indented
|
248
272
|
This is a simple text
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenmat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.2.
|
4
|
+
version: 3.2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natacha Porté
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -26,47 +26,47 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.6.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
29
|
+
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0
|
34
|
+
version: '10.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0
|
41
|
+
version: '10.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: rake-compiler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 0.8.3
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 0.8.3
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '3.2'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '3.2'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: test-unit
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +126,6 @@ files:
|
|
126
126
|
- lib/greenmat/version.rb
|
127
127
|
- spec/greenmat/markdown_spec.rb
|
128
128
|
- spec/spec_helper.rb
|
129
|
-
- tasks/generate_xcode_project.rake
|
130
129
|
- tasks/greenmat.rake
|
131
130
|
- tasks/spec.rake
|
132
131
|
- test/MarkdownTest_1.0.3/MarkdownTest.pl
|
@@ -247,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
246
|
version: '0'
|
248
247
|
requirements: []
|
249
248
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.
|
249
|
+
rubygems_version: 2.6.8
|
251
250
|
signing_key:
|
252
251
|
specification_version: 4
|
253
252
|
summary: A Markdown parser for Qiita, based on Redcarpet.
|