Class: Facwparser::Element::A
- Inherits:
-
InlineElementBase
- Object
- ElementBase
- InlineElementBase
- Facwparser::Element::A
- Defined in:
- lib/facwparser/element.rb
Instance Attribute Summary
Attributes inherited from InlineElementBase
Attributes inherited from ElementBase
Instance Method Summary collapse
Methods inherited from InlineElementBase
Methods inherited from ElementBase
#==, #initialize, #render_text
Constructor Details
This class inherits a constructor from Facwparser::Element::InlineElementBase
Instance Method Details
#render_html(options) ⇒ Object
236 237 238 239 240 241 242 243 244 245 |
# File 'lib/facwparser/element.rb', line 236 def render_html() if @text =~ /\A(.+)\|((?:https?|ftp|file):.+)\z/ return '<a href="' + CGI.escapeHTML($2) +'">' + CGI.escapeHTML($1) + '</a>' elsif @text =~ /\A(?:https?|ftp|file):.+\z/ return '<a href="' + CGI.escapeHTML(@text) +'">' + CGI.escapeHTML(@text) + '</a>' else url_prefix = ( && ['url_prefix']) || '/' return '<a href="' + CGI.escapeHTML(url_prefix + @text) +'">' + CGI.escapeHTML(@text) + '</a>' end end |