metanorma-plugin-lutaml 0.7.11 → 0.7.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0601a4c6b35e5d1fd1c58d24240e3a5dea1b87bae62cbf9ce17ac904c21d5bf
4
- data.tar.gz: 60d05d99810e378da5df64b8ec603fbf522a3e66c10ef9ef776c0c616dd2a9e0
3
+ metadata.gz: 0270f7d18a587b6569572dc7dc21fffe4e10939e32fe8ffcfa8e86888e1e772d
4
+ data.tar.gz: e1a826c03cbb78311eff5143b7ca41b9ce7e4a0ae0c55afd1fb31682ccec02b4
5
5
  SHA512:
6
- metadata.gz: 1a6e74aa665b6b3917ce08bc0a8aa7464dd3acb3fa6e1664f0a4e9951c3a204769299d8fbe3ff3be3f9b700b9d3cf28def826844cb0fa6de94fc6158827eb011
7
- data.tar.gz: e772698bfc26cbb86bf58e171dcd2e531c91b834f67b7241939ee9db2cf51516d8531c46ae69eae14148c46575c85fe94e02502b73b0d78e2c3ff8bc2546d6fa
6
+ metadata.gz: 12e9e15833fa38b735f7caae2c3e6686c65e42872a38303a866268d74510e16d7a2296107c146f539dff5b6183c65fc35e5bdbca460736594c2653edd7c2abe3
7
+ data.tar.gz: b09e732cdde35ab5da7638245480647fe543394509ed416fe8a9d09a2e3fec12620395210975b39428d7b986ad0268f45f7c6dfbe2a33b1d39cee990b052588f
data/README.adoc CHANGED
@@ -394,6 +394,29 @@ The command accepts the options listed below:
394
394
  `lib/metanorma/plugin/lutaml/templates`. This template can be customized by
395
395
  changing the template path in the `template` option.
396
396
 
397
+ * `guidance="/path/to/my_guidance.yml"`specifies the path of
398
+ the yaml file of the guidance. (Optional)
399
+
400
+ The guidance file should be in the following format:
401
+
402
+ [source,yaml]
403
+ ----
404
+ ---
405
+ classes:
406
+ - name: Name Of Class
407
+ attributes:
408
+ - name: Name Of Attribute (e.g. gml:boundedBy)
409
+ used: false
410
+ guidance: |
411
+ Drop guidance message here.
412
+ ...
413
+ ----
414
+
415
+ If you want to define the guidance, you can define the `name` of the class
416
+ under `classes`. Then define which `attributes` you want to add guidance by the
417
+ `name`. Set `used` to show the attribute is used or not. Drop the message of
418
+ guidance in `guidance`.
419
+
397
420
  === Generating UML class and attributes: `lutaml_uml_class`
398
421
 
399
422
  This command allows rendering a definition clause for a UML class.
@@ -853,6 +876,19 @@ By:
853
876
  ...
854
877
  -----
855
878
 
879
+ You can define guidance in the configuration file as well. The configuration
880
+ file will looks like:
881
+
882
+ [source,yaml]
883
+ -----
884
+ packages:
885
+ - my_package
886
+ guidance: "path/to/guidance.yaml"
887
+ -----
888
+
889
+ Please refer to `lutaml_klass_table` section for how to configure the guidance
890
+ yaml file.
891
+
856
892
  == Documentation
857
893
 
858
894
  Please refer to https://www.metanorma.org.
@@ -1,11 +1,23 @@
1
1
  {% assign root = klass.generalization %}
2
+
3
+ {%- capture upper_klass_name -%}
4
+ {{ root.general.upper_klass }}:{{ root.general.name }}
5
+ {%- endcapture -%}
6
+ {%- if upper_klass_name == ":" -%}
7
+ {%- assign upper_klass_name = "-" -%}
8
+ {%- endif -%}
9
+ {%- capture stereotype -%}<< {{ root.stereotype }} >>{%- endcapture -%}
10
+ {%- if stereotype == "<< >>" -%}
11
+ {%- assign stereotype = " " -%}
12
+ {%- endif -%}
13
+
2
14
  [cols="1a,1a,2a"]
3
15
  |===
4
16
  | Definition of Type
5
17
  2+| {{ root.definition }}
6
18
 
7
- h| Upper Type 2+| {{ root.general.upper_klass }}:{{ root.general.name }}
8
- h| Stereotype 2+| << {{ root.stereotype }} >>
19
+ h| Upper Type 2+| {{ upper_klass_name }}
20
+ h| Stereotype 2+| {{ stereotype }}
9
21
 
10
22
  3+h| Inherited Properties
11
23
  h| Property Name h| Property Type and Multiplicity h| Definition
@@ -16,7 +28,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
16
28
  ({{ attr.gen_name }})
17
29
  {%- endcapture -%}
18
30
  | {{ name_col | newline_to_br }}
