stepmod-utils 0.3.4 → 0.3.5
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 +1 -11
- data/.github/workflows/release.yml +4 -3
- data/.hound.yml +5 -0
- data/.rubocop.yml +10 -0
- data/lib/stepmod/utils/concept.rb +74 -19
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4b01b98d2e819f59adda9b7583eb65e0f3f17c67b57e297d4c63a28587a9c81
|
4
|
+
data.tar.gz: 274c0b90422ffb4f51134c49c4b1f8b9b8d4319b4369fd26baccf6191cf11183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74483e26bbfdbb7dd5827ebf8d1b7270b13cf35765107830a7d5ce29239d4fa865804e6384ba092f7209fdc7ab91387f8841791822deb6da45d97f37d1621e82
|
7
|
+
data.tar.gz: 9d130371dc91aa996896c79c3d3a7ff4be703d258030e9d2aee64212add70b79f8fdc9962c9d3d2d1d309d8e5c771817a22f44ff515f3702c014c859c9013dd0
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
steps:
|
33
23
|
- uses: actions/checkout@v2
|
34
24
|
with:
|
@@ -9,7 +9,7 @@ on:
|
|
9
9
|
description: |
|
10
10
|
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
11
11
|
required: true
|
12
|
-
default: '
|
12
|
+
default: 'skip'
|
13
13
|
push:
|
14
14
|
tags: [ v* ]
|
15
15
|
|
@@ -22,10 +22,11 @@ jobs:
|
|
22
22
|
- uses: ruby/setup-ruby@v1
|
23
23
|
with:
|
24
24
|
ruby-version: '2.6'
|
25
|
+
bundler-cache: true
|
25
26
|
|
26
27
|
- run: gem install gem-release
|
27
28
|
|
28
|
-
- if: ${{ github.event_name == 'workflow_dispatch' }}
|
29
|
+
- if: ${{ github.event_name == 'workflow_dispatch' }} && ${{ github.event.inputs.next_version != 'skip' }}
|
29
30
|
run: |
|
30
31
|
git config user.name github-actions
|
31
32
|
git config user.email github-actions@github.com
|
@@ -36,7 +37,7 @@ jobs:
|
|
36
37
|
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
37
38
|
run: |
|
38
39
|
gem install gem-release
|
39
|
-
|
40
|
+
envsubst << 'EOF' > ~/.gem/credentials
|
40
41
|
---
|
41
42
|
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
42
43
|
EOF
|
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.4
|
@@ -20,32 +20,87 @@ module Stepmod
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
class << self
|
24
|
+
def parse(definition_xml, reference_anchor:, reference_clause:, file_path:)
|
25
|
+
converted_definition = Stepmod::Utils::StepmodDefinitionConverter.convert(
|
26
|
+
definition_xml,
|
27
|
+
{
|
28
|
+
# We don't want examples and notes
|
29
|
+
no_notes_examples: true,
|
30
|
+
reference_anchor: reference_anchor
|
31
|
+
}
|
32
|
+
)
|
33
|
+
|
34
|
+
return nil if converted_definition.nil? || converted_definition.strip.empty?
|
35
|
+
|
36
|
+
if definition_xml.name == 'ext_description'
|
37
|
+
converted_definition = <<~TEXT
|
38
|
+
#{converted_definition}
|
39
|
+
|
40
|
+
NOTE: This term is incompletely defined in this document.
|
41
|
+
Reference <<#{reference_anchor}>> for the complete definition.
|
42
|
+
TEXT
|
43
|
+
end
|
44
|
+
# https://github.com/metanorma/stepmod-utils/issues/86
|
45
|
+
if definition_xml.name == 'definition'
|
46
|
+
designation = definition_designation(definition_xml)
|
47
|
+
definition = definition_xml_definition(definition_xml, reference_anchor)
|
48
|
+
converted_definition = definition_xml_converted_definition(designation, definition).strip
|
49
|
+
end
|
50
|
+
new(
|
51
|
+
designation: designation,
|
52
|
+
definition: definition,
|
53
|
+
converted_definition: converted_definition,
|
54
|
+
reference_anchor: reference_anchor,
|
55
|
+
reference_clause: reference_clause,
|
56
|
+
file_path: file_path
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def definition_designation(definition_xml)
|
61
|
+
alts = definition_xml.xpath('.//def/p').map(&:text)
|
26
62
|
{
|
27
|
-
|
28
|
-
|
29
|
-
reference_anchor: reference_anchor
|
63
|
+
accepted: definition_xml.xpath('.//term').first&.text,
|
64
|
+
alt: alts
|
30
65
|
}
|
31
|
-
|
66
|
+
end
|
32
67
|
|
33
|
-
|
68
|
+
def definition_xml_definition(definition_xml, reference_anchor)
|
69
|
+
text_nodes = definition_xml
|
70
|
+
.xpath('.//def')
|
71
|
+
.first
|
72
|
+
.children
|
73
|
+
.reject { |n| n.name == 'p' }
|
74
|
+
wrapper = "<def>#{text_nodes.map(&:to_s).join}</def>"
|
75
|
+
Stepmod::Utils::Converters::Def
|
76
|
+
.new
|
77
|
+
.convert(
|
78
|
+
Nokogiri::XML(wrapper).root,
|
79
|
+
{
|
80
|
+
# We don't want examples and notes
|
81
|
+
no_notes_examples: true,
|
82
|
+
reference_anchor: reference_anchor
|
83
|
+
})
|
84
|
+
end
|
34
85
|
|
35
|
-
|
36
|
-
|
37
|
-
#{
|
86
|
+
def definition_xml_converted_definition(designation, definition)
|
87
|
+
if designation[:alt].length.positive?
|
88
|
+
alt_notation = "alt:[#{designation[:alt].map(&:strip).join(',')}]"
|
89
|
+
end
|
90
|
+
result = <<~TEXT
|
91
|
+
=== #{designation[:accepted]}
|
92
|
+
TEXT
|
93
|
+
if alt_notation
|
94
|
+
result += <<~TEXT
|
38
95
|
|
39
|
-
|
40
|
-
|
96
|
+
#{alt_notation}
|
97
|
+
TEXT
|
98
|
+
end
|
99
|
+
<<~TEXT
|
100
|
+
#{result}
|
101
|
+
#{definition}
|
41
102
|
TEXT
|
42
103
|
end
|
43
|
-
new(
|
44
|
-
converted_definition: converted_definition,
|
45
|
-
reference_anchor: reference_anchor,
|
46
|
-
reference_clause: reference_clause,
|
47
|
-
file_path: file_path
|
48
|
-
)
|
49
104
|
end
|
50
105
|
|
51
106
|
def to_mn_adoc
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -98,7 +98,9 @@ files:
|
|
98
98
|
- ".github/workflows/rake.yml"
|
99
99
|
- ".github/workflows/release.yml"
|
100
100
|
- ".gitignore"
|
101
|
+
- ".hound.yml"
|
101
102
|
- ".rspec"
|
103
|
+
- ".rubocop.yml"
|
102
104
|
- CODE_OF_CONDUCT.md
|
103
105
|
- Gemfile
|
104
106
|
- Makefile
|
@@ -178,7 +180,7 @@ homepage: https://github.com/metanorma/stepmod-utils
|
|
178
180
|
licenses:
|
179
181
|
- BSD-2-Clause
|
180
182
|
metadata: {}
|
181
|
-
post_install_message:
|
183
|
+
post_install_message:
|
182
184
|
rdoc_options: []
|
183
185
|
require_paths:
|
184
186
|
- lib
|
@@ -193,8 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
195
|
- !ruby/object:Gem::Version
|
194
196
|
version: '0'
|
195
197
|
requirements: []
|
196
|
-
rubygems_version: 3.
|
197
|
-
signing_key:
|
198
|
+
rubygems_version: 3.1.6
|
199
|
+
signing_key:
|
198
200
|
specification_version: 4
|
199
201
|
summary: Stepmod-utils is a toolkit that works on STEPmod data.
|
200
202
|
test_files: []
|