metanorma-plugin-lutaml 0.4.4 → 0.4.5

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: 213cd8b2ecaa1b45360480fc2de787f6708b625f5370b7e7617317d77b703ee6
4
- data.tar.gz: 396fd04d0ac3f979a6a9ee3b425988fc17af5a267b8e140438a92b73ac41dd5f
3
+ metadata.gz: 0a510a5a23684dee91557fb6047267ca6ac87be25cbe11e0bcad8e4c0d0812b9
4
+ data.tar.gz: 5d6e5cfc99c66b42ed50b7f6c6b1346fd2887ee9bba4436cacd5fbc56121dde6
5
5
  SHA512:
6
- metadata.gz: 37ad00c2a5bed4ddd9314ad99883545b526ed461e92d99de045072e900592c09798d82dc6119017a5e7656d891c1ea0cc331c844801ec2c0b4d2aae8784775aa
7
- data.tar.gz: b8b6cb960be27fc5612c7a987250cd607ea0ae3f07dec61e44334765a64f7d5c22d245a108f2bbfdd4ec6fdc34e3b822b87fb801f70a3406611639d887ea00a9
6
+ metadata.gz: ea2e863ee349fb9bc5e60c43802569b0592b3437f2aad58f5bdb5591ecd430388566aff7ad8ff6d6c187e64868df9f1f303917afa94e73396e5c6d6564d0571a
7
+ data.tar.gz: dc8d9a72fbea070f7aec02fa576c59859ce34abf6375e307ef18685cdbd70130edcc3958839e7b82e9e7155befc8b51657c685d5f42cef96e900de0fd4a50532
@@ -14,7 +14,7 @@ module Metanorma
14
14
  # @example [lutaml_uml_attributes_table,path/to/lutaml,EntityName]
15
15
  class LutamlUmlAttributesTablePreprocessor < Asciidoctor::Extensions::Preprocessor
16
16
  MARCO_REGEXP =
17
- /\[lutaml_uml_attributes_table,([^,]+),?(.+)?,([^,]+),?(.+)?\]/
17
+ /\[lutaml_uml_attributes_table,([^,]+),?([^,]+),?(.+?)?\]/
18
18
  # search document for block `datamodel_attributes_table`
19
19
  # read include derectives that goes after that in block and transform
20
20
  # into yaml2text blocks
@@ -36,15 +36,16 @@ module Metanorma
36
36
  input_lines.each_with_object([]) do |line, result|
37
37
  if match = line.match(MARCO_REGEXP)
38
38
  lutaml_path = match[1]
39
- entity_name = match[3]
40
- result.push(*parse_marco(lutaml_path, entity_name, document))
39
+ entity_name = match[2]
40
+ skip_headers = match[3]
41
+ result.push(*parse_marco(lutaml_path, entity_name, document, skip_headers))
41
42
  else
42
43
  result.push(line)
43
44
  end
44
45
  end
45
46
  end
46
47
 
47
- def parse_marco(lutaml_path, entity_name, document)
48
+ def parse_marco(lutaml_path, entity_name, document, skip_headers)
48
49
  lutaml_document = lutaml_document_from_file(document, lutaml_path)
49
50
  .serialized_document
50
51
  entities = [lutaml_document["classes"], lutaml_document["enums"]]
@@ -53,12 +54,12 @@ module Metanorma
53
54
  entity_definition = entities.detect do |klass|
54
55
  klass["name"] == entity_name.strip
55
56
  end
56
- model_representation(entity_definition, document)
57
+ model_representation(entity_definition, document, skip_headers)
57
58
  end
58
59
 
59
- def model_representation(entity_definition, document)
60
+ def model_representation(entity_definition, document, skip_headers)
60
61
  render_result, errors = Utils.render_liquid_string(
61
- template_string: table_template,
62
+ template_string: table_template(skip_headers),
62
63
  context_items: entity_definition,
63
64
  context_name: "definition",
64
65
  document: document
@@ -68,9 +69,9 @@ module Metanorma
68
69
  end
69
70
 
70
71
  # rubocop:disable Layout/IndentHeredoc
71
- def table_template
72
+ def table_template(skip_headers)
72
73
  <<~TEMPLATE
73
- === {{ definition.name }}
74
+ #{"=== {{ definition.name }}" unless skip_headers}
74
75
  {{ definition.definition }}
75
76
 
76
77
  {% if definition.attributes %}
@@ -1,7 +1,7 @@
1
1
  module Metanorma
2
2
  module Plugin
3
3
  module Lutaml
4
- VERSION = "0.4.4".freeze
4
+ VERSION = "0.4.5".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.