Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: krohrbaugh/rack-pygmoku
base: 52a448360e
...
head fork: krohrbaugh/rack-pygmoku
compare: 8ef8c473c0
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Feb 13, 2012
@rwdaigle rwdaigle Add gemspec to repo e66bcaa
Commits on Feb 14, 2012
@rwdaigle rwdaigle Recognize highlight element and lexer attr from options 23bfbf7
Commits on Feb 17, 2012
@krohrbaugh Merge pull request #1 from rwdaigle/master
Better gem support when referencing git repo directly and recognition of lexer options.
8ef8c47
Showing with 91 additions and 7 deletions.
  1. +3 −7 lib/rack/pygmoku.rb
  2. +88 −0 rack-pygmoku.gemspec
View
10 lib/rack/pygmoku.rb
@@ -33,7 +33,7 @@ def highlight?(status, headers)
def highlight(content)
require 'pygments'
- element = 'pre>code'
+ element = @opts[:element]
document = Nokogiri::HTML(content, nil, 'utf-8')
nodes = document.css(element)
@@ -51,13 +51,9 @@ def highlight(content)
end
def get_lexer(node)
- attributes = %w(data-lexer data-lang)
+ attribute = @opts[:lexer_attr]
lexer = 'html'
-
- attributes.each do |attribute|
- lexer = node[attribute] if node.has_attribute?(attribute)
- end
-
+ lexer = node[attribute] if node.has_attribute?(attribute)
lexer
end
View
88 rack-pygmoku.gemspec
@@ -0,0 +1,88 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{rack-pygmoku}
+ s.version = "0.1.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Kevin Rohrbaugh"]
+ s.date = %q{2012-02-12}
+ s.description = %q{Rack middleware for Pygments use in environments you cannot install Pygments directly (e.g., Heroku).}
+ s.email = %q{kevin@rohrbaugh.us}
+ s.extra_rdoc_files = [
+ "LICENSE.txt",
+ "README.markdown"
+ ]
+ s.files = [
+ ".document",
+ "CHANGELOG",
+ "Gemfile",
+ "Gemfile.lock",
+ "LICENSE.txt",
+ "README.markdown",
+ "Rakefile",
+ "lib/rack/pygmoku.rb",
+ "lib/rack/pygmoku/version.rb",
+ "spec/lib/rack/pygmoku/version_spec.rb",
+ "spec/lib/rack/pygmoku_spec.rb",
+ "spec/spec_helper.rb",
+ "spec/support/html_helper.rb"
+ ]
+ s.homepage = %q{http://github.com/krohrbaugh/rack-pygmoku}
+ s.licenses = ["MIT"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.5.0}
+ s.summary = %q{Rack middleware for Pygments-based syntax highlighting}
+ s.test_files = [
+ "spec/lib/rack/pygmoku/version_spec.rb",
+ "spec/lib/rack/pygmoku_spec.rb",
+ "spec/spec_helper.rb",
+ "spec/support/html_helper.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4"])
+ s.add_runtime_dependency(%q<pygments.rb>, ["~> 0.1"])
+ s.add_runtime_dependency(%q<rack>, [">= 0"])
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
+ s.add_development_dependency(%q<rcov>, [">= 0"])
+ s.add_development_dependency(%q<watchr>, [">= 0"])
+ s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4"])
+ s.add_runtime_dependency(%q<pygments.rb>, ["~> 0"])
+ s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
+ else
+ s.add_dependency(%q<nokogiri>, ["~> 1.4"])
+ s.add_dependency(%q<pygments.rb>, ["~> 0.1"])
+ s.add_dependency(%q<rack>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
+ s.add_dependency(%q<rcov>, [">= 0"])
+ s.add_dependency(%q<watchr>, [">= 0"])
+ s.add_dependency(%q<nokogiri>, ["~> 1.4"])
+ s.add_dependency(%q<pygments.rb>, ["~> 0"])
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
+ end
+ else
+ s.add_dependency(%q<nokogiri>, ["~> 1.4"])
+ s.add_dependency(%q<pygments.rb>, ["~> 0.1"])
+ s.add_dependency(%q<rack>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
+ s.add_dependency(%q<rcov>, [">= 0"])
+ s.add_dependency(%q<watchr>, [">= 0"])
+ s.add_dependency(%q<nokogiri>, ["~> 1.4"])
+ s.add_dependency(%q<pygments.rb>, ["~> 0"])
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
+ end
+end
+

No commit comments for this range

Something went wrong with that request. Please try again.