Module: TmSyntaxHighlighting::Helper
- Defined in:
- lib/tm_syntax_highlighting.rb
Instance Method Summary collapse
Instance Method Details
#code(code, options = {}) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/tm_syntax_highlighting.rb', line 3 def code(code, = {}) = TmSyntaxHighlighting.defaults.merge_with() TmSyntaxHighlighting.defaults[:current_themes] << [:theme] [:lang] = "plain_text" unless Uv.syntaxes.include?([:lang]) Uv.parse(code, "xhtml", [:lang], [:line_numbers], [:theme]) end |
#syntax_css(theme = nil) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/tm_syntax_highlighting.rb', line 10 def syntax_css(theme = nil) themes = [theme || TmSyntaxHighlighting.defaults.[:theme]].flatten themes = (themes & TmSyntaxHighlighting.defaults[:current_themes]) if theme.nil? && TmSyntaxHighlighting.defaults[:current_themes] themes.uniq.collect do |theme| stylesheet_link_tag "syntax/#{theme}" end.join("\n") end |