metanorma-plugin-glossarist 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -1
- data/.github/workflows/release.yml +7 -4
- data/.gitignore +1 -2
- data/.hound.yml +5 -0
- data/.rubocop.yml +10 -0
- data/lib/metanorma/plugin/glossarist/dataset_preprocessor.rb +15 -4
- data/lib/metanorma/plugin/glossarist/document.rb +9 -5
- data/lib/metanorma/plugin/glossarist/version.rb +1 -1
- data/lib/metanorma-plugin-glossarist.rb +4 -0
- data/metanorma-plugin-glossarist.gemspec +2 -2
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 161c43940a2841d4b92f05cb5b48cfab1f3eef3db02854b5dc88396e34aa9225
|
4
|
+
data.tar.gz: 377080e6303ad8e0afb736969e40f7fcbe8b48f354c96e6f82ffa2614a09c603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e2ade62ab37bcdc546ac357af61fb1245135733b85fac794c2503bb4f3d98fd09c6af2e12897f45d489ae5ff83e89468b419268fb3653d5fa1b4e8fd0eee459
|
7
|
+
data.tar.gz: 5626f96664c0e759a874f6efd5eb69a3ba4069958e470f3cacc2e2ecc980be99e7070f39b22c04a2a55476f535aee9b197a2ef3e503982fda7779491325a0781
|
data/.github/workflows/rake.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
1
3
|
name: rake
|
2
4
|
|
3
5
|
on:
|
@@ -8,6 +10,6 @@ on:
|
|
8
10
|
|
9
11
|
jobs:
|
10
12
|
rake:
|
11
|
-
uses: metanorma/
|
13
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
12
14
|
secrets:
|
13
15
|
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
1
3
|
name: release
|
2
4
|
|
3
5
|
on:
|
@@ -8,14 +10,15 @@ on:
|
|
8
10
|
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
9
11
|
required: true
|
10
12
|
default: 'skip'
|
11
|
-
|
12
|
-
|
13
|
+
repository_dispatch:
|
14
|
+
types: [ do-release ]
|
13
15
|
|
14
16
|
jobs:
|
15
17
|
release:
|
16
|
-
uses: metanorma/
|
18
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
17
19
|
with:
|
18
20
|
next_version: ${{ github.event.inputs.next_version }}
|
19
|
-
event_name: ${{ github.event_name }}
|
20
21
|
secrets:
|
21
22
|
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
23
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
24
|
+
|
data/.gitignore
CHANGED
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
inherit_from:
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
5
|
+
|
6
|
+
# local repo-specific modifications
|
7
|
+
# ...
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
TargetRubyVersion: 2.5
|
@@ -59,20 +59,23 @@ module Metanorma
|
|
59
59
|
# format
|
60
60
|
def initialize(config = {})
|
61
61
|
super
|
62
|
-
@
|
62
|
+
@config = config
|
63
63
|
@datasets = {}
|
64
64
|
@rendered_bibliographies = {}
|
65
65
|
end
|
66
66
|
|
67
67
|
def process(document, reader)
|
68
68
|
input_lines = reader.readlines.to_enum
|
69
|
+
|
69
70
|
file_system = ::Liquid::LocalFileSystem.new(
|
70
71
|
relative_file_path(document, ""),
|
71
72
|
)
|
72
73
|
|
74
|
+
@config[:file_system] = file_system
|
75
|
+
|
73
76
|
processed_doc = prepare_document(document, input_lines)
|
74
77
|
Asciidoctor::Reader.new(
|
75
|
-
processed_doc.
|
78
|
+
processed_doc.to_s.split("\n"),
|
76
79
|
)
|
77
80
|
end
|
78
81
|
|
@@ -80,6 +83,7 @@ module Metanorma
|
|
80
83
|
|
81
84
|
def prepare_document(document, input_lines, end_mark = nil)
|
82
85
|
liquid_doc = Document.new
|
86
|
+
liquid_doc.file_system = @config[:file_system]
|
83
87
|
|
84
88
|
loop do
|
85
89
|
current_line = input_lines.next
|
@@ -120,7 +124,10 @@ module Metanorma
|
|
120
124
|
{% endwith_glossarist_context %}
|
121
125
|
TEMPLATE
|
122
126
|
|
123
|
-
liquid_doc.add_content(
|
127
|
+
liquid_doc.add_content(
|
128
|
+
dataset_section,
|
129
|
+
render: true,
|
130
|
+
)
|
124
131
|
end
|
125
132
|
|
126
133
|
def process_glossarist_block(document, liquid_doc, input_lines, match)
|
@@ -135,7 +142,10 @@ module Metanorma
|
|
135
142
|
{% endwith_glossarist_context %}
|
136
143
|
TEMPLATE
|
137
144
|
|
138
|
-
liquid_doc.add_content(
|
145
|
+
liquid_doc.add_content(
|
146
|
+
glossarist_section,
|
147
|
+
render: true,
|
148
|
+
)
|
139
149
|
end
|
140
150
|
|
141
151
|
def prepare_glossarist_block_params(document, match)
|
@@ -193,6 +203,7 @@ module Metanorma
|
|
193
203
|
def concept_bibliography(concept)
|
194
204
|
bibliography = concept["eng"]["sources"].map do |source|
|
195
205
|
ref = source["origin"]["ref"]
|
206
|
+
|
196
207
|
next if @rendered_bibliographies[ref]
|
197
208
|
|
198
209
|
@rendered_bibliographies[ref] = ref.gsub(/[ \/:]/, '_')
|
@@ -4,23 +4,27 @@ module Metanorma
|
|
4
4
|
module Plugin
|
5
5
|
module Glossarist
|
6
6
|
class Document
|
7
|
-
attr_accessor :content, :bibliographies
|
7
|
+
attr_accessor :content, :bibliographies, :file_system
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@content = []
|
11
11
|
@bibliographies = []
|
12
12
|
end
|
13
13
|
|
14
|
-
def add_content(content)
|
15
|
-
@content <<
|
14
|
+
def add_content(content, options = {})
|
15
|
+
@content << if options[:render]
|
16
|
+
render_liquid(content)
|
17
|
+
else
|
18
|
+
content
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def to_s
|
19
23
|
@content.compact.join("\n")
|
20
24
|
end
|
21
25
|
|
22
|
-
def render_liquid(
|
23
|
-
template = Liquid::Template.parse(
|
26
|
+
def render_liquid(file_content)
|
27
|
+
template = Liquid::Template.parse(file_content)
|
24
28
|
template.registers[:file_system] = file_system
|
25
29
|
template.render(strict_variables: false, error_mode: :warn)
|
26
30
|
end
|
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
25
|
-
spec.add_dependency "glossarist
|
26
|
-
spec.add_dependency "liquid", "~>
|
25
|
+
spec.add_dependency "glossarist"
|
26
|
+
spec.add_dependency "liquid", "~> 5"
|
27
27
|
|
28
28
|
spec.add_development_dependency "pry"
|
29
29
|
spec.add_development_dependency "rake", "~> 12.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-plugin-glossarist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: glossarist
|
28
|
+
name: glossarist
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,7 +104,9 @@ files:
|
|
104
104
|
- ".github/workflows/rake.yml"
|
105
105
|
- ".github/workflows/release.yml"
|
106
106
|
- ".gitignore"
|
107
|
+
- ".hound.yml"
|
107
108
|
- ".rspec"
|
109
|
+
- ".rubocop.yml"
|
108
110
|
- CODE_OF_CONDUCT.md
|
109
111
|
- Gemfile
|
110
112
|
- LICENSE.txt
|