nexmo_markdown_renderer 0.4.6 → 0.5.0

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: d59b64ddc58b808888fdb2a690af4dfd4b4411dcc52c529d00b27225889977f4
4
- data.tar.gz: 5a3108508a6607920f11c60244d126d04a2a060fbc4af246c4e84c50d7a794b1
3
+ metadata.gz: 4c9303cbd50b27ad02c68444daff15f65f3c3150f052bbfae839ee83e208f2f3
4
+ data.tar.gz: 6598a455b0b1a5bc07e5f05b0425db82bcfd1d980f9a43e7b6455ec73e5c8258
5
5
  SHA512:
6
- metadata.gz: f488c9d8f251a3fad98d2abda3f5b68cdb90b0121781a13dd3c663507c95d6f117d9fe1a0380d3acc261917479064ff99fee30ef43175eb3664db88c57898d11
7
- data.tar.gz: aed5eba3c7d1424c58e54fe70c2ff7d5d44a8d4b1d2208b2fef0f0fc73393116facf72ee0ec5c289fc07923fe1a9f7e531f2271687cb82b9ef76644117fb4f56
6
+ metadata.gz: 5c2bb7bf7351edeee752c0ee34f93c7ac2610df41ad78aa0642b7070b3f5a3675254343c52285de3f879c195a5ff78c186f2e7bcee60a712661b4b704a2d25dc
7
+ data.tar.gz: d82606e5cb6920496674fd3aba4888e5b874b5dcbdad38f35f6c24ccbe1ef24c8069acb84afb338477df6068404f9c4b283ad9fdb694652cb6d689329110cf56
@@ -51,4 +51,6 @@ require_relative 'nexmo_markdown_renderer/filters/code_snippet/run'
51
51
  Dir[File.join(__dir__, 'nexmo_markdown_renderer/filters/concerns', '*.rb')].each { |file| require_relative file }
52
52
  Dir[File.join(__dir__, 'nexmo_markdown_renderer/filters', '*.rb')].each { |file| require_relative file }
53
53
  Dir[File.join(__dir__, 'nexmo_markdown_renderer/filters/i18n', '*.rb')].each { |file| require_relative file }
54
+ Dir[File.join(__dir__, 'nexmo_markdown_renderer/filters/i18n/smartling', '*.rb')].each { |file| require_relative file }
55
+ Dir[File.join(__dir__, 'nexmo_markdown_renderer/pipelines/smartling', '*.rb')].each { |file| require_relative file }
54
56
  require_relative 'nexmo_markdown_renderer/markdown_renderer'
@@ -11,6 +11,5 @@ module Nexmo
11
11
  end
12
12
  end
13
13
  end
14
-
15
14
  end
16
- end
15
+ end
@@ -0,0 +1,20 @@
1
+ module Nexmo
2
+ module Markdown
3
+ module I18n
4
+ module Smartling
5
+ class CodeBlockFilter < Banzai::Filter
6
+ def call(input)
7
+ input.gsub(/\n\n\s{4}(.*?)\n\n/m) do
8
+ <<~CODE_BLOCK
9
+
10
+ ````
11
+ #{$1.split(/\n\s{4}/).join("\n")}
12
+ ````
13
+ CODE_BLOCK
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ module Nexmo
2
+ module Markdown
3
+ module I18n
4
+ module Smartling
5
+ class EscapeFilter < Banzai::Filter
6
+ def call(input)
7
+ input.gsub('\-', '-').gsub('\|', '|').gsub('\[', '[').gsub('\]', ']').gsub('\(', '(').gsub('\)', ')').gsub(/^>\s\n+/, "\n")
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ module Nexmo
2
+ module Markdown
3
+ module I18n
4
+ module Smartling
5
+ class FrontmatterFilter < Banzai::Filter
6
+ def call(input)
7
+ input.gsub(/\A\*\*\* \*\* \* \*\* \*\*\*\n*([^-]*)\n*-+/m) do |_frontmatter|
8
+ front = $1.gsub(/`(.*):`(.*)/) do |_config|
9
+ "#{$1}: #{$2}"
10
+ end
11
+ <<~FRONTMATTER
12
+ ---
13
+ #{front}
14
+ ---
15
+ FRONTMATTER
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -2,7 +2,7 @@ module Nexmo
2
2
  module Markdown
3
3
  class TooltipFilter < Banzai::Filter
