Method: HParser::Inline::Text#to_html
- Defined in:
- lib/hparser/html.rb
#to_html ⇒ Object
283 284 285 286 287 288 289 |
# File 'lib/hparser/html.rb', line 283 def to_html # escape < > & " except for HTML tag and HTML entity tag_regex = /(<\/?[a-z]+(?:\s[^>]+)?\/?>|&#\d+;|&#x[0-9a-z]+;|&[a-z]+;)/i self.text.split(tag_regex).map {|e| e.match(tag_regex) ? e : escape(e) }.join end |