/itexToMML

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/itexToMML/

« back to all changes in this revision

Viewing changes to itex-src/itex_stringsupport.rb

  • Committer: Jacques Distler
  • Date: 2010-07-20 18:05:52 UTC
  • Revision ID: distler@golem.ph.utexas.edu-20100720180552-wcgj1yhgixq65d1e
Tags: 1.3.26
itex2MML 1.3.26

Fix \sslash (thanks to Toby Bartels).
Small refactoring in Ruby implementation.

Show diffs side-by-side

added added

removed removed

2308
2308
 
2309
2309
#:stopdoc:
2310
2310
 
 
2311
    TO_ESCAPE = {
 
2312
      '&' => '&',
 
2313
      '<' => '&lt;',
 
2314
      '>' => '&gt;',
 
2315
      "'" => '&#39;',
 
2316
      '"' => '&quot;',
 
2317
    }
 
2318
    TO_ESCAPE_PATTERN = Regexp.union(TO_ESCAPE.keys)
 
2319
    
2311
2320
    def escapeHTML
2312
 
            self.gsub( /&/, "&amp;" ).
2313
 
             gsub( /</, "&lt;" ).
2314
 
             gsub( />/, "&gt;" ).
2315
 
             gsub(/'/, "&#39;" ).
2316
 
             gsub(/"/, "&quot;" )
 
2321
      self.gsub(TO_ESCAPE_PATTERN){|m| TO_ESCAPE[m]}
2317
2322
    end
2318
2323
    
2319
2324
    def unescapeHTML