metanorma-plugin-datastruct 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/Gemfile +4 -0
- data/LICENSE +25 -0
- data/README.adoc +16 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/liquid/custom_blocks/key_iterator.rb +21 -0
- data/lib/liquid/custom_blocks/with_json_nested_context.rb +18 -0
- data/lib/liquid/custom_blocks/with_yaml_nested_context.rb +19 -0
- data/lib/liquid/custom_filters/values.rb +7 -0
- data/lib/metanorma-plugin-datastruct.rb +10 -0
- data/lib/metanorma/plugin/datastruct/base_structured_text_preprocessor.rb +173 -0
- data/lib/metanorma/plugin/datastruct/json2_text_preprocessor.rb +47 -0
- data/lib/metanorma/plugin/datastruct/version.rb +7 -0
- data/lib/metanorma/plugin/datastruct/yaml2_text_preprocessor.rb +50 -0
- data/metanorma-plugin-datastruct.gemspec +42 -0
- metadata +272 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a907be818d77b17d58d5fade3884d5927c8e26992c941dad4b70044b166a01b
|
4
|
+
data.tar.gz: fbc7ef753fb3091f7fa1a59edaa9efbf09fd1acef0b49df28a96363af88777da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 77debd7f1e3730b5ffb8f50acf26b611f617758efd457f3abca3919d68d9018cb42b27ce7ba4fbe5da8b3f79135e8f29408ef26b17c8874ee11bbbadd36d273d
|
7
|
+
data.tar.gz: be940013f91ee953d4477307be79de8adf9cb1db824845a38fa78f33cb1e7cbc599cba53daf7ba01eb096cfc368f94df3c5285edf262e90af829a56540b6a573
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
## Our Standards
|
8
|
+
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
10
|
+
|
11
|
+
* Using welcoming and inclusive language
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
13
|
+
* Gracefully accepting constructive criticism
|
14
|
+
* Focusing on what is best for the community
|
15
|
+
* Showing empathy towards other community members
|
16
|
+
|
17
|
+
Examples of unacceptable behavior by participants include:
|
18
|
+
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21
|
+
* Public or private harassment
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24
|
+
|
25
|
+
## Our Responsibilities
|
26
|
+
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28
|
+
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30
|
+
|
31
|
+
## Scope
|
32
|
+
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34
|
+
|
35
|
+
## Enforcement
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ronald.tse@ribose.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38
|
+
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40
|
+
|
41
|
+
## Attribution
|
42
|
+
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44
|
+
|
45
|
+
[homepage]: http://contributor-covenant.org
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
BSD 2-Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2020, Ribose
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
11
|
+
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
14
|
+
and/or other materials provided with the distribution.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.adoc
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
= Metanorma-plugin-datastruct
|
2
|
+
|
3
|
+
== Functionality
|
4
|
+
|
5
|
+
Metanorma plugin that allows you to access static data structures like JSON, YAML, XML from a Metanorma document
|
6
|
+
|
7
|
+
=== Installation
|
8
|
+
|
9
|
+
[source,console]
|
10
|
+
----
|
11
|
+
$ gem install metanorma-plugin-datastruct
|
12
|
+
----
|
13
|
+
|
14
|
+
== Documentation
|
15
|
+
|
16
|
+
See http://metanorma.com[]
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "metanorma/plugin/datastruct"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Liquid
|
2
|
+
module CustomBlocks
|
3
|
+
class KeyIterator < Block
|
4
|
+
def initialize(tag_name, markup, tokens)
|
5
|
+
super
|
6
|
+
@context_name, @var_name = markup.split(",").map(&:strip)
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
res = ""
|
11
|
+
iterator = context[@context_name].is_a?(Hash) ? context[@context_name].keys : context[@context_name]
|
12
|
+
iterator.each.with_index do |key, index|
|
13
|
+
context["index"] = index
|
14
|
+
context[@var_name] = key
|
15
|
+
res += super
|
16
|
+
end
|
17
|
+
res
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Liquid
|
2
|
+
module CustomBlocks
|
3
|
+
class WithJsonNestedContext < Block
|
4
|
+
def initialize(tag_name, markup, tokens)
|
5
|
+
super
|
6
|
+
@context_file_variable, @context_name = markup.split(",").map(&:strip)
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
context_file = context[@context_file_variable].to_s.strip
|
11
|
+
context[@context_name] = JSON.parse(
|
12
|
+
File.read(context_file, encoding: "utf-8")
|
13
|
+
)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Liquid
|
2
|
+
module CustomBlocks
|
3
|
+
class WithYamlNestedContext < Block
|
4
|
+
def initialize(tag_name, markup, tokens)
|
5
|
+
super
|
6
|
+
@context_file_variable, @context_name = markup.split(",").map(&:strip)
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
context_file = context[@context_file_variable].to_s.strip
|
11
|
+
context[@context_name] = YAML.safe_load(
|
12
|
+
File.read(context_file, encoding: "utf-8"),
|
13
|
+
[Date, Time]
|
14
|
+
)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "liquid"
|
4
|
+
require "asciidoctor"
|
5
|
+
require "asciidoctor/reader"
|
6
|
+
require "liquid/custom_blocks/key_iterator"
|
7
|
+
require "liquid/custom_blocks/with_yaml_nested_context"
|
8
|
+
require "liquid/custom_blocks/with_json_nested_context"
|
9
|
+
require "liquid/custom_filters/values"
|
10
|
+
|
11
|
+
Liquid::Template.register_tag("keyiterator", Liquid::CustomBlocks::KeyIterator)
|
12
|
+
Liquid::Template
|
13
|
+
.register_tag("with_yaml_nested_context",
|
14
|
+
Liquid::CustomBlocks::WithYamlNestedContext)
|
15
|
+
Liquid::Template
|
16
|
+
.register_tag("with_json_nested_context",
|
17
|
+
Liquid::CustomBlocks::WithJsonNestedContext)
|
18
|
+
Liquid::Template.register_filter(Liquid::CustomFilters)
|
19
|
+
|
20
|
+
module Metanorma
|
21
|
+
module Plugin
|
22
|
+
module Datastruct
|
23
|
+
# Base class for processing structured data blocks(yaml, json)
|
24
|
+
class BaseStructuredTextPreprocessor <
|
25
|
+
Asciidoctor::Extensions::Preprocessor
|
26
|
+
BLOCK_START_REGEXP = /\{(.+?)\.\*,(.+),(.+)\}/.freeze
|
27
|
+
BLOCK_END_REGEXP = /\A\{[A-Z]+\}\z/.freeze
|
28
|
+
|
29
|
+
def process(document, reader)
|
30
|
+
input_lines = reader.readlines.to_enum
|
31
|
+
Asciidoctor::Reader.new(processed_lines(document, input_lines))
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def content_from_file(_document, _file_path)
|
37
|
+
raise ArgumentError, "Implement `content_from_file` in your class"
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def processed_lines(document, input_lines)
|
43
|
+
result = []
|
44
|
+
loop do
|
45
|
+
result.push(*process_text_blocks(document, input_lines))
|
46
|
+
end
|
47
|
+
result
|
48
|
+
end
|
49
|
+
|
50
|
+
def relative_file_path(document, file_path)
|
51
|
+
docfile_directory = File.dirname(
|
52
|
+
document.attributes["docfile"] || "."
|
53
|
+
)
|
54
|
+
document
|
55
|
+
.path_resolver
|
56
|
+
.system_path(file_path, docfile_directory)
|
57
|
+
end
|
58
|
+
|
59
|
+
def process_text_blocks(document, input_lines)
|
60
|
+
line = input_lines.next
|
61
|
+
block_match = line.match(/^\[#{config[:block_name]},(.+?),(.+?)\]/)
|
62
|
+
return [line] if block_match.nil?
|
63
|
+
|
64
|
+
end_mark = input_lines.next
|
65
|
+
parse_template(document,
|
66
|
+
collect_internal_block_lines(document,
|
67
|
+
input_lines,
|
68
|
+
end_mark),
|
69
|
+
block_match)
|
70
|
+
end
|
71
|
+
|
72
|
+
def collect_internal_block_lines(document, input_lines, end_mark)
|
73
|
+
current_block = []
|
74
|
+
nested_marks = []
|
75
|
+
while (block_line = input_lines.next) != end_mark
|
76
|
+
if nested_match = block_line
|
77
|
+
.match(/^\[#{config[:block_name]},(.+?),(.+?)\]/)
|
78
|
+
current_block
|
79
|
+
.push(*nested_context_tag(document,
|
80
|
+
nested_match[1],
|
81
|
+
nested_match[2]).split("\n"))
|
82
|
+
next nested_marks.push(input_lines.next)
|
83
|
+
end
|
84
|
+
|
85
|
+
if nested_marks.include?(block_line)
|
86
|
+
current_block.push("{% endwith_#{data_file_type}_nested_context %}")
|
87
|
+
next nested_marks.delete(block_line)
|
88
|
+
end
|
89
|
+
current_block.push(block_line)
|
90
|
+
end
|
91
|
+
current_block
|
92
|
+
end
|
93
|
+
|
94
|
+
def data_file_type
|
95
|
+
@config[:block_name].split("2").first
|
96
|
+
end
|
97
|
+
|
98
|
+
def nested_context_tag(document, file_path, context_name)
|
99
|
+
absolute_file_path = relative_file_path(document, file_path)
|
100
|
+
<<~TEMPLATE
|
101
|
+
{% capture nested_file_path %}
|
102
|
+
#{absolute_file_path}
|
103
|
+
{% endcapture %}
|
104
|
+
{% with_#{data_file_type}_nested_context nested_file_path, #{context_name} %}
|
105
|
+
TEMPLATE
|
106
|
+
end
|
107
|
+
|
108
|
+
def parse_template(document, current_block, block_match)
|
109
|
+
transformed_liquid_lines = current_block
|
110
|
+
.map(&method(:transform_line_liquid))
|
111
|
+
context_items = content_from_file(document, block_match[1])
|
112
|
+
parse_context_block(document: document,
|
113
|
+
context_lines: transformed_liquid_lines,
|
114
|
+
context_items: context_items,
|
115
|
+
context_name: block_match[2])
|
116
|
+
rescue StandardError => e
|
117
|
+
document.logger
|
118
|
+
.warn("Failed to parse #{config[:block_name]} \
|
119
|
+
block: #{e.message}")
|
120
|
+
[]
|
121
|
+
end
|
122
|
+
|
123
|
+
def transform_line_liquid(line)
|
124
|
+
if line.match?(BLOCK_START_REGEXP)
|
125
|
+
line.gsub!(BLOCK_START_REGEXP, '{% keyiterator \1, \2 %}')
|
126
|
+
end
|
127
|
+
|
128
|
+
if line.strip.match?(BLOCK_END_REGEXP)
|
129
|
+
line.gsub!(BLOCK_END_REGEXP, "{% endkeyiterator %}")
|
130
|
+
end
|
131
|
+
line
|
132
|
+
.gsub(/(?<!{){(?!%)([^{}]+)(?<!%)}(?!})/, '{{\1}}')
|
133
|
+
.gsub(/[a-z\.]+\#/, "index")
|
134
|
+
.gsub(/{{(.+)\s+\+\s+(\d+)\s*?}}/, '{{ \1 | plus: \2 }}')
|
135
|
+
.gsub(/{{(.+)\s+\-\s+(\d+)\s*?}}/, '{{ \1 | minus: \2 }}')
|
136
|
+
.gsub(/{{(.+)\.values(.*?)}}/,
|
137
|
+
'{% assign custom_value = \1 | values %}{{custom_value\2}}')
|
138
|
+
end
|
139
|
+
|
140
|
+
def parse_context_block(context_lines:,
|
141
|
+
context_items:,
|
142
|
+
context_name:,
|
143
|
+
document:)
|
144
|
+
render_result, errors = render_liquid_string(
|
145
|
+
template_string: context_lines.join("\n"),
|
146
|
+
context_items: context_items,
|
147
|
+
context_name: context_name
|
148
|
+
)
|
149
|
+
notify_render_errors(document, errors)
|
150
|
+
render_result.split("\n")
|
151
|
+
end
|
152
|
+
|
153
|
+
def render_liquid_string(template_string:, context_items:,
|
154
|
+
context_name:)
|
155
|
+
liquid_template = Liquid::Template.parse(template_string)
|
156
|
+
rendered_string = liquid_template
|
157
|
+
.render(context_name => context_items,
|
158
|
+
strict_variables: true,
|
159
|
+
error_mode: :warn)
|
160
|
+
[rendered_string, liquid_template.errors]
|
161
|
+
end
|
162
|
+
|
163
|
+
def notify_render_errors(document, errors)
|
164
|
+
errors.each do |error_obj|
|
165
|
+
document
|
166
|
+
.logger
|
167
|
+
.warn("Liquid render error: #{error_obj.message}")
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "metanorma/plugin/datastruct/base_structured_text_preprocessor"
|
5
|
+
|
6
|
+
module Metanorma
|
7
|
+
module Plugin
|
8
|
+
module Datastruct
|
9
|
+
class Json2TextPreprocessor < BaseStructuredTextPreprocessor
|
10
|
+
# search document for block `yaml2text`
|
11
|
+
# after that take template from block and read file into this template
|
12
|
+
# example:
|
13
|
+
# [yaml2text,foobar.yaml]
|
14
|
+
# ----
|
15
|
+
# === {item.name}
|
16
|
+
# {item.desc}
|
17
|
+
#
|
18
|
+
# {item.symbol}:: {item.symbol_def}
|
19
|
+
# ----
|
20
|
+
#
|
21
|
+
# with content of `foobar.yaml` file equal to:
|
22
|
+
# - name: spaghetti
|
23
|
+
# desc: wheat noodles of 9mm diameter
|
24
|
+
# symbol: SPAG
|
25
|
+
# symbol_def: the situation is message like spaghetti at a kid's
|
26
|
+
#
|
27
|
+
# will produce:
|
28
|
+
# === spaghetti
|
29
|
+
# wheat noodles of 9mm diameter
|
30
|
+
#
|
31
|
+
# SPAG:: the situation is message like spaghetti at a kid's meal
|
32
|
+
|
33
|
+
def initialize(config = {})
|
34
|
+
super
|
35
|
+
@config[:block_name] = "json2text"
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def content_from_file(document, file_path)
|
41
|
+
JSON.parse(File.read(relative_file_path(document, file_path),
|
42
|
+
encoding: "UTF-8"))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require "metanorma/plugin/datastruct/base_structured_text_preprocessor"
|
5
|
+
|
6
|
+
module Metanorma
|
7
|
+
module Plugin
|
8
|
+
module Datastruct
|
9
|
+
class Yaml2TextPreprocessor < BaseStructuredTextPreprocessor
|
10
|
+
# search document for block `yaml2text`
|
11
|
+
# after that take template from block and read file into this template
|
12
|
+
# example:
|
13
|
+
# [yaml2text,foobar.yaml]
|
14
|
+
# ----
|
15
|
+
# === {item.name}
|
16
|
+
# {item.desc}
|
17
|
+
#
|
18
|
+
# {item.symbol}:: {item.symbol_def}
|
19
|
+
# ----
|
20
|
+
#
|
21
|
+
# with content of `foobar.yaml` file equal to:
|
22
|
+
# - name: spaghetti
|
23
|
+
# desc: wheat noodles of 9mm diameter
|
24
|
+
# symbol: SPAG
|
25
|
+
# symbol_def: the situation is message like spaghetti at a kid's
|
26
|
+
#
|
27
|
+
# will produce:
|
28
|
+
# === spaghetti
|
29
|
+
# wheat noodles of 9mm diameter
|
30
|
+
#
|
31
|
+
# SPAG:: the situation is message like spaghetti at a kid's meal
|
32
|
+
|
33
|
+
def initialize(config = {})
|
34
|
+
super
|
35
|
+
@config[:block_name] = "yaml2text"
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def content_from_file(document, file_path)
|
41
|
+
YAML.safe_load(
|
42
|
+
File.read(relative_file_path(document, file_path),
|
43
|
+
encoding: "UTF-8"),
|
44
|
+
[Date, Time]
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "metanorma/plugin/datastruct/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "metanorma-plugin-datastruct"
|
7
|
+
spec.version = Metanorma::Plugin::Datastruct::VERSION
|
8
|
+
spec.authors = ["Ribose Inc."]
|
9
|
+
spec.email = ["open.source@ribose.com"]
|
10
|
+
|
11
|
+
spec.summary = "Metanorma plugin for yaml2text and json2text"
|
12
|
+
spec.description = "Metanorma plugin for yaml2text and json2text"
|
13
|
+
|
14
|
+
spec.homepage = "https://github.com/metanorma/metanorma-plugin-datastruct"
|
15
|
+
spec.license = "BSD-2-Clause"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
27
|
+
spec.add_dependency "metanorma"
|
28
|
+
spec.add_dependency "relaton-cli"
|
29
|
+
spec.add_dependency "isodoc"
|
30
|
+
spec.add_dependency "liquid"
|
31
|
+
|
32
|
+
spec.add_development_dependency "byebug"
|
33
|
+
spec.add_development_dependency "equivalent-xml"
|
34
|
+
spec.add_development_dependency "metanorma-standoc"
|
35
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
37
|
+
spec.add_development_dependency "rubocop", "= 0.54.0"
|
38
|
+
spec.add_development_dependency "simplecov", "~> 0.15"
|
39
|
+
spec.add_development_dependency "timecop", "~> 0.9"
|
40
|
+
spec.add_development_dependency "vcr", "~> 5.0.0"
|
41
|
+
spec.add_development_dependency "webmock"
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,272 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: metanorma-plugin-datastruct
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ribose Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: asciidoctor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: metanorma
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: relaton-cli
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: isodoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: liquid
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: equivalent-xml
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: metanorma-standoc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '12.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '12.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rspec
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.6'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.6'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.54.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.54.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: simplecov
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.15'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.15'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: timecop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.9'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.9'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: vcr
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 5.0.0
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 5.0.0
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: webmock
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
description: Metanorma plugin for yaml2text and json2text
|
224
|
+
email:
|
225
|
+
- open.source@ribose.com
|
226
|
+
executables: []
|
227
|
+
extensions: []
|
228
|
+
extra_rdoc_files: []
|
229
|
+
files:
|
230
|
+
- ".gitignore"
|
231
|
+
- ".rspec"
|
232
|
+
- CODE_OF_CONDUCT.md
|
233
|
+
- Gemfile
|
234
|
+
- LICENSE
|
235
|
+
- README.adoc
|
236
|
+
- Rakefile
|
237
|
+
- bin/console
|
238
|
+
- bin/setup
|
239
|
+
- lib/liquid/custom_blocks/key_iterator.rb
|
240
|
+
- lib/liquid/custom_blocks/with_json_nested_context.rb
|
241
|
+
- lib/liquid/custom_blocks/with_yaml_nested_context.rb
|
242
|
+
- lib/liquid/custom_filters/values.rb
|
243
|
+
- lib/metanorma-plugin-datastruct.rb
|
244
|
+
- lib/metanorma/plugin/datastruct/base_structured_text_preprocessor.rb
|
245
|
+
- lib/metanorma/plugin/datastruct/json2_text_preprocessor.rb
|
246
|
+
- lib/metanorma/plugin/datastruct/version.rb
|
247
|
+
- lib/metanorma/plugin/datastruct/yaml2_text_preprocessor.rb
|
248
|
+
- metanorma-plugin-datastruct.gemspec
|
249
|
+
homepage: https://github.com/metanorma/metanorma-plugin-datastruct
|
250
|
+
licenses:
|
251
|
+
- BSD-2-Clause
|
252
|
+
metadata: {}
|
253
|
+
post_install_message:
|
254
|
+
rdoc_options: []
|
255
|
+
require_paths:
|
256
|
+
- lib
|
257
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
258
|
+
requirements:
|
259
|
+
- - ">="
|
260
|
+
- !ruby/object:Gem::Version
|
261
|
+
version: '0'
|
262
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
|
+
requirements:
|
264
|
+
- - ">="
|
265
|
+
- !ruby/object:Gem::Version
|
266
|
+
version: '0'
|
267
|
+
requirements: []
|
268
|
+
rubygems_version: 3.0.3
|
269
|
+
signing_key:
|
270
|
+
specification_version: 4
|
271
|
+
summary: Metanorma plugin for yaml2text and json2text
|
272
|
+
test_files: []
|