cmor_blog 0.0.55.pre → 0.0.56.pre

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
  SHA256:
3
- metadata.gz: 0201f2ca0c8aa20e93e86be7e459ae173c8be83bdd469f7b5c1506127504480f
4
- data.tar.gz: 623eb45db211e6725087c1bea8c0549f6cb9fb89d318183ff5bbb42348771acd
3
+ metadata.gz: 97db017bca13f8f80b7463bc01f3d93b5a2d06c354101109907666e28e8a3657
4
+ data.tar.gz: 7d457d1e3a6fb5f0d1bfda7fa1cb3495083ddfba13fb311c16ef2f470343a56b
5
5
  SHA512:
6
- metadata.gz: 9e2816649fa64701d925ee8e74e8b33e07fd1a38f873687a5472936a3248e39b7291207d15acb1f48ddc0bcfa2fe23806e62edd147883c14ac5f40928bb44022
7
- data.tar.gz: 86c7787d940c70b8a91d7d950d58077ae428857556bb8c33ef05abdbf9f04ff560b4f7c2f770a52209c6ab9b19706cff44ded7d912c350f51f70c71a1c9bd9bb
6
+ metadata.gz: 6e325a44912e3db6cac69a06d5c9dc79491969e41913ee852eec9aed932a7bec7a4c31a2e5936bccd59b0bae0c4500905a708ef116f74ec3290d96e97f0658d9
7
+ data.tar.gz: 38d2f9af6f7db71f4a362cabeb5f15f9da66102f78c4778239fc0257ff4921e63eff3653895e948b5d4bd54381d9f5bd1d66717a720e48a2aeec8f212ccf294f
@@ -34,7 +34,7 @@ module Cmor
34
34
  def body(format: nil)
35
35
  case format
36
36
  when :html
37
- to_markdown(read_attribute(:body))
37
+ markdown_to_html(read_attribute(:body))
38
38
  else
39
39
  read_attribute(:body)
40
40
  end
@@ -42,8 +42,8 @@ module Cmor
42
42
 
43
43
  private
44
44
 
45
- def to_markdown(string)
46
- Kramdown::Document.new(string).to_html
45
+ def markdown_to_html(string)
46
+ instance_exec(string, &Cmor::Blog::Configuration.markdown_to_html_proc)
47
47
  end
48
48
  end
49
49
 
@@ -35,6 +35,10 @@ module Cmor
35
35
  mattr_accessor(:post_creation_information_proc) do
36
36
  -> (post) { "#{l(post.created_at)} | #{post.creator&.human}" }
37
37
  end
38
+
39
+ mattr_accessor(:markdown_to_html_proc) do
40
+ -> (string) { Kramdown::Document.new(string).to_html }
41
+ end
38
42
  end
39
43
  end
40
44
  end
@@ -63,4 +63,19 @@ Cmor::Blog.configure do |config|
63
63
  # default: config.post_creation_information_proc = -> (post) { "#{l(post.created_at)} | #{post.creator&.to_s}" }
64
64
  #
65
65
  config.post_creation_information_proc = -> (post) { "#{l(post.created_at)} | #{post.creator&.to_s}" }
66
+
67
+ # Configure how the post body is transformed from markup to html. The default
68
+ # format is markdown. Kramdown is used for the transformation and is a
69
+ # dependency of this gem.
70
+ #
71
+ # If you want to use a different markdown language you can configure it here.
72
+ #
73
+ # For example you may want to use textile as markup. First you will need to
74
+ # add RedCloth to your Gemfile. Then you can configure it as follows:
75
+ #
76
+ # config.markdown_to_html_proc = -> (string) { RedCloth.new(string).to_html }
77
+ #
78
+ # default: config.markdown_to_html_proc = -> (string) { Kramdown::Document.new(string).to_html }
79
+ #
80
+ config.markdown_to_html_proc = -> (string) { Kramdown::Document.new(string).to_html }
66
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmor_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.55.pre
4
+ version: 0.0.56.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-28 00:00:00.000000000 Z
11
+ date: 2020-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.55.pre
33
+ version: 0.0.56.pre
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.55.pre
40
+ version: 0.0.56.pre
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cmor_core_frontend
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.55.pre
47
+ version: 0.0.56.pre
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.55.pre
54
+ version: 0.0.56.pre
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement