Sha256: 822615587a803833f60ecba661de13e6bb85fe972a9ba3987cc0633633a18fad
Contents?: true
Size: 763 Bytes
Versions: 13
Compression:
Stored size: 763 Bytes
Contents
require "reverse_adoc" module Stepmod module Utils module Converters class Base < ReverseAdoc::Converters::Base PREFIXES_REGEX = /([Ff]ormula|[Ff]igure|[Tt]able)\s*/.freeze def treat_children(node, state) updated_node = remove_prefixes(node) updated_node.children.inject("") do |memo, child| memo << treat(child, state) end end private def remove_prefixes(node) node.children.each_with_index do |child, index| if child.text.match(PREFIXES_REGEX) && node.children[index + 1]&.name == "a" child.content = child.content.gsub(PREFIXES_REGEX, "") end end node end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems