rich_text_renderer 0.3.0 → 0.3.2

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: bd86d93e5fcd820edab90eb92a7181023bd6d48c8a4bc24ebc3598d945811d01
4
- data.tar.gz: 9a8a677927b8245abc3ab5dcc6849d7abc5cff4addf9205f6fd197366b21748b
3
+ metadata.gz: bc2ac61e3788fba35d898cdf202007d686540f0f429cf31b1e07ce942558242d
4
+ data.tar.gz: b61855b96415081aaf0090712414a3575db2052a42394eafdf75abf7067835a8
5
5
  SHA512:
6
- metadata.gz: b98ab775b9072176a43bcba2e5572b673138802ffde43b2b09271975db5fd81cd25010be151d74023235b10bff6e188de38a641a52c25753ac81eb08a06a96f4
7
- data.tar.gz: bc9e99081d5295c33945b6c93d97d9959071361f2c515da3fa07507f0beb2d22725c7c831315d0beb51a8863d3ad287bb5611d1cfd21567c4fe1f636c1dd4703
6
+ metadata.gz: 2f79323f87dd97432beb14a6ffa33513ec3ffd1782be5cb7ec1305b742bbfb87b3227e28e0d784434eaad3991d72b7d5a4938e6dfdf50f1e138e446169659f18
7
+ data.tar.gz: f2d4ba77cc7aa890ac6fc1352bd9516dba9cd7155f4bcd0bd2048455e7f4c80021aec5b6e752a5e99b87a08762a9329dfdb164334bbc8cc9676e65744f1c2911
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.3.2
4
+ * Added support for superscript and subscript
5
+
6
+ ## v0.3.1
7
+ * Changed CI/CD vendor to CircleCI
8
+ * Fixed handling `nil` nodes
9
+ * Fix linting offences
10
+
3
11
  ## v0.3.0
4
12
  * Added support for Rich Text Tables
5
13
 
@@ -10,7 +10,7 @@ module RichTextRenderer
10
10
  protected
11
11
 
12
12
  def find_renderer(node)
13
- renderer = mappings[node['nodeType']]
13
+ renderer = mappings[node.to_h['nodeType']]
14
14
  return mappings[nil].new(mappings) if renderer.nil? && mappings.key?(nil)
15
15
  renderer.new(mappings) unless renderer.nil?
16
16
  end
@@ -11,6 +11,7 @@ module RichTextRenderer
11
11
  private
12
12
 
13
13
  def node_type(node)
14
+ return 'nil' if node.nil?
14
15
  return node['nodeType'] if node.key?('nodeType')
15
16
  return node['type'] if node.key?('type')
16
17
  node
@@ -33,6 +33,8 @@ module RichTextRenderer
33
33
  'code' => CodeRenderer,
34
34
  'italic' => ItalicRenderer,
35
35
  'underline' => UnderlineRenderer,
36
+ 'superscript' => SuperscriptRenderer,
37
+ 'subscript' => SubscriptRenderer,
36
38
  'table' => TableRenderer,
37
39
  'table-row' => TableRowRenderer,
38
40
  'table-cell' => TableCellRenderer,
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base_inline_renderer'
4
+
5
+ module RichTextRenderer
6
+ # subscript node renderer.
7
+ class SubscriptRenderer < BaseInlineRenderer
8
+ protected
9
+
10
+ def render_tag
11
+ 'sub'
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './base_inline_renderer'
4
+
5
+ module RichTextRenderer
6
+ # superscript node renderer.
7
+ class SuperscriptRenderer < BaseInlineRenderer
8
+ protected
9
+
10
+ def render_tag
11
+ 'sup'
12
+ end
13
+ end
14
+ end
@@ -3,3 +3,5 @@ require_relative './text_renderers/bold_renderer'
3
3
  require_relative './text_renderers/code_renderer'
4
4
  require_relative './text_renderers/italic_renderer'
5
5
  require_relative './text_renderers/underline_renderer'
6
+ require_relative './text_renderers/superscript_renderer'
7
+ require_relative './text_renderers/subscript_renderer'
@@ -1,4 +1,4 @@
1
1
  module RichTextRenderer
2
2
  # Gem Version
3
- VERSION = '0.3.0'.freeze
3
+ VERSION = '0.3.2'.freeze
4
4
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich_text_renderer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentful GmbH (David Litvak Bruno)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -206,6 +206,8 @@ files:
206
206
  - lib/rich_text_renderer/text_renderers/bold_renderer.rb
207
207
  - lib/rich_text_renderer/text_renderers/code_renderer.rb
208
208
  - lib/rich_text_renderer/text_renderers/italic_renderer.rb
209
+ - lib/rich_text_renderer/text_renderers/subscript_renderer.rb
210
+ - lib/rich_text_renderer/text_renderers/superscript_renderer.rb
209
211
  - lib/rich_text_renderer/text_renderers/text_renderer.rb
210
212
  - lib/rich_text_renderer/text_renderers/underline_renderer.rb
211
213
  - lib/rich_text_renderer/version.rb