rails_markdown_templates 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7db5971722bda0fd05c0f21bea0f11dd03129cdf
4
- data.tar.gz: bf94607a28f7b2ce017954640e04502881e5c1b8
3
+ metadata.gz: e38a0438d0764ee145d1f7509e5a5c8337df4fc3
4
+ data.tar.gz: b80e2d38af6f6b8514f51bdf2fcbf611bdaf61d0
5
5
  SHA512:
6
- metadata.gz: 9f2c65a700b914015d61545798f5db12275faee4f4617fe1638e351bd3fedbfec5b354d0a53851cd4ae212c4e575bbd2b0d3d0e48603e50d6242a27aa4258eb0
7
- data.tar.gz: 20c7e849a878d0c819cc1d989a020b66c87b1d8a6fb8078d4f2faba1f7008486f50b900a86a4e7a00bb22302ea4af4becd5efda8fd5aa895800e6a91597f42e2
6
+ metadata.gz: 4c01c01c0bf86226802cdde9e78486b50929c749dcecb80d25174491488dcb774c5b29a618440fc5f5646b215f78b8e2032d5c22aacf288a48e1057704b88b92
7
+ data.tar.gz: ff6169dbcebd112bc0657612380bac57ba626b92804c627cbd25f852b203187e0397d99aa402b6933b11ca69a79b30de4f82075f9b75cecb657121b0f5b6c2e2
data/README.md CHANGED
@@ -36,8 +36,8 @@ to change these, then create a file in the
36
36
 
37
37
  ```ruby
38
38
  # Set the metadata content keys for the Markdown template handler
39
- ActionView::Template::Handlers::Markdown.metadata_tags_key = :my_metadata_tags
40
- ActionView::Template::Handlers::Markdown.metadata_json_key = :my_metadata_json
39
+ RailsMarkdownTemplates.metadata_tags_key = :my_metadata_tags
40
+ RailsMarkdownTemplates.metadata_json_key = :my_metadata_json
41
41
  ```
42
42
 
43
43
  ## Embedded Ruby handling
@@ -23,10 +23,8 @@ module ActionView
23
23
  module Template::Handlers
24
24
  # Rails template handler for markdown
25
25
  class Markdown
26
- class_attribute :default_format, :metadata_tags_key, :metadata_json_key
26
+ class_attribute :default_format
27
27
  self.default_format = Mime::HTML
28
- self.metadata_tags_key = :metadata_tags
29
- self.metadata_json_key = :metadata_json
30
28
 
31
29
  def self.erb
32
30
  @erb ||= ActionView::Template.registered_template_handler :erb
@@ -39,13 +37,13 @@ module ActionView
39
37
  # Evaluate embedded Ruby
40
38
  compiled_source = erb.call(template)
41
39
 
42
- tags_key = self.metadata_tags_key
43
- json_key = self.metadata_json_key
44
40
  <<-RUBY_CODE
45
41
  markdown = Redcarpet::Markdown.new(RailsMarkdownTemplates::Renderer)
46
42
  output = markdown.render(begin;#{compiled_source};end)
47
- content_for("#{tags_key}".to_sym, markdown.renderer.metadata_tags)
48
- content_for("#{json_key}".to_sym, markdown.renderer.metadata_json)
43
+ content_for(RailsMarkdownTemplates.metadata_tags_key,
44
+ markdown.renderer.metadata_tags)
45
+ content_for(RailsMarkdownTemplates.metadata_json_key,
46
+ markdown.renderer.metadata_json)
49
47
  output
50
48
  RUBY_CODE
51
49
  end
@@ -17,5 +17,5 @@
17
17
  # <http://www.gnu.org/licenses/>.
18
18
 
19
19
  module RailsMarkdownTemplates
20
- VERSION = "1.0.1"
20
+ VERSION = "2.0.0"
21
21
  end
@@ -19,3 +19,9 @@
19
19
  require 'rails_markdown_templates/core'
20
20
  require 'rails_markdown_templates/renderer'
21
21
  require 'rails_markdown_templates/version'
22
+
23
+ module RailsMarkdownTemplates
24
+ mattr_accessor :metadata_tags_key, :metadata_json_key
25
+ @@metadata_tags_key = :metadata_tags
26
+ @@metadata_json_key = :metadata_json
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_markdown_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Dawson