Class: Stepmod::Utils::Converters::StepmodExtDescription
- Inherits:
-
ReverseAdoc::Converters::Base
- Object
- ReverseAdoc::Converters::Base
- Stepmod::Utils::Converters::StepmodExtDescription
- Defined in:
- lib/stepmod/utils/converters/stepmod_ext_description.rb
Instance Method Summary collapse
Instance Method Details
#convert(node, state = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/stepmod/utils/converters/stepmod_ext_description.rb', line 5 def convert(node, state = {}) state = state.merge(schema_name: node["linkend"]) linkend = node["linkend"].split(".") # We only want ENTITY entries, not their attributes # https://github.com/metanorma/iso-10303-2/issues/36#issuecomment-841300092 return nil if linkend.length != 2 child_text = treat_children(node, state).strip return nil if child_text.empty? # Only taking the first paragraph of the definition child_text = child_text.split("\n").first # # Only taking the first sentence # if child_text.contains?(".") # child_text = child_text.split(".").first # end domain = case linkend.first when /_mim$/, /_arm$/ "STEP module" # when /_schema$/ else "STEP resource" end " === \#{linkend.last}\n\n \#{domain ? \"domain:[\#{domain}]\" : ''}\n\n \#{child_text}\n TEMPLATE\nend\n" |