Class: Stepmod::Utils::Converters::ModuleRefExpressDescription
- Inherits:
-
Base
- Object
- ReverseAdoc::Converters::Base
- Base
- Stepmod::Utils::Converters::ModuleRefExpressDescription
- Defined in:
- lib/stepmod/utils/converters/module_ref_express_description.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#convert(node, _state = {}) ⇒ Object
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 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/stepmod/utils/converters/module_ref_express_description.rb', line 9 def convert(node, _state = {}) link_end = node["linkend"].to_s.split(":") ref_id = link_end.last parts = link_end.last.split(".") text = node.text.gsub(/\s/, " ").squeeze(" ").strip # puts "linkend #{node["linkend"]}" result = case link_end[1] when "1_scope", "introduction" # When we see this: # <module_ref linkend="functional_usage_view:1_scope">Functional usage view</module_ref> # <module_ref linkend="part_definition_relationship:introduction"> Part definition relationship</module_ref> # We convert into: # <<express:functional_usage_view>> # <<express:part_definition_relationship>> "<<express:#{link_end.first}>>" when "3_definition" # #23: # When we see this: # <module_ref linkend="product_as_individual:3_definition">individual products</module_ref> # We convert to this: # {{individual products}} "{{#{text}}}" when "4_types" # ISO 10303-2 does not contain TYPEs, ignore "" when "4_entities", "f_usage_guide" # ISO 10303-2 does not contain figures and tables, ignore "" else puts "[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(":")}" raise StandardError.new("[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(":")}") end # puts "[module_ref] #{result}" result end |