extended-markdown-filter 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/extended-markdown-filter.gemspec +1 -1
- data/lib/extended-markdown-filter.rb +1 -8
- data/lib/filters/filters.rb +11 -0
- data/lib/filters/post/admonition.rb +1 -2
- data/lib/filters/post/intro.rb +1 -2
- data/lib/filters/post/os-blocks.rb +1 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e569e5b9e033f4ea11723b2d3fc1fd6686f198d2
|
4
|
+
data.tar.gz: 84df74f4cd5b2876eecd5ea183c6f2494138d6a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41188b4985ad1e114413660bb787639e9c0950cd81f31f8c36de14b6c72461ef07952b12727f501921c57b3582d5d6eae07d98ae3581918be9d814da6bc4f64d
|
7
|
+
data.tar.gz: d3a04b1fa512dc65f96e03a8c520a99d034c400f0472c69bd5a08d06295f1ec9d005409102a3cb84dcfa590826e12e4749de498a40a3b80333fe2aa38b02eb8f
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "extended-markdown-filter"
|
3
|
-
spec.version = "0.4.
|
3
|
+
spec.version = "0.4.6"
|
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}
|
@@ -1,15 +1,8 @@
|
|
1
1
|
require 'html/pipeline'
|
2
|
+
require 'filters/filters'
|
2
3
|
require 'nokogiri'
|
3
4
|
require 'jekyll-override' unless defined?(Jekyll).nil?
|
4
5
|
|
5
|
-
Dir[File.join(File.expand_path(File.dirname(__FILE__)), "filters", "pre", "*.rb")].each do |file|
|
6
|
-
require file
|
7
|
-
end
|
8
|
-
|
9
|
-
Dir[File.join(File.expand_path(File.dirname(__FILE__)), "filters", "post", "*.rb")].each do |file|
|
10
|
-
require file
|
11
|
-
end
|
12
|
-
|
13
6
|
class ExtendedMarkdownFilter < HTML::Pipeline::MarkdownFilter
|
14
7
|
include Filters::PreFilter
|
15
8
|
include Filters::PostFilter
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Filters
|
2
|
+
CLOSE_DIV = '</div>'
|
3
|
+
end
|
4
|
+
|
5
|
+
Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'pre', '*.rb')].each do |file|
|
6
|
+
require file
|
7
|
+
end
|
8
|
+
|
9
|
+
Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'post','*.rb')].each do |file|
|
10
|
+
require file
|
11
|
+
end
|
@@ -4,14 +4,13 @@ module Filters
|
|
4
4
|
NOTE_HTML = '<div class="alert note">'
|
5
5
|
WARNING_HTML = '<div class="alert warning">'
|
6
6
|
DANGER_HTML = '<div class="alert danger">'
|
7
|
-
CLOSE_DIV = '</div>'
|
8
7
|
|
9
8
|
def format_admonitions!(html)
|
10
9
|
html.gsub!(/<p>#{@front_wrap}#tip#{@end_wrap}<\/p>/, TIP_HTML)
|
11
10
|
html.gsub!(/<p>#{@front_wrap}#note#{@end_wrap}<\/p>/, NOTE_HTML)
|
12
11
|
html.gsub!(/<p>#{@front_wrap}#warning#{@end_wrap}<\/p>/, WARNING_HTML)
|
13
12
|
html.gsub!(/<p>#{@front_wrap}#danger#{@end_wrap}<\/p>/, DANGER_HTML)
|
14
|
-
html.gsub!(/<p>#{@front_wrap}\/(tip|note|warning|danger)#{@end_wrap}<\/p>/, CLOSE_DIV)
|
13
|
+
html.gsub!(/<p>#{@front_wrap}\/(tip|note|warning|danger)#{@end_wrap}<\/p>/, Filters::CLOSE_DIV)
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
data/lib/filters/post/intro.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
module Filters
|
2
2
|
module PostFilter
|
3
3
|
INTRO_HTML = '<div class="intro">'
|
4
|
-
CLOSE_DIV = '</div>'
|
5
4
|
|
6
5
|
def format_intro!(html)
|
7
6
|
html.gsub!(/<p>#{@front_wrap}#intro#{@end_wrap}<\/p>/, INTRO_HTML)
|
8
|
-
html.gsub!(/<p>#{@front_wrap}\/intro#{@end_wrap}<\/p>/, CLOSE_DIV)
|
7
|
+
html.gsub!(/<p>#{@front_wrap}\/intro#{@end_wrap}<\/p>/, Filters::CLOSE_DIV)
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
@@ -4,14 +4,13 @@ module Filters
|
|
4
4
|
WIN_HTML = '<div class="platform-windows">'
|
5
5
|
LINUX_HTML = '<div class="platform-linux">'
|
6
6
|
ALL_HTML = '<div class="platform-all">'
|
7
|
-
CLOSE_DIV = '</div>'
|
8
7
|
|
9
8
|
def format_os_blocks!(html)
|
10
9
|
html.gsub!(/<p>#{@front_wrap}#mac#{@end_wrap}<\/p>/, MAC_HTML)
|
11
10
|
html.gsub!(/<p>#{@front_wrap}#windows#{@end_wrap}<\/p>/, WIN_HTML)
|
12
11
|
html.gsub!(/<p>#{@front_wrap}#linux#{@end_wrap}<\/p>/, LINUX_HTML)
|
13
12
|
html.gsub!(/<p>#{@front_wrap}#all#{@end_wrap}<\/p>/, ALL_HTML)
|
14
|
-
html.gsub!(/<p>#{@front_wrap}\/(mac|windows|linux|all)#{@end_wrap}<\/p>/, CLOSE_DIV)
|
13
|
+
html.gsub!(/<p>#{@front_wrap}\/(mac|windows|linux|all)#{@end_wrap}<\/p>/, Filters::CLOSE_DIV)
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extended-markdown-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- Rakefile
|
110
110
|
- extended-markdown-filter.gemspec
|
111
111
|
- lib/extended-markdown-filter.rb
|
112
|
+
- lib/filters/filters.rb
|
112
113
|
- lib/filters/post/admonition.rb
|
113
114
|
- lib/filters/post/intro.rb
|
114
115
|
- lib/filters/post/octicon.rb
|