rails_markdown_templates 1.0.1 → 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/README.md +2 -2
- data/lib/rails_markdown_templates/core.rb +5 -7
- data/lib/rails_markdown_templates/version.rb +1 -1
- data/lib/rails_markdown_templates.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e38a0438d0764ee145d1f7509e5a5c8337df4fc3
|
4
|
+
data.tar.gz: b80e2d38af6f6b8514f51bdf2fcbf611bdaf61d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
40
|
-
|
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
|
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(
|
48
|
-
|
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
|
@@ -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
|