nexmo_markdown_renderer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nexmo_markdown_renderer.rb +1 -0
- data/lib/nexmo_markdown_renderer/config/load_config.rb +9 -0
- data/lib/nexmo_markdown_renderer/filters/code_filter.rb +4 -4
- data/lib/nexmo_markdown_renderer/filters/code_snippet_filter.rb +1 -1
- data/lib/nexmo_markdown_renderer/filters/code_snippets_filter.rb +1 -1
- data/lib/nexmo_markdown_renderer/filters/modal_filter.rb +1 -1
- data/lib/nexmo_markdown_renderer/filters/partial_filter.rb +1 -1
- data/lib/nexmo_markdown_renderer/filters/tab_filter.rb +6 -6
- data/lib/nexmo_markdown_renderer/initializers/doc_finder.rb +3 -3
- data/lib/nexmo_markdown_renderer/models/code_snippet.rb +1 -1
- data/lib/nexmo_markdown_renderer/models/concept.rb +2 -2
- data/lib/nexmo_markdown_renderer/models/tutorial.rb +1 -1
- data/lib/nexmo_markdown_renderer/models/use_case.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a7ee181316166581904d3090d0921bdd910fd04f3b82c3f0c79466c18c9161b
|
4
|
+
data.tar.gz: 47df143beda5e33479d632ad8de13e6b9af55103fe581d1d368ec75101c6bacf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d394cb2a18d09357457307975ce286ec1d933cb38012ff735c342f211d1b381dda8707b5e012a5eee45c28caf57085bf52ab8d485005fff631a2dfc9044bc87
|
7
|
+
data.tar.gz: ecdeb294a4f147299e62863dc0120acc626e07d93eaa2433a2df67db42ba4dca81a4d09c782a353ee992aef26aa6be43409d5cfc7f37dca7f82e55166fca27c3
|
@@ -6,6 +6,7 @@ require 'nokogiri'
|
|
6
6
|
require 'open-uri'
|
7
7
|
require 'active_model'
|
8
8
|
require 'i18n'
|
9
|
+
require_relative 'nexmo_markdown_renderer/config/load_config'
|
9
10
|
require_relative 'nexmo_markdown_renderer/initializers/redcarpet'
|
10
11
|
require_relative 'nexmo_markdown_renderer/initializers/i18n'
|
11
12
|
require_relative 'nexmo_markdown_renderer/core_ext/string'
|
@@ -6,12 +6,12 @@ module Nexmo
|
|
6
6
|
config = YAML.safe_load($1)
|
7
7
|
|
8
8
|
if config['config']
|
9
|
-
configs = YAML.load_file("#{
|
9
|
+
configs = YAML.load_file("#{Nexmo::Markdown::Config.docs_base_path}/config/code_examples.yml")
|
10
10
|
config = config['config'].split('.').inject(configs) { |h, k| h[k] }
|
11
11
|
end
|
12
12
|
|
13
|
-
code = File.read("#{
|
14
|
-
language = File.extname("#{
|
13
|
+
code = File.read("#{Nexmo::Markdown::Config.docs_base_path}/#{config['source']}")
|
14
|
+
language = File.extname("#{Nexmo::Markdown::Config.docs_base_path}/#{config['source']}")[1..-1]
|
15
15
|
lexer = language_to_lexer(language)
|
16
16
|
|
17
17
|
total_lines = code.lines.count
|
@@ -59,4 +59,4 @@ module Nexmo
|
|
59
59
|
end
|
60
60
|
|
61
61
|
end
|
62
|
-
end
|
62
|
+
end
|
@@ -66,7 +66,7 @@ module Nexmo
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def generate_code_block(language, input, unindent)
|
69
|
-
filename = "#{
|
69
|
+
filename = "#{Nexmo::Markdown::Config.docs_base_path}/#{input['source']}"
|
70
70
|
return '' unless input
|
71
71
|
raise "CodeSnippetFilter - Could not load #{filename} for language #{language}" unless File.exist?(filename)
|
72
72
|
|
@@ -89,7 +89,7 @@ module Nexmo
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def content_from_source
|
92
|
-
source_path = "#{
|
92
|
+
source_path = "#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}/*.yml"
|
93
93
|
|
94
94
|
files = Dir[source_path]
|
95
95
|
raise "No .yml files found for #{@config['source']} code snippets" if files.empty?
|
@@ -11,7 +11,7 @@ module Nexmo
|
|
11
11
|
end
|
12
12
|
|
13
13
|
modals = modals.map do |modal|
|
14
|
-
filename = "#{
|
14
|
+
filename = "#{Nexmo::Markdown::Config.docs_base_path}/#{modal[:document]}"
|
15
15
|
raise "Could not find modal #{filename}" unless File.exist? filename
|
16
16
|
|
17
17
|
document = File.read(filename)
|
@@ -8,9 +8,9 @@ module Nexmo
|
|
8
8
|
@config = YAML.safe_load($3)
|
9
9
|
|
10
10
|
if tabbed_folder?
|
11
|
-
raise "#{@config['source']} is not a directory" unless File.directory? "#{
|
11
|
+
raise "#{@config['source']} is not a directory" unless File.directory? "#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}"
|
12
12
|
|
13
|
-
@tabbed_config = YAML.safe_load(File.read("#{
|
13
|
+
@tabbed_config = YAML.safe_load(File.read("#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}/.config.yml"))
|
14
14
|
@path = @config['source']
|
15
15
|
validate_folder_config
|
16
16
|
else
|
@@ -146,7 +146,7 @@ module Nexmo
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def content_from_source
|
149
|
-
source_path = "#{
|
149
|
+
source_path = "#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}"
|
150
150
|
source_path += '/*' if tabbed_code_examples?
|
151
151
|
source_path += '/*.md' if tabbed_content?
|
152
152
|
|
@@ -165,7 +165,7 @@ module Nexmo
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def content_from_folder
|
168
|
-
source_path = "#{
|
168
|
+
source_path = "#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}"
|
169
169
|
source_path += '/*.md'
|
170
170
|
|
171
171
|
files = Dir.glob(source_path)
|
@@ -182,9 +182,9 @@ module Nexmo
|
|
182
182
|
|
183
183
|
def content_from_tabs
|
184
184
|
@config['tabs'].map do |title, config|
|
185
|
-
raise "Could not find content_from_tabs file: #{
|
185
|
+
raise "Could not find content_from_tabs file: #{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}" unless File.exist? "#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}"
|
186
186
|
|
187
|
-
source = File.read("#{
|
187
|
+
source = File.read("#{Nexmo::Markdown::Config.docs_base_path}/#{@config['source']}")
|
188
188
|
|
189
189
|
config.symbolize_keys.merge({
|
190
190
|
id: SecureRandom.hex,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Nexmo::Markdown::DocFinder.configure do |config|
|
2
|
-
config.paths << "#{
|
3
|
-
config.paths << "#{
|
4
|
-
config.paths << "#{
|
2
|
+
config.paths << "#{Nexmo::Markdown::Config.docs_base_path}/_documentation"
|
3
|
+
config.paths << "#{Nexmo::Markdown::Config.docs_base_path}/_use_cases"
|
4
|
+
config.paths << "#{Nexmo::Markdown::Config.docs_base_path}/_tutorials"
|
5
5
|
end
|
@@ -2,8 +2,8 @@ module Nexmo
|
|
2
2
|
module Markdown
|
3
3
|
class Concept
|
4
4
|
include ActiveModel::Model
|
5
|
-
|
6
|
-
ORIGIN = "#{
|
5
|
+
|
6
|
+
ORIGIN = "#{Nexmo::Markdown::Config.docs_base_path}/_documentation".freeze
|
7
7
|
|
8
8
|
FILES = [
|
9
9
|
Dir.glob("#{ORIGIN}/#{::I18n.default_locale}/**/guides/**/*.md"),
|
data/lib/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.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-03-
|
11
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: banzai
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- config/dynamic_content.yml
|
234
234
|
- config/locales/en.yml
|
235
235
|
- lib/nexmo_markdown_renderer.rb
|
236
|
+
- lib/nexmo_markdown_renderer/config/load_config.rb
|
236
237
|
- lib/nexmo_markdown_renderer/core_ext/string.rb
|
237
238
|
- lib/nexmo_markdown_renderer/filters/anchor_filter.rb
|
238
239
|
- lib/nexmo_markdown_renderer/filters/audio_filter.rb
|
@@ -328,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
329
|
- !ruby/object:Gem::Version
|
329
330
|
version: '0'
|
330
331
|
requirements: []
|
331
|
-
rubygems_version: 3.0.
|
332
|
+
rubygems_version: 3.0.0
|
332
333
|
signing_key:
|
333
334
|
specification_version: 4
|
334
335
|
summary: Middleware to render Markdown Documents in Nexmo Developer Platform.
|