lib/hatemile/implementation/accessible_css_implementation.rb
##
# Execute a operation by regular expression for element only.
#
# @param element [Hatemile::Util::Html::HTMLDOMElement] The element.
# @param regular_expression [Regexp] The regular expression.
# @param data_property_value [String] The value of custom attribute used
#   to identify the fix.
# @param operation [Method] The operation to be executed.
Execute a operation by regular expression for element only.
Execute a operation by regular expression for element only .
def speak_as(element, regular_expression, data_property_value, operation)
        children = []
        content = element.get_text_content
        until content.empty?
          index = content.index(regular_expression)
          break if index.nil?
          children = operation.call(content, index, children)
          new_index = index + 1
          content = content[new_index..-1]
        end
        return if children.empty?
        unless content.empty?
          children.push(create_content_element(content, data_property_value))
        end
        element.get_first_node_child.remove_node while element.has_children?
        children.each do |child|
          element.append_element(child)
        end
      end
def speak_as ( element , regular_expression , data_property_value , operation ) children = [ ] content = element . get_text_content until content . empty? index = content . index ( regular_expression ) break if index . nil? children = operation . call ( content , index , children ) new_index = index + 1 content = content [ new_index .. - 1 ] end return if children . empty? unless content . empty? children . push ( create_content_element ( content , data_property_value ) ) end element . get_first_node_child . remove_node while element . has_children? children . each do | child | element . append_element ( child ) end end
Execute a operation by regular expression for element only.
Execute a operation by regular expression for element only .
element
None
regular_expression
The regular expression.
The regular expression .
data_property_value
The value of custom attribute used to identify the fix.
The value of custom attribute used to identify the fix .
operation
The operation to be executed.
The operation to be executed .