19
- | {{ attr.type }} [{{ attr.cardinality }}]
31
+ | {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
20
32
  | {{ attr.definition }}
21
33
  {%- endif -%}
22
34
  {% endfor %}
@@ -30,7 +42,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
30
42
  ({{ attr.gen_name }})
31
43
  {%- endcapture -%}
32
44
  | {{ name_col | newline_to_br }}
33
- | {{ attr.type }} [{{ attr.cardinality }}]
45
+ | {{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
34
46
  | {{ attr.definition }}
35
47
  {%- endif -%}
36
48
  {% endfor %}
@@ -44,7 +56,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
44
56
  ({{ attr.gen_name }})
45
57
  {%- endcapture -%}
46
58
  | {{ name_col | newline_to_br }}
47
- | {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality }}]
59
+ | {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
48
60
  | {{ attr.definition }}
49
61
  {%- endif -%}
50
62
  {% endfor %}
@@ -58,7 +70,7 @@ h| Property Name h| Property Type and Multiplicity h| Definition
58
70
  ({{ attr.gen_name }})
59
71
  {%- endcapture -%}
60
72
  | {{ name_col | newline_to_br }}
61
- | {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality }}]
73
+ | {{ attr.type_ns }}:{{ attr.type }} [{{ attr.cardinality.min }}..{{ attr.cardinality.max }}]
62
74
  | {{ attr.definition }}
63
75
  {%- endif -%}
64
76
  {% endfor %}
@@ -55,12 +55,24 @@ module Metanorma
55
55
  Xmi::EaRoot.load_extension(ea_extension_full_path)
56
56
  end
57
57
 
58
- result_document = parse_result_document(full_path)
58
+ guidance = get_guidance_file(document, yaml_config["guidance"])
59
+ result_document = parse_result_document(full_path, guidance)
59
60
  document.attributes["lutaml_xmi_cache"] ||= {}
60
61
  document.attributes["lutaml_xmi_cache"][full_path] = result_document
61
62
  result_document
62
63
  end
63
64
 
65
+ def get_guidance_file(document, guidance_config)
66
+ guidance = nil
67
+
68
+ if guidance_config
69
+ guidance = Utils.relative_file_path(document,
70
+ guidance_config)
71
+ end
72
+
73
+ guidance
74
+ end
75
+
64
76
  def parse_yaml_config_file(document, file_path)
65
77
  return {} if file_path.nil?
66
78
 
@@ -24,9 +24,10 @@ module Metanorma
24
24
 
25
25
  private
26
26
 
27
- def parse_result_document(full_path)
27
+ def parse_result_document(full_path, guidance)
28
28
  ::Lutaml::XMI::Parsers::XML.serialize_xmi_to_liquid(
29
29
  File.new(full_path, encoding: "UTF-8"),
30
+ guidance,
30
31
  )
31
32
  end
32
33
  end
@@ -22,8 +22,14 @@ module Metanorma
22
22
  )
23
23
  end
24
24
 
25
+ if attrs["guidance"]
26
+ attrs["guidance"] = Utils.relative_file_path(
27
+ parent.document, attrs["guidance"]
28
+ )
29
+ end
30
+
25
31
  klass = ::Lutaml::XMI::Parsers::XML.serialize_generalization_by_name(
26
- xmi_path, attrs["name"]
32
+ xmi_path, attrs["name"], attrs["guidance"]
27
33
  )
28
34
 
29
35
  render(klass, parent, attrs)
@@ -24,7 +24,7 @@ module Metanorma
24
24
 
25
25
  private
26
26
 
27
- def parse_result_document(full_path)
27
+ def parse_result_document(full_path, _guidance = nil)
28
28
  ::Lutaml::Parser.parse(File.new(full_path, encoding: "UTF-8")).first
29
29
  end
30
30
  end
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.7.11".freeze
4
+ VERSION = "0.7.13".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -29,14 +29,13 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency "coradoc", "~> 1.1.1"
30
30
  spec.add_dependency "expressir", "~> 1.4.0"
31
31
  spec.add_dependency "liquid"
32
- spec.add_dependency "lutaml", ">= 0.9.14"
33
- spec.add_dependency "ogc-gml"
32
+ spec.add_dependency "lutaml", ">= 0.9.18"
33
+ spec.add_dependency "ogc-gml", "1.0.0"
34
34
  spec.add_dependency "relaton-cli"
35
35
 
36
36
  spec.add_development_dependency "debug"
37
37
  spec.add_development_dependency "equivalent-xml"
38
38
  spec.add_development_dependency "metanorma-standoc"
39
- spec.add_development_dependency "ogc-gml"
40
39
  spec.add_development_dependency "rake", "~> 13"
41
40
  spec.add_development_dependency "rspec", "~> 3.6"
42
41
  spec.add_development_dependency "rspec-html-matchers"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.11
4
+ version: 0.7.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-08 00:00:00.000000000 Z
11
+ date: 2024-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.9.14
75
+ version: 0.9.18
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.9.14
82
+ version: 0.9.18
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: ogc-gml
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 1.0.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 1.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: relaton-cli
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -150,20 +150,6 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: ogc-gml
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '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'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: rake
169
155
  requirement: !ruby/object:Gem::Requirement