reverse_markdown 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/reverse_markdown.rb +1 -0
- data/lib/reverse_markdown/converters/details.rb +25 -0
- data/lib/reverse_markdown/version.rb +1 -1
- data/spec/lib/reverse_markdown/converters/details_spec.rb +23 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ef774cdac53cd6e678d86a0b0532bb7ab080870ade2d7a4ea924244ce2e1b2d
|
4
|
+
data.tar.gz: fac03bd80d37d2a2845e7eac16416a25cb525ce6e9b91839fbcfdf3f977a1863
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 479fb301112e0a7389977904e53ecd721048eed0d3b12757b34c93afd253fe3df9d2016e9ef7d77d06132bf2e3966bcdf58808318b02d04f6f22d6b7e63789d1
|
7
|
+
data.tar.gz: 7ed63ff4cea1db8f534fdd4ac1c3386a1660dd614d00764461850574cef0d19372447b25ab2e342745ce3ece7fe73743609ee5d03b074092f9b24d02326af32a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 2.0.0 - March 2020
|
5
|
+
- BREAKING: Dropped support for ruby 1.9.3
|
6
|
+
- Add support for `details` and `summary` tags, see #85
|
7
|
+
|
4
8
|
## 1.4.0 – January 2020
|
5
9
|
- BREAKING: jump links will no longer be ignored but treated as links, see #82
|
6
10
|
|
data/README.md
CHANGED
data/lib/reverse_markdown.rb
CHANGED
@@ -13,6 +13,7 @@ require 'reverse_markdown/converters/code'
|
|
13
13
|
require 'reverse_markdown/converters/del'
|
14
14
|
require 'reverse_markdown/converters/div'
|
15
15
|
require 'reverse_markdown/converters/drop'
|
16
|
+
require 'reverse_markdown/converters/details'
|
16
17
|
require 'reverse_markdown/converters/em'
|
17
18
|
require 'reverse_markdown/converters/h'
|
18
19
|
require 'reverse_markdown/converters/hr'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module ReverseMarkdown
|
2
|
+
module Converters
|
3
|
+
class Details < Base
|
4
|
+
def convert(node, state = {})
|
5
|
+
content = treat_children(node, state.merge(already_processed: true))
|
6
|
+
if disabled? || content.strip.empty? || state[:already_processed]
|
7
|
+
content
|
8
|
+
else
|
9
|
+
"##{content}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def enabled?
|
14
|
+
ReverseMarkdown.config.github_flavored
|
15
|
+
end
|
16
|
+
|
17
|
+
def disabled?
|
18
|
+
!enabled?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
register :details, Details.new
|
23
|
+
register :summary, Details.new
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ReverseMarkdown::Converters::Details do
|
4
|
+
let(:converter) { ReverseMarkdown::Converters::Details.new }
|
5
|
+
|
6
|
+
context 'for standard markdown' do
|
7
|
+
before { ReverseMarkdown.config.github_flavored = false }
|
8
|
+
|
9
|
+
it 'handles details tags correctly' do
|
10
|
+
node = node_for("<details>foo</details>")
|
11
|
+
expect(converter.convert(node)).to include "foo"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'for github_flavored markdown' do
|
16
|
+
before { ReverseMarkdown.config.github_flavored = true }
|
17
|
+
|
18
|
+
it 'handles details tags correctly' do
|
19
|
+
node = node_for("<details>foo</details>")
|
20
|
+
expect(converter.convert(node)).to include "#foo"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reverse_markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Opper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/reverse_markdown/converters/bypass.rb
|
124
124
|
- lib/reverse_markdown/converters/code.rb
|
125
125
|
- lib/reverse_markdown/converters/del.rb
|
126
|
+
- lib/reverse_markdown/converters/details.rb
|
126
127
|
- lib/reverse_markdown/converters/div.rb
|
127
128
|
- lib/reverse_markdown/converters/drop.rb
|
128
129
|
- lib/reverse_markdown/converters/em.rb
|
@@ -173,6 +174,7 @@ files:
|
|
173
174
|
- spec/lib/reverse_markdown/converters/blockquote_spec.rb
|
174
175
|
- spec/lib/reverse_markdown/converters/br_spec.rb
|
175
176
|
- spec/lib/reverse_markdown/converters/del_spec.rb
|
177
|
+
- spec/lib/reverse_markdown/converters/details_spec.rb
|
176
178
|
- spec/lib/reverse_markdown/converters/li_spec.rb
|
177
179
|
- spec/lib/reverse_markdown/converters/pre_spec.rb
|
178
180
|
- spec/lib/reverse_markdown/converters/strong_spec.rb
|
@@ -199,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
201
|
- !ruby/object:Gem::Version
|
200
202
|
version: '0'
|
201
203
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
204
|
+
rubygems_version: 3.1.2
|
203
205
|
signing_key:
|
204
206
|
specification_version: 4
|
205
207
|
summary: Convert html code into markdown.
|
@@ -234,6 +236,7 @@ test_files:
|
|
234
236
|
- spec/lib/reverse_markdown/converters/blockquote_spec.rb
|
235
237
|
- spec/lib/reverse_markdown/converters/br_spec.rb
|
236
238
|
- spec/lib/reverse_markdown/converters/del_spec.rb
|
239
|
+
- spec/lib/reverse_markdown/converters/details_spec.rb
|
237
240
|
- spec/lib/reverse_markdown/converters/li_spec.rb
|
238
241
|
- spec/lib/reverse_markdown/converters/pre_spec.rb
|
239
242
|
- spec/lib/reverse_markdown/converters/strong_spec.rb
|