markup-preview 0.1.0 → 0.2.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/markup-preview +17 -12
  3. data/lib/index.erb +8 -0
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 697c2fc614c5266c436ca6636ce45d6a0f1b72bd
4
- data.tar.gz: 85b66297018a7f5c52f0490a7a8462136303f879
3
+ metadata.gz: c805db4bb5f26d7a36fb563b8d41c86a2919e944
4
+ data.tar.gz: 67a5a1a44f65753209411f89d41802df0d26588c
5
5
  SHA512:
6
- metadata.gz: 36e0abffd69e8d595e888a8b914d7f0ddfc751191cbfdaeb70f1169fe221ce472fa59646240019c57bb4524403aacde0cd7cf2d30c598dba6a76f61549575318
7
- data.tar.gz: 2adf47ee5ae12df359319349fbe25c179f9294e27a8766e031ca4d396ca569ef703465337c23e1e1131cc395ef5e114d8401a95459370fc67ef778c63b59f886
6
+ metadata.gz: 394ce5fbaca5fdc65d9834fb149a81d2b388743b30953f0822dabd44cf6c45a748172a2e0e059b402a8c8a4bdcb6f40382d4f6d8fd7730276571bfab4f4b784f
7
+ data.tar.gz: 05132752e229ebd3148f3e9ab18806e79a7c26e481f726a427f2e6eaf4ce8fd7b560d26bc295dca3a0c250cd93282a1872bc90a41533c9c216b0336a07008201
@@ -7,18 +7,23 @@ require "erb"
7
7
  require "ostruct"
8
8
 
9
9
  root = ARGV[0]
10
- app = Rack::Cascade.new [Rack::File.new("public"), lambda { |env|
10
+ tpl = ERB.new(File.read __dir__+"/../lib/index.erb")
11
+
12
+ app = lambda { |env|
11
13
  req = Rack::Request.new(env)
12
- markup = root+req.path
14
+ markup = File.expand_path(root+req.path)
13
15
 
14
- html = GitHub::Markup.render markup, File.read(markup)
15
- [
16
- 200,
17
- {
18
- "Content-Type" => "text/html"
19
- },
20
- [ERB.new(File.read "index.erb").result(OpenStruct.new(:output => html).instance_eval { binding })]
21
- ]
22
- }]
16
+ output = GitHub::Markup.render markup, File.read(markup)
17
+ args = OpenStruct.new(:output => output).instance_eval { binding }
18
+ html = tpl.result args
19
+
20
+ [200, {"Content-Type" => "text/html"}, [html]]
21
+ }
23
22
 
24
- Rack::Server.start :app => app, :Port => 9292
23
+ Rack::Server.start({
24
+ :app => Rack::Cascade.new([
25
+ Rack::File.new("public"),
26
+ Rack::ShowExceptions.new(app)
27
+ ]),
28
+ :Port => 9293
29
+ })
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <link rel="stylesheet" type="text/css" href="/github.css">
4
+ </head>
5
+ <body>
6
+ <%= output %>
7
+ </body>
8
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markup-preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Fisher
@@ -17,6 +17,7 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - lib/index.erb
20
21
  - bin/markup-preview
21
22
  homepage: https://github.com/mbfisher/markup-preview
22
23
  licenses: []