stepmod-utils 0.3.5 → 0.3.10
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 -1
- data/.github/workflows/release.yml +4 -3
- data/.rubocop.yml +1 -1
- data/Gemfile +3 -3
- data/Rakefile +1 -1
- data/exe/stepmod-annotate-all +17 -11
- data/exe/stepmod-build-resource-docs-cache +8 -7
- data/exe/stepmod-convert-express-description +6 -4
- data/exe/stepmod-convert-express-resource +6 -4
- data/exe/stepmod-extract-terms +99 -28
- data/exe/stepmod-find-express-files +8 -7
- data/lib/stepmod/utils/bibdata.rb +31 -35
- data/lib/stepmod/utils/cleaner.rb +3 -3
- data/lib/stepmod/utils/concept.rb +54 -36
- data/lib/stepmod/utils/converters/a.rb +6 -13
- data/lib/stepmod/utils/converters/blockquote.rb +4 -4
- data/lib/stepmod/utils/converters/br.rb +1 -1
- data/lib/stepmod/utils/converters/bypass.rb +33 -33
- data/lib/stepmod/utils/converters/clause_ref.rb +3 -3
- data/lib/stepmod/utils/converters/code.rb +1 -1
- data/lib/stepmod/utils/converters/comment.rb +5 -3
- data/lib/stepmod/utils/converters/dd.rb +2 -2
- data/lib/stepmod/utils/converters/def.rb +19 -19
- data/lib/stepmod/utils/converters/drop.rb +2 -2
- data/lib/stepmod/utils/converters/dt.rb +2 -2
- data/lib/stepmod/utils/converters/em.rb +1 -1
- data/lib/stepmod/utils/converters/em_express_description.rb +1 -1
- data/lib/stepmod/utils/converters/eqn.rb +28 -26
- data/lib/stepmod/utils/converters/example.rb +5 -6
- data/lib/stepmod/utils/converters/express_g.rb +10 -9
- data/lib/stepmod/utils/converters/express_ref.rb +2 -2
- data/lib/stepmod/utils/converters/express_ref_express_description.rb +3 -2
- data/lib/stepmod/utils/converters/ext_description.rb +1 -1
- data/lib/stepmod/utils/converters/figure.rb +3 -3
- data/lib/stepmod/utils/converters/fund_cons.rb +1 -1
- data/lib/stepmod/utils/converters/head.rb +3 -2
- data/lib/stepmod/utils/converters/hr.rb +2 -2
- data/lib/stepmod/utils/converters/ignore.rb +3 -3
- data/lib/stepmod/utils/converters/introduction.rb +1 -1
- data/lib/stepmod/utils/converters/module_ref.rb +7 -7
- data/lib/stepmod/utils/converters/note.rb +5 -6
- data/lib/stepmod/utils/converters/ol.rb +7 -5
- data/lib/stepmod/utils/converters/p.rb +2 -2
- data/lib/stepmod/utils/converters/pass_through.rb +2 -2
- data/lib/stepmod/utils/converters/q.rb +1 -1
- data/lib/stepmod/utils/converters/schema.rb +1 -1
- data/lib/stepmod/utils/converters/stem.rb +1 -1
- data/lib/stepmod/utils/converters/stepmod_ext_description.rb +20 -6
- data/lib/stepmod/utils/converters/strong.rb +7 -4
- data/lib/stepmod/utils/converters/sub.rb +2 -2
- data/lib/stepmod/utils/converters/sup.rb +2 -2
- data/lib/stepmod/utils/converters/synonym.rb +2 -2
- data/lib/stepmod/utils/converters/table.rb +7 -9
- data/lib/stepmod/utils/converters/term.rb +27 -9
- data/lib/stepmod/utils/converters/text.rb +11 -13
- data/lib/stepmod/utils/converters/uof.rb +3 -4
- data/lib/stepmod/utils/html_to_asciimath.rb +91 -90
- data/lib/stepmod/utils/smrl_description_converter.rb +34 -33
- data/lib/stepmod/utils/smrl_resource_converter.rb +50 -49
- data/lib/stepmod/utils/stepmod_definition_converter.rb +39 -38
- data/lib/stepmod/utils/stepmod_file_annotator.rb +26 -19
- data/lib/stepmod/utils/terms_extractor.rb +138 -86
- data/lib/stepmod/utils/version.rb +1 -1
- data/stepmod-utils.gemspec +11 -6
- metadata +62 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c31735350e54a2aa7f6de9b0de749126887d48a8e1ce23fd56378c7a5319641
|
4
|
+
data.tar.gz: aa494232f4f3858ea26f3379f602888066a7d1b98abd6d3c5cccc415d24fc58b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb202b0ed3ca8ccc4a21c36e68a4135b06d2b136227caf9b5d6627dc706d85ab7b0c1396582f5d71f967e3a35c11884a6dc30256e91fedae0a0e2d9ca52c5db9
|
7
|
+
data.tar.gz: 8a221bd8da7e75cf5653dee02fe484fbf1ab648ac8a0929941497d170310a5585b506e769c2f7ee695d3f694848aab1c874e83a668cdf397db6751d6ee3ca0b9
|
data/.github/workflows/rake.yml
CHANGED
@@ -26,11 +26,12 @@ jobs:
|
|
26
26
|
|
27
27
|
- run: gem install gem-release
|
28
28
|
|
29
|
-
-
|
30
|
-
run: |
|
29
|
+
- run: |
|
31
30
|
git config user.name github-actions
|
32
31
|
git config user.email github-actions@github.com
|
33
|
-
|
32
|
+
|
33
|
+
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.next_version != 'skip'
|
34
|
+
run: gem bump --version ${{ github.event.inputs.next_version }} --tag --push
|
34
35
|
|
35
36
|
- name: publish to rubygems.org
|
36
37
|
env:
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gemspec
|
6
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
6
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
7
7
|
|
8
|
+
gem "concurrent-ruby", "~> 1.1"
|
9
|
+
gem "pry"
|
8
10
|
gem "rake", "~> 12.0"
|
9
11
|
gem "rspec", "~> 3.0"
|
10
|
-
gem "pry"
|
11
|
-
gem "concurrent-ruby", "~> 1.1"
|
data/Rakefile
CHANGED
data/exe/stepmod-annotate-all
CHANGED
@@ -1,32 +1,38 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "concurrent"
|
4
|
+
require "stepmod/utils/stepmod_file_annotator"
|
5
5
|
|
6
6
|
stepmod_dir = ARGV.first || Dir.pwd
|
7
7
|
|
8
8
|
# build resource_docs cache
|
9
9
|
resource_docs_cache_file = `mktemp`
|
10
|
-
`"#{File.join(__dir__,
|
10
|
+
`"#{File.join(__dir__,
|
11
|
+
"stepmod-build-resource-docs-cache")}" "#{stepmod_dir}" > "#{resource_docs_cache_file}"`
|
11
12
|
|
12
13
|
# annotate each file
|
13
|
-
files = `"#{File.join(__dir__,
|
14
|
+
files = `"#{File.join(__dir__,
|
15
|
+
"stepmod-find-express-files")}" "#{stepmod_dir}"`.strip.split("\n")
|
14
16
|
MAX_THREADS = [2, Concurrent.processor_count].max * 2
|
15
17
|
MAX_QUEUE_SIZE = MAX_THREADS * 4
|
16
18
|
# https://github.com/ruby-concurrency/concurrent-ruby/blob/master/docs-source/thread_pools.md
|
17
19
|
pool = Concurrent::ThreadPoolExecutor.new(
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
20
|
+
min_threads: MAX_THREADS,
|
21
|
+
max_threads: MAX_THREADS,
|
22
|
+
max_queue: MAX_QUEUE_SIZE,
|
23
|
+
fallback_policy: :caller_runs,
|
22
24
|
)
|
23
25
|
files.each_slice(MAX_QUEUE_SIZE) do |batch|
|
24
26
|
puts("Queueing next batch")
|
25
27
|
batch.each do |file|
|
26
28
|
pool.post do
|
27
29
|
puts("#{Thread.current.object_id}: Queued processing #{file}")
|
28
|
-
annotated = Stepmod::Utils::StepmodFileAnnotator.new(express_file: file,
|
29
|
-
|
30
|
+
annotated = Stepmod::Utils::StepmodFileAnnotator.new(express_file: file,
|
31
|
+
resource_docs_cache_file: resource_docs_cache_file, stepmod_dir: stepmod_dir).call
|
32
|
+
File.open(
|
33
|
+
File.join(File.dirname(file),
|
34
|
+
"#{File.basename(file, '.exp')}_annotated.exp"), "w"
|
35
|
+
) do |file|
|
30
36
|
file.puts(annotated)
|
31
37
|
end
|
32
38
|
puts("#{Thread.current.object_id}: Done processing #{file}")
|
@@ -36,4 +42,4 @@ files.each_slice(MAX_QUEUE_SIZE) do |batch|
|
|
36
42
|
end
|
37
43
|
|
38
44
|
# cleanup
|
39
|
-
`rm "#{resource_docs_cache_file}"`
|
45
|
+
`rm "#{resource_docs_cache_file}"`
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "nokogiri"
|
4
|
+
require "json"
|
5
5
|
|
6
6
|
stepmod_dir = ARGV.first || Dir.pwd
|
7
7
|
|
8
8
|
schemas = {}
|
9
|
-
Dir.glob(File.join(stepmod_dir,
|
10
|
-
|
9
|
+
Dir.glob(File.join(stepmod_dir,
|
10
|
+
"data/resource_docs/*/resource.xml")).each do |resource_docs_file|
|
11
|
+
match = resource_docs_file.match("data/resource_docs/([^/]+)/resource.xml")
|
11
12
|
resource_docs_dir = match.captures[0]
|
12
13
|
|
13
14
|
resource_docs = Nokogiri::XML(File.read(resource_docs_file)).root
|
14
|
-
resource_docs.xpath(
|
15
|
-
schemas[schema[
|
15
|
+
resource_docs.xpath("schema").each do |schema|
|
16
|
+
schemas[schema["name"]] = resource_docs_dir
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
|
-
puts JSON.pretty_generate(schemas)
|
20
|
+
puts JSON.pretty_generate(schemas)
|
@@ -11,12 +11,14 @@ $:.unshift File.expand_path("../../lib", bin_file)
|
|
11
11
|
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
12
|
require "rubygems/specification"
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
module Gem
|
15
|
+
class Specification
|
16
|
+
def this; self; end
|
17
|
+
end
|
16
18
|
end
|
17
19
|
|
18
|
-
require
|
19
|
-
require
|
20
|
+
require "bundler/setup"
|
21
|
+
require "stepmod/utils/smrl_description_converter"
|
20
22
|
|
21
23
|
ReverseAdoc.config.unknown_tags = :bypass
|
22
24
|
|
@@ -11,12 +11,14 @@ $:.unshift File.expand_path("../../lib", bin_file)
|
|
11
11
|
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
12
12
|
require "rubygems/specification"
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
module Gem
|
15
|
+
class Specification
|
16
|
+
def this; self; end
|
17
|
+
end
|
16
18
|
end
|
17
19
|
|
18
|
-
require
|
19
|
-
require
|
20
|
+
require "bundler/setup"
|
21
|
+
require "stepmod/utils/smrl_resource_converter"
|
20
22
|
|
21
23
|
ReverseAdoc.config.unknown_tags = :bypass
|
22
24
|
|
data/exe/stepmod-extract-terms
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
require
|
4
|
+
require "pry"
|
5
5
|
# resolve bin path, ignoring symlinks
|
6
6
|
require "pathname"
|
7
7
|
bin_file = Pathname.new(__FILE__).realpath
|
@@ -12,12 +12,14 @@ $:.unshift File.expand_path("../../lib", bin_file)
|
|
12
12
|
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
13
13
|
require "rubygems/specification"
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
module Gem
|
16
|
+
class Specification
|
17
|
+
def this; self; end
|
18
|
+
end
|
17
19
|
end
|
18
20
|
|
19
|
-
require
|
20
|
-
require
|
21
|
+
require "bundler/setup"
|
22
|
+
require "stepmod/utils/terms_extractor"
|
21
23
|
|
22
24
|
stepmod_dir = ARGV.first || Dir.pwd
|
23
25
|
|
@@ -31,7 +33,7 @@ part_modules = Stepmod::Utils::TermsExtractor.call(stepmod_dir)
|
|
31
33
|
def part_to_title(bibdata)
|
32
34
|
case bibdata.part.to_i
|
33
35
|
when 41
|
34
|
-
"
|
36
|
+
"Fundamentals of product description and support"
|
35
37
|
when 42
|
36
38
|
"Geometric and topological representation"
|
37
39
|
when 43
|
@@ -39,7 +41,7 @@ def part_to_title(bibdata)
|
|
39
41
|
when 44
|
40
42
|
"Product structure, concept and configuration"
|
41
43
|
when 45
|
42
|
-
"
|
44
|
+
"Material and other engineering properties"
|
43
45
|
when 46
|
44
46
|
"Visual presentation"
|
45
47
|
when 47
|
@@ -51,37 +53,81 @@ def part_to_title(bibdata)
|
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
54
|
-
|
56
|
+
IMAGE_REPLACEMENTS = {
|
57
|
+
'image::eq01.gif[]' => 'stem:[H(A,B) = max {h(A, B), h(B,A)}]',
|
58
|
+
'image::eq02.gif[]' => 'stem:[max_{a in A} { min_{b in B} d(a,b) }]',
|
59
|
+
'image::vector_z_c.gif[]' => 'stem:[bar z_{c}]',
|
60
|
+
'image::one_direction_repeat_factor_expression.gif[]' => 'stem:[I + k cdot R; k = -1, 1]',
|
61
|
+
'image::two_direction_repeat_factor_expression.gif[]' => 'stem:[I + k_1 cdot R_1 + k_2 cdot R_2; k_1, k_2 = -1, 0, 1, k^2_1 + k^2_2 != 0]'
|
62
|
+
}
|
63
|
+
|
64
|
+
def replace_images(content)
|
65
|
+
IMAGE_REPLACEMENTS.each_pair do |k, v|
|
66
|
+
content.gsub!(k, v)
|
67
|
+
end
|
68
|
+
|
69
|
+
content
|
70
|
+
end
|
71
|
+
|
72
|
+
def log(message)
|
55
73
|
puts "[stepmod-utils] #{message}"
|
56
74
|
end
|
57
75
|
|
58
76
|
part_concepts.each do |(bibdata, current_part_concepts)|
|
77
|
+
current_part_concepts = current_part_concepts.to_a.map do |n|
|
78
|
+
n.localizations["en"]
|
79
|
+
end
|
59
80
|
fn = "03x-stepmod-#{bibdata.part}.adoc"
|
60
|
-
File.open(fn,
|
81
|
+
File.open(fn, "w") do |file|
|
61
82
|
file.puts("== #{part_to_title(bibdata)}\n\n")
|
62
|
-
file.puts(current_part_concepts.map(&:to_mn_adoc).join("\n"))
|
63
|
-
|
83
|
+
file.puts(replace_images(current_part_concepts.map(&:to_mn_adoc).join("\n")))
|
84
|
+
end
|
64
85
|
log "INFO: written to: #{fn}"
|
65
86
|
end
|
66
87
|
|
88
|
+
File.open("03x-stepmod.adoc", "w") do |file|
|
89
|
+
part_concepts.sort_by do |(bibdata, current_part_concepts)|
|
90
|
+
bibdata.part
|
91
|
+
end.each do |(bibdata, current_part_concepts)|
|
92
|
+
fn = "03x-stepmod-#{bibdata.part}.adoc"
|
93
|
+
file.puts("\ninclude::#{fn}[]\n")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
log "INFO: written summary file to: 03x-stepmod.adoc"
|
67
98
|
|
68
99
|
part_resources.each do |(bibdata, current_part_resources)|
|
100
|
+
current_part_resources = current_part_resources.to_a.map do |n|
|
101
|
+
n.localizations["en"]
|
102
|
+
end
|
69
103
|
fn = "04x-stepmod-entities-resources-#{bibdata.part}.adoc"
|
70
|
-
File.open(fn,
|
104
|
+
File.open(fn, "w") do |file|
|
71
105
|
file.puts("== #{part_to_title(bibdata)}\n\n")
|
72
|
-
file.puts(current_part_resources.map(&:to_mn_adoc).join("\n"))
|
73
|
-
|
106
|
+
file.puts(replace_images(current_part_resources.map(&:to_mn_adoc).join("\n")))
|
107
|
+
end
|
74
108
|
log "INFO: written to: #{fn}"
|
75
109
|
end
|
76
110
|
|
111
|
+
File.open("04x-stepmod-entities-resources.adoc", "w") do |file|
|
112
|
+
part_resources.sort_by do |(bibdata, current_part_resources)|
|
113
|
+
bibdata.part
|
114
|
+
end.each do |(bibdata, current_part_resources)|
|
115
|
+
fn = "04x-stepmod-entities-resources-#{bibdata.part}.adoc"
|
116
|
+
file.puts("\ninclude::#{fn}[]\n")
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
log "INFO: written summary file to: 04x-stepmod-entities-resources.adoc"
|
77
121
|
|
78
122
|
part_modules.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
79
123
|
fn = "05x-stepmod-entities-modules-#{bibdata.part}.adoc"
|
80
|
-
File.open(fn,
|
124
|
+
File.open(fn, "w") do |file|
|
81
125
|
file.puts("")
|
82
126
|
unless part_modules_arm.empty?
|
83
127
|
schema_name = part_modules_arm.first.first
|
84
|
-
concepts = part_modules_arm.first.last
|
128
|
+
concepts = part_modules_arm.first.last.to_a.map do |n|
|
129
|
+
n.localizations["en"]
|
130
|
+
end
|
85
131
|
|
86
132
|
# puts "SCHEMA NAME ARM: #{schema_name}"
|
87
133
|
file.puts("== #{schema_name}\n\n")
|
@@ -94,26 +140,51 @@ part_modules.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
|
94
140
|
schema_name = part_modules_mim.first.first
|
95
141
|
|
96
142
|
# puts "SCHEMA NAME MIM: #{schema_name}"
|
97
|
-
concepts = part_modules_mim.first.last
|
143
|
+
concepts = part_modules_mim.first.last.to_a.map do |n|
|
144
|
+
n.localizations["en"]
|
145
|
+
end
|
98
146
|
file.puts("== #{schema_name}\n\n")
|
99
|
-
file.puts(concepts.map(&:to_mn_adoc).join("\n"))
|
147
|
+
file.puts(replace_images(concepts.map(&:to_mn_adoc).join("\n")))
|
100
148
|
end
|
101
|
-
|
102
|
-
}
|
149
|
+
end
|
103
150
|
log "INFO: written to: #{fn}"
|
104
151
|
end
|
105
152
|
|
106
|
-
File.open(
|
107
|
-
|
108
|
-
|
153
|
+
File.open("05x-stepmod-entities-modules.adoc", "w") do |file|
|
154
|
+
part_modules.sort_by do |(bibdata, part_modules_arm, part_modules_mim)|
|
155
|
+
bibdata.part
|
156
|
+
end.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
157
|
+
fn = "05x-stepmod-entities-modules-#{bibdata.part}.adoc"
|
158
|
+
file.puts("\ninclude::#{fn}[]\n")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
log "INFO: written summary file to: 05x-stepmod-entities-modules.adoc"
|
163
|
+
|
164
|
+
File.open("031-stepmod-general.adoc", "w") do |file|
|
165
|
+
file.puts(
|
166
|
+
replace_images(
|
167
|
+
general_concepts.to_a.map do |n|
|
168
|
+
n.localizations["en"]
|
169
|
+
end.map(&:to_mn_adoc).join("\n")
|
170
|
+
)
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
109
174
|
log "INFO: written to: 031-stepmod-general.adoc"
|
110
175
|
|
111
|
-
File.open(
|
112
|
-
file.puts(
|
113
|
-
|
176
|
+
File.open("041-stepmod-entities-resources.adoc", "w") do |file|
|
177
|
+
file.puts(
|
178
|
+
replace_images(
|
179
|
+
resource_concepts.to_a.map do |n|
|
180
|
+
n.localizations["en"]
|
181
|
+
end.map(&:to_mn_adoc).join("\n")
|
182
|
+
)
|
183
|
+
)
|
184
|
+
end
|
114
185
|
log "INFO: written to: 041-stepmod-entities-resources.adoc"
|
115
186
|
|
116
|
-
File.open(
|
187
|
+
File.open("991-generated-bibliography.adoc", "w") do |file|
|
117
188
|
file.puts(parsed_bibliography.map(&:to_mn_adoc).sort.uniq.join("\n"))
|
118
|
-
|
189
|
+
end
|
119
190
|
log "INFO: written to: 991-generated-bibliography.adoc"
|
@@ -1,23 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require "nokogiri"
|
4
4
|
|
5
5
|
stepmod_dir = ARGV.first || Dir.pwd
|
6
6
|
|
7
|
-
index = Nokogiri::XML(File.read(File.join(stepmod_dir,
|
7
|
+
index = Nokogiri::XML(File.read(File.join(stepmod_dir,
|
8
|
+
"repository_index.xml"))).root
|
8
9
|
|
9
10
|
files = []
|
10
|
-
index.xpath(
|
11
|
+
index.xpath("modules/module").each do |item|
|
11
12
|
files << "#{stepmod_dir}/data/modules/#{item['name']}/arm.exp"
|
12
13
|
files << "#{stepmod_dir}/data/modules/#{item['name']}/mim.exp"
|
13
14
|
end
|
14
|
-
index.xpath(
|
15
|
+
index.xpath("resources/resource").each do |item|
|
15
16
|
files << "#{stepmod_dir}/data/resources/#{item['name']}/#{item['name']}.exp"
|
16
17
|
end
|
17
|
-
index.xpath(
|
18
|
+
index.xpath("business_object_models/business_object_model").each do |item|
|
18
19
|
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/bom.exp"
|
19
20
|
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/DomainModel.exp"
|
20
21
|
end
|
21
22
|
|
22
|
-
existing_files = files.filter{|file| File.exists?(file)}
|
23
|
-
puts existing_files
|
23
|
+
existing_files = files.filter { |file| File.exists?(file) }
|
24
|
+
puts existing_files
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module Stepmod
|
2
2
|
module Utils
|
3
|
-
|
4
3
|
class Bibdata
|
5
|
-
|
6
4
|
DOCNUMBER = 10303
|
7
5
|
|
8
6
|
attr_accessor *%w(
|
@@ -15,23 +13,25 @@ module Stepmod
|
|
15
13
|
# module, resource, application_protocol, business_object_model
|
16
14
|
@type = document.name
|
17
15
|
|
18
|
-
raise
|
16
|
+
raise "UnknownFileError" unless %w(module resource
|
17
|
+
application_protocol business_object_model).include?(@type)
|
19
18
|
|
20
|
-
@doctype = document[
|
21
|
-
@part = document[
|
22
|
-
@title_en = document[
|
23
|
-
document[
|
24
|
-
|
25
|
-
@
|
26
|
-
@
|
19
|
+
@doctype = document["status"]
|
20
|
+
@part = document["part"]
|
21
|
+
@title_en = document["title"] ||
|
22
|
+
document["name"].gsub("_", " ").capitalize.gsub("2d", "2D").gsub("3d",
|
23
|
+
"3D")
|
24
|
+
@title_fr = document["name.french"]
|
25
|
+
@version = document["version"]
|
26
|
+
@language = document["language"]
|
27
27
|
|
28
28
|
# Some publication.year contains month...
|
29
|
-
@pub_year = document[
|
30
|
-
@pub_date = document[
|
29
|
+
@pub_year = document["publication.year"].split("-").first
|
30
|
+
@pub_date = document["publication.date"]
|
31
31
|
|
32
32
|
# puts to_mn_adoc
|
33
33
|
|
34
|
-
|
34
|
+
self
|
35
35
|
# <module
|
36
36
|
# name="security_classification"
|
37
37
|
# name.french="Classification des sécurités"
|
@@ -54,28 +54,27 @@ module Stepmod
|
|
54
54
|
# rcs.revision="$Revision: 1.26 $"
|
55
55
|
# development.folder="dvlp"
|
56
56
|
# >
|
57
|
-
|
58
57
|
end
|
59
58
|
|
60
59
|
def docid
|
61
60
|
no_date = case doctype
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
61
|
+
when "IS"
|
62
|
+
"ISO #{DOCNUMBER}-#{part}"
|
63
|
+
when "WD"
|
64
|
+
"ISO/WD #{DOCNUMBER}-#{part}"
|
65
|
+
when "CD"
|
66
|
+
"ISO/CD #{DOCNUMBER}-#{part}"
|
67
|
+
when "DIS"
|
68
|
+
"ISO/DIS #{DOCNUMBER}-#{part}"
|
69
|
+
when "FDIS"
|
70
|
+
"ISO/FDIS #{DOCNUMBER}-#{part}"
|
71
|
+
when "TS"
|
72
|
+
"ISO/TS #{DOCNUMBER}-#{part}"
|
73
|
+
when "CD-TS"
|
74
|
+
"ISO/CD TS #{DOCNUMBER}-#{part}"
|
75
|
+
else
|
76
|
+
"UNKNOWN DOCTYPE: (#{doctype})"
|
77
|
+
end
|
79
78
|
|
80
79
|
if pub_year
|
81
80
|
"#{no_date}:#{pub_year}"
|
@@ -106,7 +105,7 @@ module Stepmod
|
|
106
105
|
end
|
107
106
|
|
108
107
|
def anchor
|
109
|
-
docid.gsub(
|
108
|
+
docid.gsub("/", "-").gsub(" ", "_").gsub(":", "_")
|
110
109
|
end
|
111
110
|
|
112
111
|
def to_mn_adoc
|
@@ -116,9 +115,6 @@ module Stepmod
|
|
116
115
|
"* [[[#{anchor},#{docid}]]]"
|
117
116
|
end
|
118
117
|
end
|
119
|
-
|
120
118
|
end
|
121
|
-
|
122
119
|
end
|
123
120
|
end
|
124
|
-
|