klaro-client 0.6.0 → 0.7.0

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
  SHA256:
3
- metadata.gz: 8fc780ef08865680682b8bf426534c5ce9cda2c3d51c9956e893dbfafd9b347b
4
- data.tar.gz: 977625979d0b46adc500e31e8f9dbbb921e31b43502ec677baa26b43575a410b
3
+ metadata.gz: 42126059ba59e044d7d25c44aa0a9d86769071ffcea570c564b7e9ddaa0b92c8
4
+ data.tar.gz: 0af95727702d75a8a7830b920efcd36b43def5642461b46aed86419b9ca71e16
5
5
  SHA512:
6
- metadata.gz: 634a419cfd3eaf85052026e5eb49242dbaf18d997c5ee22693ae903476429844a1c76a761cb38cc3ca04ac4bc90bcc0fb7e7cdb17cb1cc8f5ab20eed9783bc3a
7
- data.tar.gz: ef3344f32856d9ff22b471908eb3167422b6de70954cb6231bbc82f51023c58af0d30f570b61951825600aaba1a1b05c4335cc872ab2b9f7bfd34f721dfecea5
6
+ metadata.gz: a99dbe5bcfba816260d8e68a0174ab48f688b00fa28b98356060fb34ab32e96b97694c402477347b81cb01b56d10fa6f7df0efb2da3d470678fc49ca303ae4f5
7
+ data.tar.gz: b360ded9145f755cca8249181ffd65eb5c5ee103b061b70ee439ee9703e79262c2f1cf58ae734487ee7e88b47c08c88cf9f914094eb29454bf6721450e528aa2
@@ -3,37 +3,28 @@ module Klaro
3
3
  class MdText
4
4
 
5
5
  SHARED_OPTIONS = {
6
- filter_html: true,
7
- no_links: false,
8
- no_styles: true,
9
- safe_links_only: true,
10
- with_toc_data: false
11
- }
12
-
13
- VARIANTS = {
14
- :summary => Redcarpet::Markdown.new(
15
- Redcarpet::Render::HTML.new(SHARED_OPTIONS.merge({
16
- hard_wrap: true,
17
- }))
18
- ),
19
- :details => Redcarpet::Markdown.new(
20
- Redcarpet::Render::HTML.new(SHARED_OPTIONS.merge({
21
- hard_wrap: false,
22
- }))
23
- )
6
+ unsafe: false,
24
7
  }
25
8
 
26
9
  def initialize(src, variant)
27
10
  @src = src
28
- @renderer = VARIANTS[variant]
11
+ @variant = variant
29
12
  end
30
13
 
31
14
  def to_s
32
15
  @src
33
16
  end
34
17
 
18
+ def render_options
19
+ SHARED_OPTIONS.merge({
20
+ hardbreaks: (@variant == :summary)
21
+ })
22
+ end
23
+
35
24
  def to_html
36
- @renderer.render(to_s).strip.gsub(/<a href/, '<a target="_blank" href')
25
+ Commonmarker.to_html(to_s, options: {
26
+ render: render_options
27
+ }).strip.gsub(/<a href/, '<a target="_blank" href')
37
28
  end
38
29
 
39
30
  end # class MdText
@@ -2,7 +2,7 @@ module Klaro
2
2
  class Client
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 6
5
+ MINOR = 7
6
6
  TINY = 0
7
7
  end
8
8
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
data/lib/klaro/client.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'http'
2
2
  require 'path'
3
- require 'redcarpet'
3
+ require 'commonmarker'
4
4
  require 'i18n'
5
5
 
6
6
  module Klaro
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klaro-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - enspirit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-23 00:00:00.000000000 Z
11
+ date: 2023-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -45,25 +45,25 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '6.0'
47
47
  - !ruby/object:Gem::Dependency
48
- name: redcarpet
48
+ name: commonmarker
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '3.6'
53
+ version: '0.26'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '4.0'
56
+ version: '1.0'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: '3.6'
63
+ version: '0.26'
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '4.0'
66
+ version: '1.0'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: i18n
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.1.6
163
+ rubygems_version: 3.3.26
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Klaro Client