rack-footnotes 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ require "rack"
2
2
 
3
3
  class Rack::FootNotes
4
4
 
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
 
7
7
  def initialize(app, options = {}, &block)
8
8
  @app = app
@@ -17,11 +17,13 @@ class Rack::FootNotes
17
17
  def call(env)
18
18
  status, headers, body = @app.call(env)
19
19
 
20
- route = env['PATH_INFO']
21
- file = Dir.pwd + "/#{@options[:notes_path]}" + route.gsub(/\/$/,'') + '.txt'
22
- if File.exists?(file)
23
- note = File.readlines(file).to_s
24
- body.body.gsub!("</body>","<div id='racknotes'>#{note}</div><style>#racknotes { #{@options[:css]} #{@options[:extra_css]} }</style></body>")
20
+ if headers['Content-Type'] == 'text/html'
21
+ route = env['PATH_INFO']
22
+ file = Dir.pwd + "/#{@options[:notes_path]}" + route.gsub(/\/$/,'') + '.txt'
23
+ if File.exists?(file)
24
+ note = File.readlines(file).to_s
25
+ body.body.to_s.gsub!("</body>","<div id='racknotes'>#{note}</div><style>#racknotes { #{@options[:css]} #{@options[:extra_css]} }</style></body>")
26
+ end
25
27
  end
26
28
 
27
29
  @response = Rack::Response.new(body, status, headers)
@@ -1,6 +1,8 @@
1
+ require 'lib/rack/footnotes'
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = %q{rack-footnotes}
3
- s.version = "0.0.1"
5
+ s.version = Rack::FootNotes::VERSION
4
6
 
5
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
8
  s.authors = ["Ale Muñoz"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-footnotes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Ale Mu\xC3\xB1oz"