nexmo_markdown_renderer 0.4.0 → 0.4.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: 7e21f8aa58664f86273978415744faa05026ec551b1bd99a6e0f7b54f7872eff
4
- data.tar.gz: ec3ea04ec8714d98ec8aa17d318999142477d58dc7a8904b96396dc982825572
3
+ metadata.gz: 5f8453119db56f41713832d6a32fe559cd0076cef1f829e161465cb31bd81fb1
4
+ data.tar.gz: 5f82937effa52f7587533c3b039ed609c5095829cbec0c1bb8871306f00501c9
5
5
  SHA512:
6
- metadata.gz: 9788f8896e42b0e4f84084c231669a15a588c6335b3be8df01a60f3f73b3736a6d8ec832e650943c5de8506564893a78f3c368eca93c75c1a95d4fce1cb8d267
7
- data.tar.gz: 5dc5835781068ada21d52a4108381222bca7293bdff94a26668dee3110310ba61c6e97d9a1b280c04b31253cca575bdb8190aecc44851c6c623d95b1675cc9b0
6
+ metadata.gz: 8cc17d94d7ef7d83f315747521569ad545601e9165532d94cd8bb08306b7ed4be95b11995ce76038ef51785eea8ef7809c8446fa3b5da8486059dc87a458aaac
7
+ data.tar.gz: d22a8f38997cacf2dbdfb00ca34f3beae65ca75f1736ff5db335207da246d7a2513eb6fa89e181964f99589d3f076ffde06f730f95f3ef7694fc22af0d13a336
@@ -5,7 +5,7 @@ module Nexmo
5
5
  input.gsub(/```partial(.+?)```/m) do |_s|
6
6
  config = YAML.safe_load($1)
7
7
  file_path = if config['source'].starts_with? 'app/views'
8
- config['source']
8
+ "#{Rails.root}/#{config['source']}"
9
9
  else
10
10
  "#{Nexmo::Markdown::Config.docs_base_path}/#{config['source']}"
11
11
  end
@@ -4,7 +4,7 @@ module Nexmo
4
4
  def call(input)
5
5
  input.gsub(/```screenshot(.+?)```/m) do |_s|
6
6
  config = YAML.safe_load($1)
7
- if config['image'] && File.file?(config['image'])
7
+ if config['image'] && File.file?("#{Nexmo::Markdown::Config.docs_base_path}/#{config['image']}")
8
8
  "![Screenshot](#{config['image'].gsub('public', '')})"
9
9
  else
10
10
  <<~HEREDOC
@@ -10,9 +10,9 @@ module Nexmo
10
10
  @config = YAML.safe_load($3)
11
11
 
12
12
  if tabbed_folder?
13
- raise "#{@config['source']} is not a directory" unless File.directory? "#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}"
13
+ raise "#{@config['source']} is not a directory" unless File.directory? "#{@config['source']}"
14
14
 
15
- @tabbed_config = YAML.safe_load(File.read("#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}/.config.yml"))
15
+ @tabbed_config = YAML.safe_load(File.read("#{@config['source']}/.config.yml"))
16
16
  @path = @config['source']
17
17
  validate_folder_config
18
18
  else
@@ -169,7 +169,7 @@ module Nexmo
169
169
  end
170
170
 
171
171
  def content_from_folder
172
- source_path = "#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}"
172
+ source_path = "#{@config['source']}"
173
173
  source_path += '/*.md'
174
174
 
175
175
  files = Dir.glob(source_path)
@@ -19,7 +19,7 @@ module Nexmo
19
19
  line_section += "-L#{code['to_line']}" if code['to_line']
20
20
  else
21
21
  # By default we read to the end of the file
22
- line_section += "-L#{File.read(code['source']).lines.count}"
22
+ line_section += "-L#{File.read("#{Nexmo::Markdown::Config.docs_base_path}/#{code['source']}").lines.count}"
23
23
  end
24
24
  end
25
25
 
@@ -72,7 +72,7 @@ module Nexmo
72
72
  end
73
73
 
74
74
  private_class_method def self.config
75
- @config ||= YAML.load_file('./config/code_languages.yml')
75
+ @config ||= YAML.load_file("#{Nexmo::Markdown::Config.docs_base_path}/config/code_languages.yml")
76
76
  end
77
77
  end
78
78
  end
@@ -91,9 +91,9 @@ module Nexmo
91
91
 
92
92
  def self.load_english
93
93
  paths.each do |path|
94
- if path.starts_with?('app/views')
94
+ if defined?(Rails) && path.starts_with?("#{Rails.root}/app/views")
95
95
  Dir["#{path}/**/*.*"].each do |file|
96
- dictionary[file][::I18n.default_locale.to_s] = ::I18n.default_locale.to_s
96
+ dictionary[file.gsub("#{Rails.root}/", '')][::I18n.default_locale.to_s] = ::I18n.default_locale.to_s
97
97
  end
98
98
  else
99
99
  path_with_locale = "#{path}/#{::I18n.default_locale}"
@@ -1,7 +1,7 @@
1
1
  # :nocov:
2
2
  module Nexmo
3
3
  module Markdown
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
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.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nexmo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-12 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: banzai