module Cleaners

Public Class Methods

ending_tags_without_spaces_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 6
def self.ending_tags_without_spaces_cleaner(str) 
    str && str.gsub(/%\s*\}\s*\}/, '%}}')
end
join_dots_and_brackets_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 26
def self.join_dots_and_brackets_cleaner(str)
    str && str.gsub(/\s*\.\s*/, '.').gsub(/\s*\[\s*/, '[').gsub(/\s*\]/, ']')
end
no_spaces_around_undeline_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 22
def self.no_spaces_around_undeline_cleaner(str) 
    str && str.gsub(/\s*\_\s*/, "_")
end
question_method_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 30
def self.question_method_cleaner(str)
    if str && str =~ /\A\{\{\s+if\s*(.*?)\s*\?\s+\}\}\Z/
        "{{ if #{$1}\? }}"
    else
        str
    end
end
single_quote_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 10
def self.single_quote_cleaner(str)
    str && str.gsub(/\‘/, '\'').gsub(/\’/, '\'')
end
starting_tags_without_spaces_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 2
def self.starting_tags_without_spaces_cleaner(str) 
    str && str.gsub(/\{\s*\{\s*%/, '{{%')
end
var_without_duplicated_spaces_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 14
def self.var_without_duplicated_spaces_cleaner(str) 
    str && str.gsub(/\s+/, ' ')
end
var_without_spaces_inside_brackets_cleaner(str) click to toggle source
# File lib/docx/cleaners.rb, line 18
def self.var_without_spaces_inside_brackets_cleaner(str) 
    str && str.gsub(/\[(.*?)\]/) { |match| match.gsub(/\s/, '')}
end