4
4
  def call(input)
5
- input.gsub(/\^\[([a-zA-Z0-9\s:\-]+)\]\((.+?)\)/) do
5
+ input.gsub(/\^\[([\p{Han}a-zA-Z0-9\s:\-]+)\]\((.+?)\)/) do
6
6
  tooltip = <<~HEREDOC
7
7
  <span class="Vlt-tooltip Vlt-tooltip--top" title="#{$2}" tabindex="0">
8
8
  #{$1}&nbsp;
@@ -0,0 +1,17 @@
1
+ module Nexmo
2
+ module Markdown
3
+ module Pipelines
4
+ module Smartling
5
+ class Download < Banzai::Pipeline
6
+ def initialize(_options = {})
7
+ super(
8
+ I18n::Smartling::FrontmatterFilter,
9
+ I18n::Smartling::EscapeFilter,
10
+ I18n::Smartling::CodeBlockFilter
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module Nexmo
2
+ module Markdown
3
+ module Pipelines
4
+ module Smartling
5
+ class Preprocessor < Banzai::Pipeline
6
+ def initialize(_options = {})
7
+ super(
8
+ I18n::FrontmatterFilter
9
+ )
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
1
  # :nocov:
2
2
  module Nexmo
3
3
  module Markdown
4
- VERSION = '0.4.6'
4
+ VERSION = '0.5.0'
5
5
  end
6
6
  end
7
7
  # :nocov:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexmo_markdown_renderer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nexmo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-03 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: banzai
@@ -260,7 +260,9 @@ files:
260
260
  - lib/nexmo_markdown_renderer/filters/frontmatter_filter.rb
261
261
  - lib/nexmo_markdown_renderer/filters/heading_filter.rb
262
262
  - lib/nexmo_markdown_renderer/filters/i18n/frontmatter_filter.rb
263
- - lib/nexmo_markdown_renderer/filters/i18n/smartling_converter_filter.rb
263
+ - lib/nexmo_markdown_renderer/filters/i18n/smartling/code_block_filter.rb
264
+ - lib/nexmo_markdown_renderer/filters/i18n/smartling/escape_filter.rb
265
+ - lib/nexmo_markdown_renderer/filters/i18n/smartling/frontmatter_filter.rb
264
266
  - lib/nexmo_markdown_renderer/filters/icon_filter.rb
265
267
  - lib/nexmo_markdown_renderer/filters/indent_filter.rb
266
268
  - lib/nexmo_markdown_renderer/filters/inline_escape_filter.rb
@@ -293,6 +295,8 @@ files:
293
295
  - lib/nexmo_markdown_renderer/models/tutorial/prerequisite.rb
294
296
  - lib/nexmo_markdown_renderer/models/tutorial/task.rb
295
297
  - lib/nexmo_markdown_renderer/models/use_case.rb
298
+ - lib/nexmo_markdown_renderer/pipelines/smartling/download.rb
299
+ - lib/nexmo_markdown_renderer/pipelines/smartling/preprocessor.rb
296
300
  - lib/nexmo_markdown_renderer/services/code_snippet_renderer/android.rb
297
301
  - lib/nexmo_markdown_renderer/services/code_snippet_renderer/base.rb
298
302
  - lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb
@@ -345,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
349
  - !ruby/object:Gem::Version
346
350
  version: '0'
347
351
  requirements: []
348
- rubygems_version: 3.1.4
352
+ rubygems_version: 3.0.1
349
353
  signing_key:
350
354
  specification_version: 4
351
355
  summary: Middleware to render Markdown Documents in Nexmo Developer Platform.
@@ -1,22 +0,0 @@
1
- module Nexmo
2
- module Markdown
3
- module I18n
4
- class SmartlingConverterFilter < Banzai::Filter
5
- def call(input)
6
- input = input.gsub(/\A\*\*\* \*\* \* \*\* \*\*\*\n*(.*)\n*------------------------------------------/m) do |_frontmatter|
7
- front = $1.gsub(/`(.*):`(.*)/) do |_config|
8
- "#{$1}:#{$2}"
9
- end
10
- <<~FRONTMATTER
11
- ---
12
- #{front}
13
- ---
14
- FRONTMATTER
15
- end
16
- input.gsub('\-', '-').gsub('\|', '|')
17
- end
18
- end
19
- end
20
-
21
- end
22
- end