nexmo_markdown_renderer 0.5.1 → 0.6.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41ef7bc208bcb98d22e13d771819af665bedfd65c2c5b8b1516b50bdcd0f0ed7
|
4
|
+
data.tar.gz: 5e6507ad1e17a66325a07b45397654798dbe0ae556a1633989ec4615a6f0569a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca682dbe30887f444fe7d858ab5090e3f1f3b07da8fdfd2b015adfff08a03dace1dd4f72d1d72266b8a787f4529e235839511237a5f0fd96966eaa7c51f5a453
|
7
|
+
data.tar.gz: 0df50b173c98b7b3e70c8f46790e224a3eabef5220edf0cd5c11909923c2ce1bfa018e065a4b971d49af84174dc26940d2cbc9e2e51cae20ecc6da410b7ff75b
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Nexmo
|
2
|
+
module Markdown
|
3
|
+
class SnippetVariablesFilter < Banzai::Filter
|
4
|
+
def call(input)
|
5
|
+
input.gsub(/```snippet_variables(.+?)```/m) do |_s|
|
6
|
+
config = YAML.safe_load(Regexp.last_match(1))
|
7
|
+
|
8
|
+
raise 'No variables provided' unless config
|
9
|
+
raise 'Must provide an array' unless config.is_a?(Array)
|
10
|
+
|
11
|
+
output = <<~HEREDOC
|
12
|
+
Key | Description
|
13
|
+
-- | --
|
14
|
+
HEREDOC
|
15
|
+
config.each do |key|
|
16
|
+
details = variables[key]
|
17
|
+
raise "#{key} is not a valid snippet variable" unless details
|
18
|
+
raise "#{key} does not have a description" unless details['description']
|
19
|
+
|
20
|
+
output += <<~HEREDOC
|
21
|
+
`#{key}` | #{details['description']}
|
22
|
+
HEREDOC
|
23
|
+
end
|
24
|
+
|
25
|
+
output
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def variables
|
30
|
+
@variables ||= YAML.safe_load(File.read("#{Nexmo::Markdown::Config.docs_base_path}/config/code_snippet_variables.yml"))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
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.
|
4
|
+
version: 0.6.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-
|
11
|
+
date: 2020-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: banzai
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- lib/nexmo_markdown_renderer/filters/php_inliner_filter.rb
|
277
277
|
- lib/nexmo_markdown_renderer/filters/relative_link_filter.rb
|
278
278
|
- lib/nexmo_markdown_renderer/filters/screenshot_filter.rb
|
279
|
+
- lib/nexmo_markdown_renderer/filters/snippet_variables_filter.rb
|
279
280
|
- lib/nexmo_markdown_renderer/filters/tab_filter.rb
|
280
281
|
- lib/nexmo_markdown_renderer/filters/techio_filter.rb
|
281
282
|
- lib/nexmo_markdown_renderer/filters/tooltip_filter.rb
|