greenmat 3.2.2.2 → 3.2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -5
- data/CHANGELOG.md +5 -0
- data/ext/greenmat/html.c +2 -2
- data/greenmat.gemspec +1 -0
- data/lib/greenmat/version.rb +1 -1
- data/spec/greenmat/markdown_spec.rb +22 -0
- data/test/greenmat_compat_test.rb +2 -2
- data/test/html_render_test.rb +1 -1
- data/test/markdown_test.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c262a03423b493ee65e18596be8c43ff6bd1054f
|
4
|
+
data.tar.gz: 7bf79cfee8896f894b734bd533efd203f8a241b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b67b6c31ed735bce10d1b15a4f4c6c4031180b85e68045bdbbdfe43dc7bd5eb5fd4eb064731bba203dec8b39d343551b70a0c9389fb12c4b68df8eefe429529e
|
7
|
+
data.tar.gz: 777f5537057df083882172d98d5fae8576e819eacf5f61cc77b1e9f974811e4e523908f4a47529c803e30e42342a0b0061fae107f256d9b115cd00509be2a8a5
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## v3.2.2.3
|
6
|
+
|
7
|
+
* Change `<code>` attribute for code block metadata (language) from `class` to `data-metadata`.
|
8
|
+
Note that this is a breaking change, though you won't face this breakage if you're using greenmat through qiita-markdown gem and updating both gems.
|
9
|
+
|
5
10
|
## v3.2.2.2
|
6
11
|
|
7
12
|
* Fix bugs in UTF-8 handling. [#3](https://github.com/increments/greenmat/pull/3) ([@gfx](https://github.com/gfx))
|
data/ext/greenmat/html.c
CHANGED
@@ -125,10 +125,10 @@ rndr_blockcode(struct buf *ob, const struct buf *text, const struct buf *lang, v
|
|
125
125
|
if (lang && lang->size) {
|
126
126
|
size_t i, cls;
|
127
127
|
if (options->flags & HTML_PRETTIFY) {
|
128
|
-
BUFPUTSL(ob, "<pre><code class=\"prettyprint ");
|
128
|
+
BUFPUTSL(ob, "<pre><code class=\"prettyprint\" data-metadata=\"");
|
129
129
|
cls++;
|
130
130
|
} else {
|
131
|
-
BUFPUTSL(ob, "<pre><code
|
131
|
+
BUFPUTSL(ob, "<pre><code data-metadata=\"");
|
132
132
|
}
|
133
133
|
|
134
134
|
for (i = 0, cls = 0; i < lang->size; ++i, ++cls) {
|
data/greenmat.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.executables = ["greenmat"]
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
|
24
|
+
s.add_development_dependency "activesupport"
|
24
25
|
s.add_development_dependency "nokogiri", "~> 1.6.0"
|
25
26
|
s.add_development_dependency "rake", "~> 10.0"
|
26
27
|
s.add_development_dependency "rake-compiler", "~> 0.8.3"
|
data/lib/greenmat/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'greenmat'
|
2
|
+
require "active_support/core_ext/string/strip"
|
2
3
|
|
3
4
|
module Greenmat
|
4
5
|
RSpec.describe Markdown do
|
@@ -61,5 +62,26 @@ module Greenmat
|
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
65
|
+
|
66
|
+
context 'with fenced_code_blocks option' do
|
67
|
+
let(:options) { { fenced_code_blocks: true } }
|
68
|
+
|
69
|
+
context 'with language and filename syntax' do
|
70
|
+
let(:text) do
|
71
|
+
<<-EOS.strip_heredoc
|
72
|
+
```ruby:example.rb
|
73
|
+
puts :foo
|
74
|
+
```
|
75
|
+
EOS
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'generates <code> tag with data-metadata attribute' do
|
79
|
+
expect(rendered_html).to eq <<-EOS.strip_heredoc
|
80
|
+
<pre><code data-metadata="ruby:example.rb">puts :foo
|
81
|
+
</code></pre>
|
82
|
+
EOS
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
64
86
|
end
|
65
87
|
end
|
@@ -15,13 +15,13 @@ class GreenmatCompatTest < Greenmat::TestCase
|
|
15
15
|
def test_compat_api_knows_fenced_code_extension
|
16
16
|
text = "```ruby\nx = 'foo'\n```"
|
17
17
|
html = GreenmatCompat.new(text, :fenced_code).to_html
|
18
|
-
html_equal "<pre><code
|
18
|
+
html_equal "<pre><code data-metadata=\"ruby\">x = 'foo'\n</code></pre>\n", html
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_compat_api_ignores_gh_blockcode_extension
|
22
22
|
text = "```ruby\nx = 'foo'\n```"
|
23
23
|
html = GreenmatCompat.new(text, :fenced_code, :gh_blockcode).to_html
|
24
|
-
html_equal "<pre><code
|
24
|
+
html_equal "<pre><code data-metadata=\"ruby\">x = 'foo'\n</code></pre>\n", html
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_compat_api_knows_no_intraemphasis_extension
|
data/test/html_render_test.rb
CHANGED
@@ -218,7 +218,7 @@ Markdown
|
|
218
218
|
renderer = Greenmat::Markdown.new(@rndr[:prettify], fenced_code_blocks: true)
|
219
219
|
output = renderer.render(text)
|
220
220
|
|
221
|
-
assert output.include?("<code class=\"prettyprint ruby\">")
|
221
|
+
assert output.include?("<code class=\"prettyprint\" data-metadata=\"ruby\">")
|
222
222
|
end
|
223
223
|
|
224
224
|
def test_safe_links_only_with_anchors
|
data/test/markdown_test.rb
CHANGED
@@ -264,7 +264,7 @@ fenced
|
|
264
264
|
def test_that_fenced_flag_works_with_utf8
|
265
265
|
text = "```ム\ncode\n```"
|
266
266
|
out = Greenmat::Markdown.new(Greenmat::Render::HTML, :fenced_code_blocks => true).render(text)
|
267
|
-
assert out.include?(%{<pre><code
|
267
|
+
assert out.include?(%{<pre><code data-metadata="ム">})
|
268
268
|
end
|
269
269
|
|
270
270
|
def test_that_indented_flag_works
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natacha Porté
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: nokogiri
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
260
|
version: '0'
|
247
261
|
requirements: []
|
248
262
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.6.
|
263
|
+
rubygems_version: 2.6.11
|
250
264
|
signing_key:
|
251
265
|
specification_version: 4
|
252
266
|
summary: A Markdown parser for Qiita, based on Redcarpet.
|