extended-markdown-filter 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ab22b2196b7e2220a61d4ed64cb2cb67a64ae44
4
- data.tar.gz: 45d7f1cb486bfc60222eefa01632ed196fdbc55b
3
+ metadata.gz: d5200188fe9d4b095aa94f5f19e4eb08a391fc18
4
+ data.tar.gz: daec275fb2ae5afd8d68fdbbc202a8cadf295c3d
5
5
  SHA512:
6
- metadata.gz: 5ff127883e4653b95fe2f4443d4359fbc87d9b8e83c3e67bee197aba5e9b498a1e2ea8535c71b65fd079fdd0147c05454778887516e7db86d3ce97faa38a487b
7
- data.tar.gz: 27cf75701f4c3798a716307f98a380ee9b72a2a06b47142de8634fb46f698e00b735b98b968b6a05bd978ebd3f34e0ced3efe020edc2bf1963ac4b391c8403f1
6
+ metadata.gz: dd1669f41d01f2e74a6a5613e66a2c1f604f3abccdaad70fa001b1263e23899a77cefbbf4a132f5effb59bec199c7dd991988ea723c3364e616c9dbc6c34714b
7
+ data.tar.gz: d0b94f8baa1b9c915f28b091788191732ab7fc33d9c1eafb35282039b09aaa77d63546ffed66cb6b9ef0bb9ab201aad93ab9ed931d849d6b7c15fbcaf6804b04
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "extended-markdown-filter"
3
- spec.version = "0.3.6"
3
+ spec.version = "0.3.7"
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}
@@ -35,6 +35,7 @@ class ExtendedMarkdownFilter < HTML::Pipeline::MarkdownFilter
35
35
  end
36
36
 
37
37
  def self.convert_curly_to_bracket(text)
38
+ return text if text.nil?
38
39
  text = text.gsub(/\{\{\s*#(#{EMF_CURLY_TAGS})\s*\}\}/, '[[#\1]]')
39
40
  text = text.gsub(/\{\{\s*\/(#{EMF_CURLY_TAGS})\s*\}\}/, '[[/\1]]')
40
41
  text = text.gsub(/\{\{\s*(octicon-\S+\s*[^\}]+)\s*\}\}/, '[[\1]]')
@@ -42,6 +43,11 @@ class ExtendedMarkdownFilter < HTML::Pipeline::MarkdownFilter
42
43
  text
43
44
  end
44
45
 
46
+ def self.should_jekyll_replace?(site)
47
+ html_pipeline_context = site.site_payload["site"]["html_pipeline"] && site.site_payload["site"]["html_pipeline"]["context"]
48
+ site.site_payload["site"]["markdown"] == "HTMLPipeline" && html_pipeline_context && site.site_payload["site"]["html_pipeline"]["context"][:emf_use_blocks]
49
+ end
50
+
45
51
  def call
46
52
  # initialize HTML::Pipeline::Markdown, then do post-processing
47
53
  html = super
@@ -6,11 +6,24 @@ module Jekyll
6
6
  alias_method :old_run, :run
7
7
 
8
8
  def run
9
- html_pipeline_context = site.site_payload["site"]["html_pipeline"] && site.site_payload["site"]["html_pipeline"]["context"]
10
- if site.site_payload["site"]["markdown"] == "HTMLPipeline" && html_pipeline_context && site.site_payload["site"]["html_pipeline"]["context"][:emf_use_blocks]
9
+ if ExtendedMarkdownFilter.should_jekyll_replace?(site)
11
10
  document.content = ExtendedMarkdownFilter.convert_curly_to_bracket(document.content)
12
11
  end
13
12
  old_run
14
13
  end
14
+
15
+ end
16
+ end
17
+
18
+ module Jekyll
19
+ class Page
20
+ alias_method :old_render, :render
21
+
22
+ def render(layouts, site_payload)
23
+ if ExtendedMarkdownFilter.should_jekyll_replace?(site)
24
+ self.content = ExtendedMarkdownFilter.convert_curly_to_bracket(content)
25
+ end
26
+ old_render(layouts, site_payload)
27
+ end
15
28
  end
16
29
  end
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.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-09 00:00:00.000000000 Z
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline