Module: Blogger::Helpers
- Included in:
- Guard::Blogger
- Defined in:
- lib/blogger/helpers.rb
Constant Summary collapse
- ESCAPE_MAP =
{ '\\' => '\\\\', '</' => '<\/', "\r\n" => '\n', "\n" => '\n', "\r" => '\n', '"' => '\\"', "'" => "\\'" }
- DEFAULT_TEMPLATE =
<<-eos <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html> <html> <head> <b:skin></b:skin> </head> <body> <b:section id='main'> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </b:section> </body> </html> eos
Instance Method Summary collapse
Instance Method Details
#default_template ⇒ Object
29 30 31 |
# File 'lib/blogger/helpers.rb', line 29 def default_template escape_template(DEFAULT_TEMPLATE) end |
#escape_template(template) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/blogger/helpers.rb', line 6 def escape_template(template) if template template.gsub(/(\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"'])/u) {|match| ESCAPE_MAP[match] } else '' end end |