nexmo_markdown_renderer 0.7.5 → 0.7.6

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: a7d22b5298177cc9423ba86447361a3d59f7f12428d62c2c623ee13f2760861b
4
- data.tar.gz: 0c0bb88101ee6af385d924c6be9233ad98a41e106dcca73c591dac1f209a8426
3
+ metadata.gz: a7800ee97436dd0317d85c054ba7293f1207c2e0ac9e90b1f1f443df61319d51
4
+ data.tar.gz: cf859ca6c2f8d165e4057242f460dc4e0bdabe4419a4e25f94e0c1611181ccf2
5
5
  SHA512:
6
- metadata.gz: d2ed733f1228b84a32bbef3a86ee4ad56f6506218ee7dc24faa77ec032f29fede9be1fef2db733bfc1491b03faff6f485dec206d07d36a44e650b14a54a079ea
7
- data.tar.gz: 4cd84845df9bdc696dee67041b0d0f3c05d43c118f99b17158dd1179320963d54c5d80a71cd87a92e4cd8997e77ea0f9e517686fe24319b8de4d1dd1a1985bb9
6
+ metadata.gz: 00fa691a0b76fabaa820fbc90bd68b87ab0a9a7bf4fa87a949f153fa4031845000375ec661f721154932db2f357bc4358ff1e6f8cc28d7808c52288db655ecee
7
+ data.tar.gz: fb66fcd2e4582e40ac53dfc1bd74af9ddaa13c22f71e9f0d62ab45bcc9986a51ad5c5801bc6e0dccfbe42f93e50682fc3bfd26d18eb0e2616f10f7ea90227419
@@ -21,7 +21,8 @@ module Nexmo
21
21
  @highlighted_import_source ||= ::Nexmo::Markdown::Utils.generate_code_block(
22
22
  language,
23
23
  @config,
24
- unindent
24
+ unindent,
25
+ renderer
25
26
  )
26
27
  end
27
28
 
@@ -19,7 +19,8 @@ module Nexmo
19
19
  @highlighted_client_source ||= ::Nexmo::Markdown::Utils.generate_code_block(
20
20
  language,
21
21
  @config,
22
- unindent
22
+ unindent,
23
+ renderer
23
24
  )
24
25
  end
25
26
 
@@ -27,7 +27,8 @@ module Nexmo
27
27
  @highlighted_code_source ||= ::Nexmo::Markdown::Utils.generate_code_block(
28
28
  language,
29
29
  @config['code'],
30
- unindent
30
+ unindent,
31
+ renderer
31
32
  )
32
33
  end
33
34
 
@@ -29,6 +29,7 @@ module Nexmo
29
29
  tab['class'] = 'Vlt-tabs__link'
30
30
  tab['class'] += ' Vlt-tabs__link_active' if content[:active]
31
31
  tab['role'] = 'tab'
32
+ tab['id'] = content[:tab_title].parameterize
32
33
 
33
34
  if content[:language]
34
35
  tab['data-language'] = content[:language].key
@@ -26,7 +26,7 @@ module Nexmo
26
26
  start_section + file_section + line_section
27
27
  end
28
28
 
29
- def self.generate_code_block(language, input, unindent)
29
+ def self.generate_code_block(language, input, unindent, renderer)
30
30
  return '' unless input
31
31
  filename = "#{Nexmo::Markdown::Config.docs_base_path}/#{input['source']}"
32
32
  raise "CodeSnippetFilter - Could not load #{filename} for language #{language}" unless File.exist?(filename)
@@ -42,6 +42,9 @@ module Nexmo
42
42
 
43
43
  code = code.lines[from_line..to_line].join
44
44
  code.unindent! if unindent
45
+
46
+ code = renderer.post_process(code) if renderer.respond_to?(:post_process)
47
+
45
48
  formatter = Rouge::Formatters::HTML.new
46
49
  formatter.format(lexer.lex(code))
47
50
  end
@@ -22,6 +22,14 @@ module Nexmo
22
22
  def self.add_instructions(filename)
23
23
  ::I18n.t('services.code_snippet_renderer.add_instructions_to_file', file: filename)
24
24
  end
25
+
26
+ def self.post_process(code)
27
+ self.strip_single_quotes(code)
28
+ end
29
+
30
+ def self.strip_single_quotes(code)
31
+ code.gsub(/"'(\$\w+)'"/, '"\1"')
32
+ end
25
33
  end
26
34
  end
27
35
 
@@ -1,7 +1,7 @@
1
1
  # :nocov:
2
2
  module Nexmo
3
3
  module Markdown
4
- VERSION = '0.7.5'
4
+ VERSION = '0.7.6'
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.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nexmo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-12 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: banzai