Class: Latexpdf::Escaper
- Inherits:
-
Object
- Object
- Latexpdf::Escaper
- Defined in:
- lib/latexpdf/escaper.rb
Constant Summary collapse
- ESCAPE_RE =
/([{}_$&%#])|([\\^~|<>])/
- ESC_MAP =
{ '\\' => 'backslash', '^' => 'asciicircum', '~' => 'asciitilde', '|' => 'bar', '<' => 'less', '>' => 'greater' }
Instance Method Summary collapse
- #remove_non_printable_chars(text) ⇒ Object
- #tab_newline_to_space(text) ⇒ Object
- #tex_safe(text) ⇒ Object
Instance Method Details
#remove_non_printable_chars(text) ⇒ Object
17 18 19 20 |
# File 'lib/latexpdf/escaper.rb', line 17 def remove_non_printable_chars(text) pattern = /([\x00-\x08\x0B-\x1F\x7F])/ text.gsub(pattern, "") end |
#tab_newline_to_space(text) ⇒ Object
13 14 15 |
# File 'lib/latexpdf/escaper.rb', line 13 def tab_newline_to_space(text) text.gsub(/[\x09\x0A]/, " ") end |