extended-markdown-filter 0.3.8 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -2
- data/extended-markdown-filter.gemspec +1 -1
- data/lib/extended-markdown-filter.rb +1 -1
- data/lib/filters/post/admonition.rb +3 -2
- data/test/fixtures/admonition.md +9 -2
- data/test/fixtures/block_admonition.md +9 -2
- data/test/test_extended_markdown_filter.rb +6 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 239054ab60310b997d26a7d7a1bd76f32d1f1af8
|
4
|
+
data.tar.gz: f453f0b546f38c54cea0db035ce1240133a17c60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b5aefaf0f8a2eb011a97f632253a844c5691c3337988ef0103fc4ab35b64231c4bba013760263c7a83846f654879809f1c1af9dd333c94bf1cd7cbd31bb2839
|
7
|
+
data.tar.gz: a16ec0288f84db76923daf87c85315e851b903292a7c22db5c2c0d263ae8a57e67b9ada8b13f40e1988bce21805331ff22ac7e401a5558def5952370da04a5b5
|
data/README.md
CHANGED
@@ -78,6 +78,13 @@ You can create separate, priority-colored callouts with `{{#tip}}`, `{{#warning}
|
|
78
78
|
Here's a hot tip: line two
|
79
79
|
|
80
80
|
{{/tip}}
|
81
|
+
|
82
|
+
{{#note}}
|
83
|
+
|
84
|
+
You should probably know this! line one
|
85
|
+
You should probably know this! line two
|
86
|
+
|
87
|
+
{{/note}}
|
81
88
|
|
82
89
|
{{#warning}}
|
83
90
|
|
@@ -86,12 +93,12 @@ You can create separate, priority-colored callouts with `{{#tip}}`, `{{#warning}
|
|
86
93
|
|
87
94
|
{{/warning}}
|
88
95
|
|
89
|
-
{{#
|
96
|
+
{{#danger}}
|
90
97
|
|
91
98
|
Sheeeeit, this is a problem: ~~line one~~
|
92
99
|
Sheeeeit, this is a problem: line two
|
93
100
|
|
94
|
-
{{/
|
101
|
+
{{/danger}}
|
95
102
|
|
96
103
|
### Intro
|
97
104
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "extended-markdown-filter"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.4.0"
|
4
4
|
spec.authors = ["Garen Torikian"]
|
5
5
|
spec.email = ["gjtorikian@gmail.com"]
|
6
6
|
spec.summary = %q{Add extended markup syntax to the HTML::Pipeline}
|
@@ -15,7 +15,7 @@ class ExtendedMarkdownFilter < HTML::Pipeline::MarkdownFilter
|
|
15
15
|
include Filters::PreFilter
|
16
16
|
include Filters::PostFilter
|
17
17
|
|
18
|
-
EMF_CURLY_TAGS = %w(intro mac windows linux all tip warning
|
18
|
+
EMF_CURLY_TAGS = %w(intro mac windows linux all tip note warning danger).join('|')
|
19
19
|
|
20
20
|
def initialize(text, context = nil, result = nil)
|
21
21
|
if context[:emf_use_blocks]
|
@@ -2,9 +2,10 @@ module Filters
|
|
2
2
|
module PostFilter
|
3
3
|
def format_admonitions!(html)
|
4
4
|
html.gsub!(/<p>#{Filters.front_wrap}\s*#tip\s*#{Filters.end_wrap}<\/p>/, '<div class="alert tip">')
|
5
|
+
html.gsub!(/<p>#{Filters.front_wrap}\s*#note\s*#{Filters.end_wrap}<\/p>/, '<div class="alert note">')
|
5
6
|
html.gsub!(/<p>#{Filters.front_wrap}\s*#warning\s*#{Filters.end_wrap}<\/p>/, '<div class="alert warning">')
|
6
|
-
html.gsub!(/<p>#{Filters.front_wrap}\s*#
|
7
|
-
html.gsub!(/<p>#{Filters.front_wrap}\s*\/(tip|warning|
|
7
|
+
html.gsub!(/<p>#{Filters.front_wrap}\s*#danger\s*#{Filters.end_wrap}<\/p>/, '<div class="alert danger">')
|
8
|
+
html.gsub!(/<p>#{Filters.front_wrap}\s*\/(tip|note|warning|danger)\s*#{Filters.end_wrap}<\/p>/, '</div>')
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
data/test/fixtures/admonition.md
CHANGED
@@ -5,6 +5,13 @@ Here's a hot tip: line two
|
|
5
5
|
|
6
6
|
{{/tip}}
|
7
7
|
|
8
|
+
{{#note}}
|
9
|
+
|
10
|
+
This is something you should know! line one
|
11
|
+
This is something you should know! line two
|
12
|
+
|
13
|
+
{{/note}}
|
14
|
+
|
8
15
|
{{#warning}}
|
9
16
|
|
10
17
|
Yo, check this out: line one
|
@@ -12,9 +19,9 @@ Yo, check this out: line two
|
|
12
19
|
|
13
20
|
{{/warning}}
|
14
21
|
|
15
|
-
{{#
|
22
|
+
{{#danger}}
|
16
23
|
|
17
24
|
Sheeeeit, this is a problem: ~~line one~~
|
18
25
|
Sheeeeit, this is a problem: line two
|
19
26
|
|
20
|
-
{{/
|
27
|
+
{{/danger}}
|
@@ -5,6 +5,13 @@ Here's a hot tip: line two
|
|
5
5
|
|
6
6
|
[[/tip]]
|
7
7
|
|
8
|
+
[[#note]]
|
9
|
+
|
10
|
+
This is something you should know! line one
|
11
|
+
This is something you should know! line two
|
12
|
+
|
13
|
+
[[/note]]
|
14
|
+
|
8
15
|
[[#warning]]
|
9
16
|
|
10
17
|
Yo, check this out: line one
|
@@ -12,9 +19,9 @@ Yo, check this out: line two
|
|
12
19
|
|
13
20
|
[[/warning]]
|
14
21
|
|
15
|
-
[[#
|
22
|
+
[[#danger]]
|
16
23
|
|
17
24
|
Sheeeeit, this is a problem: ~~line one~~
|
18
25
|
Sheeeeit, this is a problem: line two
|
19
26
|
|
20
|
-
[[/
|
27
|
+
[[/danger]]
|
@@ -99,8 +99,9 @@ class HTML::Pipeline::ExtendedMarkdownFilterTest < Minitest::Test
|
|
99
99
|
assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
|
100
100
|
|
101
101
|
assert_equal 1, doc.css('div.tip').size
|
102
|
+
assert_equal 1, doc.css('div.note').size
|
102
103
|
assert_equal 1, doc.css('div.warning').size
|
103
|
-
assert_equal 1, doc.css('div.
|
104
|
+
assert_equal 1, doc.css('div.danger').size
|
104
105
|
# the inner Markdown converted!
|
105
106
|
assert_equal 1, doc.css('strong').size
|
106
107
|
assert_equal 1, doc.css('del').size
|
@@ -111,8 +112,9 @@ class HTML::Pipeline::ExtendedMarkdownFilterTest < Minitest::Test
|
|
111
112
|
assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
|
112
113
|
|
113
114
|
assert_equal 1, doc.css('div.tip').size
|
115
|
+
assert_equal 1, doc.css('div.note').size
|
114
116
|
assert_equal 1, doc.css('div.warning').size
|
115
|
-
assert_equal 1, doc.css('div.
|
117
|
+
assert_equal 1, doc.css('div.danger').size
|
116
118
|
# the inner Markdown converted!
|
117
119
|
assert_equal 1, doc.css('strong').size
|
118
120
|
assert_equal 1, doc.css('del').size
|
@@ -123,8 +125,9 @@ class HTML::Pipeline::ExtendedMarkdownFilterTest < Minitest::Test
|
|
123
125
|
assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
|
124
126
|
|
125
127
|
assert_equal 1, doc.css('div.tip').size
|
128
|
+
assert_equal 1, doc.css('div.note').size
|
126
129
|
assert_equal 1, doc.css('div.warning').size
|
127
|
-
assert_equal 1, doc.css('div.
|
130
|
+
assert_equal 1, doc.css('div.danger').size
|
128
131
|
# the inner Markdown converted!
|
129
132
|
assert_equal 1, doc.css('strong').size
|
130
133
|
assert_equal 1, doc.css('del').size
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extended-markdown-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.4.5
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: Add extended markup syntax to the HTML::Pipeline
|