Sha256: 961ca6caeb93de324e9e294a0604152bed339235b274129deccd216ccfca44df
Contents?: true
Size: 968 Bytes
Versions: 2
Compression:
Stored size: 968 Bytes
Contents
# frozen_string_literal: true require 'stepmod/utils/converters/synonym' module Stepmod module Utils module Converters class Term < ReverseAsciidoctor::Converters::Base 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 end ReverseAsciidoctor::Converters.register :term, Term.new end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stepmod-utils-0.1.5 | lib/stepmod/utils/converters/term.rb |
stepmod-utils-0.1.4 | lib/stepmod/utils/converters/term.rb |