9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/stepmod/utils/converters/term.rb', line 9
def convert(node, state = {})
first_child = node.children.find do |child|
child.name == 'text' && !child.text.to_s.strip.empty?
end
unless first_child &&
node.text.split(';').length == 2 &&
defined?(Stepmod::Utils::Converters::Synonym)
return "=== #{treat_children(node, state).strip}"
end
term_def, alt = node.text.split(';')
alt_xml = Nokogiri::XML::Text.new(alt, Nokogiri::XML::Document.new)
converted_alt = Stepmod::Utils::Converters::Synonym.new.convert(alt_xml)
"=== #{term_def}\n\n#{converted_alt}"
end
|