lib/pretty_strings.rb in pretty_strings-0.5.0 vs lib/pretty_strings.rb in pretty_strings-0.6.0
- old
+ new
@@ -13,19 +13,20 @@
remove_consecutive_dots(
replace_symbol_with_bracket(
remove_newlines(
replace_tabs(
remove_bracketed_code(
+ remove_twb_tags(
scan_for_code(
escape_text(
sanitize_text(
replace_bracket_with_symbol(
escape_text(
sanitize_text(
replace_bracket_with_symbol(
text
- ))))))))))))).squeeze(" ").strip
+ )))))))))))))).squeeze(" ").strip
end
private
def remove_newlines(text)
@@ -47,9 +48,27 @@
text.gsub!(/(?<=\*\*\{email)\}(?=\*\*)/, '♚') || text
text.gsub!(/(?<=\*\*\{url)\}(?=\*\*)/, '♚') || text
text.gsub!(/\{.*?\}/, '') || text
text.gsub!(/♚/, '}') || text
text.gsub!(/⚘/, '{') || text
+ end
+
+ def remove_twb_tags(text)
+ remove_twb_tags_post(
+ remove_twb_tags_post(
+ remove_twb_tags_post(
+ remove_twb_tags_post(
+ remove_twb_tags_pre(text)))))
+ end
+
+ def remove_twb_tags_post(text)
+ text.gsub!(/({\\\S+ )([^{}}]*)(})/, '\2') || text
+ text.gsub!('\sectd\\linex0\\headery708\\footery708\\colsx708\\endnhere\\sectlinegrid360\\sectdefaultcl\\sftnbj ', '') || text
+ end
+
+ def remove_twb_tags_pre(text)
+ text.gsub!(/\{\\super \d+}/, '') || text
+ text.gsub!(/\{\\\*\\fldinst [^{}]*}/, '') || text
end
def remove_consecutive_dots(text)
text.gsub!(/\.{5,}/, '') || text
end