wcc-contentful-app 1.0.6 → 1.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62dc51426a6d8ef9b10016d7e1c7f6278029cbf9ce5f57243247de110fc85388
|
4
|
+
data.tar.gz: e9b8ebec6038303cd1d963d0b3e8fd2bde4b5063db76c453144f8e4877766513
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3096d5d0f27919616f3a9ac40027b7e460c1292b8d22c6a64cba4c231373ba5b2b993b0ad11f8b89310a80cfb2340b788226e7926f1a98f866b1d2771c4decd9
|
7
|
+
data.tar.gz: 2404f239d0517c5c47623f329cc0774a16ef150ad75146884e2fc53c84f92d8500cfa1ef191cf6708d6182d29a276c82503a237b5bee80bdbdc36fe06a11eec5
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'redcarpet'
|
4
|
-
require '../wcc-contentful-app/lib/wcc/contentful/app/markdown_renderer'
|
5
4
|
|
6
5
|
module WCC::Contentful::App::SectionHelper
|
7
6
|
extend self
|
@@ -35,8 +34,11 @@ module WCC::Contentful::App::SectionHelper
|
|
35
34
|
CGI.escape(title.gsub(/\W+/, '-')) if title.present?
|
36
35
|
end
|
37
36
|
|
38
|
-
def markdown(text)
|
39
|
-
|
37
|
+
def markdown(text, options = {})
|
38
|
+
renderer = WCC::Contentful::App::MarkdownRenderer.new(
|
39
|
+
options
|
40
|
+
)
|
41
|
+
html_to_render = renderer.markdown(text)
|
40
42
|
|
41
43
|
content_tag(:div,
|
42
44
|
CGI.unescapeHTML(html_to_render).html_safe,
|
@@ -3,33 +3,44 @@
|
|
3
3
|
require_relative './custom_markdown_render'
|
4
4
|
|
5
5
|
class WCC::Contentful::App::MarkdownRenderer
|
6
|
-
|
7
|
-
raise ArgumentError, 'markdown method requires text' unless text
|
6
|
+
attr_reader :options, :extensions
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
def initialize(options = nil)
|
9
|
+
options = options&.dup
|
10
|
+
|
11
|
+
@extensions = {
|
12
|
+
autolink: true,
|
13
|
+
superscript: true,
|
14
|
+
disable_indented_code_blocks: true,
|
15
|
+
tables: true
|
16
|
+
}.merge!(options&.delete(:extensions) || {})
|
11
17
|
|
12
|
-
options = {
|
18
|
+
@options = {
|
13
19
|
filter_html: true,
|
14
20
|
hard_wrap: true,
|
15
21
|
link_attributes: { target: '_blank' },
|
16
22
|
space_after_headers: true,
|
17
|
-
fenced_code_blocks: true
|
18
|
-
|
19
|
-
|
23
|
+
fenced_code_blocks: true
|
24
|
+
}.merge!(options || {})
|
25
|
+
end
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
+
def markdown(text)
|
28
|
+
raise ArgumentError, 'markdown method requires text' unless text
|
29
|
+
|
30
|
+
markdown_links = links_within_markdown(text)
|
31
|
+
links_with_classes, raw_classes = gather_links_with_classes_data(markdown_links)
|
32
|
+
|
33
|
+
options = @options.merge({
|
34
|
+
links_with_classes: links_with_classes
|
35
|
+
})
|
27
36
|
|
28
37
|
renderer = ::WCC::Contentful::App::CustomMarkdownRender.new(options)
|
29
38
|
markdown = ::Redcarpet::Markdown.new(renderer, extensions)
|
30
39
|
markdown.render(remove_markdown_href_class_syntax(raw_classes, text))
|
31
40
|
end
|
32
41
|
|
42
|
+
alias_method :call, :markdown
|
43
|
+
|
33
44
|
private
|
34
45
|
|
35
46
|
def remove_markdown_href_class_syntax(raw_classes, text)
|
data/lib/wcc/contentful/app.rb
CHANGED
@@ -37,7 +37,7 @@ module WCC::Contentful::App
|
|
37
37
|
WCC::Contentful.init!
|
38
38
|
|
39
39
|
# Extend all model types w/ validation & extra fields
|
40
|
-
WCC::Contentful.
|
40
|
+
WCC::Contentful::Model.schema.each_value do |t|
|
41
41
|
file = File.dirname(__FILE__) + "/model/#{t.name.underscore}.rb"
|
42
42
|
require file if File.exist?(file)
|
43
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wcc-contentful-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watermark Dev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -352,14 +352,14 @@ dependencies:
|
|
352
352
|
requirements:
|
353
353
|
- - "~>"
|
354
354
|
- !ruby/object:Gem::Version
|
355
|
-
version: 1.
|
355
|
+
version: 1.1.1
|
356
356
|
type: :runtime
|
357
357
|
prerelease: false
|
358
358
|
version_requirements: !ruby/object:Gem::Requirement
|
359
359
|
requirements:
|
360
360
|
- - "~>"
|
361
361
|
- !ruby/object:Gem::Version
|
362
|
-
version: 1.
|
362
|
+
version: 1.1.1
|
363
363
|
description: Models, Controllers, and Views common to Watermark Church apps
|
364
364
|
email:
|
365
365
|
- dev@watermark.org
|
@@ -458,8 +458,8 @@ homepage: https://github.com/watermarkchurch/wcc-contentful
|
|
458
458
|
licenses:
|
459
459
|
- MIT
|
460
460
|
metadata:
|
461
|
-
documentation_uri: https://watermarkchurch.github.io/wcc-contentful/1.
|
462
|
-
post_install_message:
|
461
|
+
documentation_uri: https://watermarkchurch.github.io/wcc-contentful/1.1/wcc-contentful-app
|
462
|
+
post_install_message:
|
463
463
|
rdoc_options: []
|
464
464
|
require_paths:
|
465
465
|
- lib
|
@@ -474,9 +474,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
474
474
|
- !ruby/object:Gem::Version
|
475
475
|
version: '0'
|
476
476
|
requirements: []
|
477
|
-
rubyforge_project:
|
477
|
+
rubyforge_project:
|
478
478
|
rubygems_version: 2.7.6.2
|
479
|
-
signing_key:
|
479
|
+
signing_key:
|
480
480
|
specification_version: 4
|
481
481
|
summary: "[](https://rubygems.org/gems/wcc-contentful-app)
|
482
482
|
[](https://circleci.com/gh/watermarkchurch/wcc-contentful)
|