Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Switching README to use markdown.

  • Loading branch information...
commit 733ceab4e5d9bccdfacb92bf5a24b43ffd591dcf 1 parent e9a3150
Wyatt Greene authored

Showing 1 changed file with 17 additions and 14 deletions. Show diff stats Hide diff stats

  1. +17 14 README.rdoc → README.md
31 README.rdoc → README.md
Source Rendered
... ... @@ -1,25 +1,25 @@
1   -= Rack::Plastic
  1 +# Rack::Plastic
2 2
3   -== Description
  3 +## Description
4 4
5 5 If you are creating Rack middleware that changes the HTML response, use
6 6 Rack::Plastic to get a head start. Rack::Plastic takes care of the
7 7 boilerplate Rack glue so that you can focus on simply changing the HTML.
8 8
9   -== Usage
  9 +## Usage
10 10
11 11 There are two ways you can change the HTML: as a Nokogiri document or as
12 12 a string. Simply define one of the following methods:
13 13
14   - def change_nokogiri_doc(doc)
15   - ... insert code that changes the doc ...
16   - doc
17   - end
  14 + def change_nokogiri_doc(doc)
  15 + ... insert code that changes the doc ...
  16 + doc
  17 + end
18 18
19   - def change_html_string(html)
20   - ... insert code that changes the html string ...
21   - html
22   - end
  19 + def change_html_string(html)
  20 + ... insert code that changes the html string ...
  21 + html
  22 + end
23 23
24 24 If you define both methods, change_nokogiri_doc will be called first, then
25 25 the doc will be converted to an HTML string, then the string will be
@@ -28,18 +28,18 @@ passed to change_html_string.
28 28 Rack::Plastic also provides some convenience methods for interacting with
29 29 Rack and Nokogiri as well as some convenience methods for testing.
30 30
31   -== Examples
  31 +## Examples
32 32
33 33 The examples/middlewares directory has examples of writing middleware using
34 34 Rack::Plastic.
35 35
36   -== Rails Streaming
  36 +## Rails Streaming
37 37
38 38 This middleware is not compatible with Rails HTTP streaming. According to [Railscast #266](http://asciicasts.com/episodes/266-http-streaming):
39 39 "Also, streaming is incompatible with some middleware. If the middleware modifies the response
40 40 then it will not work with streaming."
41 41
42   -== Testing
  42 +## Testing
43 43
44 44 Rack::Plastic comes with some test helpers that make it easier for you to
45 45 write tests for your Rack middleware. Refer to the documentation for
@@ -50,16 +50,19 @@ but it provides manual tests. Each of the example middlewares is inserted into
50 50 Sinatra, Rails, and Rack test app.
51 51
52 52 To run the Rails test app:
  53 +
53 54 * cd examples/railsapp
54 55 * script/server
55 56 * point your browser to http://localhost:3000
56 57
57 58 To run the Sinatra test app:
  59 +
58 60 * cd examples/sinatraapp
59 61 * ruby app.rb
60 62 * point your browser to http://localhost:4567
61 63
62 64 To run the Rack test app:
  65 +
63 66 * cd examples/rackapp
64 67 * rackup config.ru
65 68 * point your browser to http://localhost:9292

0 comments on commit 733ceab

Please sign in to comment.
Something went wrong with that request. Please try again.