Class: Rouge::Formatters::HTMLInline

Inherits:
HTML show all
Defined in:
lib/rouge/formatters/html_inline.rb

Constant Summary

Constants inherited from Rouge::Formatter

Rouge::Formatter::REGISTRY

Instance Method Summary collapse

Methods inherited from HTML

#span, #stream

Methods inherited from Rouge::Formatter

find, #format, format, #render, #stream, tag

Constructor Details

#initialize(theme) ⇒ HTMLInline

Returns a new instance of HTMLInline.


8
9
10
# File 'lib/rouge/formatters/html_inline.rb', line 8

def initialize(theme)
  @theme = theme
end

Instance Method Details

#safe_span(tok, safe_val) ⇒ Object


12
13
14
15
16
17
18
# File 'lib/rouge/formatters/html_inline.rb', line 12

def safe_span(tok, safe_val)
  return safe_val if tok == Token::Tokens::Text

  rules = @theme.style_for(tok).rendered_rules

  "<span style=\"#{rules.to_a.join(';')}\">#{safe_val}</span>"
end