gfm-preview 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
data/lib/gfm-preview/server.rb
CHANGED
@@ -13,12 +13,24 @@ module GfmPreview
|
|
13
13
|
file_path = path + req.path
|
14
14
|
file_name = File.basename(file_path)
|
15
15
|
content = GitHub::Markup.render(file_path)
|
16
|
-
open(File.join(File.dirname(__FILE__), '..', 'templates', '
|
16
|
+
open(File.join(File.dirname(__FILE__), '..', 'templates', 'markdown.html.erb')) { |file|
|
17
17
|
erb = ERB.new(file.read)
|
18
18
|
body = erb.result(binding)
|
19
19
|
res.body = body
|
20
20
|
res.content_type = 'text/html; charset=uft-8'
|
21
21
|
}
|
22
|
+
elsif req.path =~ /\.txt$/
|
23
|
+
file_path = path + req.path
|
24
|
+
file_name = File.basename(file_path)
|
25
|
+
open(file_path) { |file|
|
26
|
+
content = ERB::Util.html_escape(file.read)
|
27
|
+
open(File.join(File.dirname(__FILE__), '..', 'templates', 'text.html.erb')) { |file|
|
28
|
+
erb = ERB.new(file.read)
|
29
|
+
body = erb.result(binding)
|
30
|
+
res.body = body
|
31
|
+
res.content_type = 'text/html; charset=uft-8'
|
32
|
+
}
|
33
|
+
}
|
22
34
|
elsif req.path =~ /^\/gfm-preview\//
|
23
35
|
WEBrick::HTTPServlet::FileHandler.new(@server, File.join(File.dirname(__FILE__), '..', 'public')).service(req, res)
|
24
36
|
else
|
data/lib/gfm-preview/version.rb
CHANGED
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title><%= file_name %></title>
|
6
|
+
<link rel="stylesheet" href="/gfm-preview/bootstrap-combined.min.css" />
|
7
|
+
<link rel="stylesheet" href="/gfm-preview/markdown-body.css" />
|
8
|
+
<link rel="icon" type="image/vnd.microsoft.icon" href="/gfm-preview/favicon.ico">
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div class="container markdown-body">
|
12
|
+
<pre><%= content %></pre>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gfm-preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: github-markup
|
@@ -68,7 +68,8 @@ files:
|
|
68
68
|
- lib/public/gfm-preview/dirty-shade.png
|
69
69
|
- lib/public/gfm-preview/favicon.ico
|
70
70
|
- lib/public/gfm-preview/markdown-body.css
|
71
|
-
- lib/templates/
|
71
|
+
- lib/templates/markdown.html.erb
|
72
|
+
- lib/templates/text.html.erb
|
72
73
|
homepage: https://github.com/fujikky/gfm-preview
|
73
74
|
licenses: []
|
74
75
|
post_install_message:
|