hyperbolist-rack-codehighlighter 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -106,6 +106,11 @@ Ultraviolet:
106
106
  use Rack::Codehighlighter, :ultraviolet, :theme => "dawn", :lines => false,
107
107
  :element => "pre", :pattern => /\A:::(\w+)\s*(\n|
)/i, :logging => false
108
108
 
109
+ use Rack::Codehighlighter, :ultraviolet, :markdown => true,
110
+ :theme => "minimal_theme", :lines => false, :element => "pre>code",
111
+ :pattern => /\A:::([-_+\w]+)\s*(\n|
)/, :logging => false,
112
+ :themes => {"vibrant_ink" => ["ruby"], "upstream_sunburst" => ["objective-c", "java"]}
113
+
109
114
  Syntax:
110
115
 
111
116
  use Rack::Codehighlighter, :syntax,
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :build:
3
- :patch: 2
3
+ :patch: 3
4
4
  :major: 0
5
5
  :minor: 4
@@ -131,14 +131,16 @@ module Rack
131
131
  end
132
132
 
133
133
  def ultraviolet(string)
134
- opts = { :theme => 'dawn', :lines => false }
134
+ opts = { :theme => 'dawn', :lines => false, :themes => {} }
135
135
  opts.merge! @opts
136
136
  lang = 'text'
137
137
  refs = @opts[:pattern].match(string) # extract language name
138
138
  if refs
139
139
  lang = refs[1]
140
+ theme = opts[:themes].collect do |k,v|
141
+ k if v.include? lang end.compact.first || opts[:theme]
140
142
  str = unescape_html(string.sub(@opts[:pattern], ""))
141
- "#{::Uv.parse(str, 'xhtml', lang, opts[:lines], opts[:theme])}"
143
+ "#{::Uv.parse(str, 'xhtml', lang, opts[:lines], theme)}"
142
144
  else
143
145
  "<pre class='#{opts[:theme]}'>#{string}</pre>"
144
146
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperbolist-rack-codehighlighter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Sherman