Module: TmSyntaxHighlighting::Helper
- Defined in:
- lib/tm_syntax_highlighting/base.rb
Instance Method Summary collapse
Instance Method Details
#code(code, options = {}) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/tm_syntax_highlighting/base.rb', line 3 def code(code, = {}) = TmSyntaxHighlighting.defaults.merge_with() TmSyntaxHighlighting.defaults[:current_themes] << [:theme] [:lang] = "text.plain" 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/base.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 |