class Ovec::TexManipulator

Public Instance Methods

bind(root) click to toggle source
# File lib/ovec/tex_manipulator.rb, line 3
def bind(root)
        @root = root
end
run_text_manipulator(manipulator) click to toggle source
# File lib/ovec/tex_manipulator.rb, line 22
def run_text_manipulator(manipulator)
        @text_chunks = []
        load_text_chunks_dfs(@root)
        manipulator.bind(@text_chunks)       
        manipulator.run
end

Private Instance Methods

load_text_chunks_dfs(node) click to toggle source
# File lib/ovec/tex_manipulator.rb, line 8
def load_text_chunks_dfs(node)
        case node
        when Ovec::TextCommandsNode then
                load_text_chunks_dfs(node.content) if node.text?
        when Ovec::TextNode  then
                @text_chunks << node.text
        when Ovec::CombinedNode then
                node.content.each { |subnode| 
                        load_text_chunks_dfs(subnode)
                }
        end
end