stepmod-utils 0.3.20 → 0.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/stepmod/utils/terms_extractor.rb +27 -12
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d50ed47ffc263b007aa9f2bda3bf5535d9cf84dbc56f1fc87c63d4255ed3f02
|
4
|
+
data.tar.gz: 3572d73a116953f337ac8add7bb47133f33ab3244daa6f3ee58e9901f26cb5f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5263394029779a53cca0c8f41171eb5bbc8e2490de14041c4e6ae56f8880a0f4eff49c1235d43d69f0d34501e5ae372a4c77bbfeb459147765fd87f81014d7dd
|
7
|
+
data.tar.gz: 6aab6c46a9023e194fe278cedd353807d070eba8c61949777af13ff63a26d3f652a304575cfc56873b54fd57187347a1321df40d7527905320689664da89991c
|
@@ -154,7 +154,7 @@ module Stepmod
|
|
154
154
|
|
155
155
|
# read definitions
|
156
156
|
current_part_concepts = Glossarist::Collection.new
|
157
|
-
current_document.xpath("//definition").
|
157
|
+
current_document.xpath("//definition").each.with_index(1) do |definition, definition_index|
|
158
158
|
term_id = definition["id"]
|
159
159
|
unless term_id.nil?
|
160
160
|
if encountered_terms[term_id]
|
@@ -444,7 +444,9 @@ module Stepmod
|
|
444
444
|
combined.gsub!(/\n\/\/.*?\n/, "\n")
|
445
445
|
combined.strip!
|
446
446
|
|
447
|
-
combined
|
447
|
+
express_reference_to_mention(combined)
|
448
|
+
|
449
|
+
# combined
|
448
450
|
# # TODO: If the definition contains a list immediately after the first paragraph, don't split
|
449
451
|
# return definition if definition =~ /\n\* /
|
450
452
|
|
@@ -461,6 +463,15 @@ module Stepmod
|
|
461
463
|
# end
|
462
464
|
end
|
463
465
|
|
466
|
+
# Replace `<<express:{schema}.{entity},{render}>>` with {{entity,render}}
|
467
|
+
def express_reference_to_mention(description)
|
468
|
+
# TODO: Use Expressir to check whether the "entity" is really an
|
469
|
+
# EXPRESS ENTITY. If not, skip the mention.
|
470
|
+
description.gsub(/<<express:([^,]+),([^>]+)>>/) do |match|
|
471
|
+
"{{#{Regexp.last_match[1].split('.').last},#{Regexp.last_match[2]}}}"
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
464
475
|
def entity_name_to_text(entity_id)
|
465
476
|
entity_id.downcase.gsub(/_/, " ")
|
466
477
|
end
|
@@ -471,33 +482,37 @@ module Stepmod
|
|
471
482
|
|
472
483
|
# See: metanorma/iso-10303-2#90
|
473
484
|
# TODO: This is not DRY in case we have to further customize
|
474
|
-
entity_text = if domain_type = domain.match(/\A(application
|
485
|
+
entity_text = if domain_type = domain.match(/\A(application object):/)
|
486
|
+
|
487
|
+
entity_ref = if entity.id == entity_name_to_text(entity.id)
|
488
|
+
"{{#{entity.id}}}"
|
489
|
+
else
|
490
|
+
"{{#{entity.id},#{entity_name_to_text(entity.id)}}}"
|
491
|
+
end
|
475
492
|
|
476
493
|
if entity.subtype_of.size.zero?
|
477
|
-
"#{domain_type[1]} that represents the " +
|
478
|
-
"{{#{entity.id},#{entity_name_to_text(entity.id)}}} entity"
|
494
|
+
"#{domain_type[1]} that represents the " + entity_ref + " entity"
|
479
495
|
else
|
480
496
|
entity_subtypes = entity.subtype_of.map do |e|
|
481
497
|
"{{#{e.id},#{entity_name_to_text(e.id)}}}"
|
482
498
|
end
|
483
499
|
"#{domain_type[1]} that is a type of " +
|
484
500
|
"#{entity_subtypes.join(' and ')} that represents the " +
|
485
|
-
"
|
501
|
+
entity_ref + " entity"
|
486
502
|
end
|
487
503
|
|
488
504
|
else
|
489
505
|
|
490
|
-
# Not "application object"
|
506
|
+
# Not "application object"
|
491
507
|
if entity.subtype_of.size.zero?
|
492
|
-
"entity data type that represents "
|
493
|
-
entity.id.indefinite_article + " {{#{entity.id}}} entity"
|
508
|
+
"entity data type that represents the {{#{entity.id}}} entity"
|
494
509
|
else
|
495
510
|
entity_subtypes = entity.subtype_of.map do |e|
|
496
511
|
"{{#{e.id}}}"
|
497
512
|
end
|
498
|
-
"entity data type that is a type of "+
|
499
|
-
"#{entity_subtypes.join(' and ')} that represents " +
|
500
|
-
|
513
|
+
"entity data type that is a type of " +
|
514
|
+
"#{entity_subtypes.join(' and ')} that represents the " +
|
515
|
+
"{{#{entity.id}}} entity"
|
501
516
|
end
|
502
517
|
end
|
503
518
|
|
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.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|