markview 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +28 -0
- data/bin/markview +10 -0
- data/lib/markview.rb +32 -0
- data/lib/static/style.css +66 -0
- data/lib/views/base.erb +15 -0
- metadata +87 -0
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Markview
|
2
|
+
========
|
3
|
+
|
4
|
+
Markview allows you to view markdown formatted files in a slick way. Markview is
|
5
|
+
inspired by the python library [restview](http://mg.pov.lt/restview/). This gem
|
6
|
+
is made possible by [Ryan Tomayko](http://github.com/rtomayko)'s [RDiscount](http://github.com/rtomayko/rdiscount) and
|
7
|
+
[samsoffes](http://github.com/samsoffes) and his brilliant [markdownr](http://github.com/samsoffes/markdownr.com).
|
8
|
+
|
9
|
+
Install
|
10
|
+
-------
|
11
|
+
|
12
|
+
New releases of Markview are published to [gemcutter](http://gemcutter.org/gems/markview)
|
13
|
+
|
14
|
+
$ [sudo] gem install markview
|
15
|
+
|
16
|
+
Usage
|
17
|
+
-----
|
18
|
+
|
19
|
+
Markview is very simple to use. Run the gem from the command line and specify
|
20
|
+
the README. Markview is smart enough to find the README if you choose not to
|
21
|
+
specify the file.
|
22
|
+
|
23
|
+
$ markview README.md
|
24
|
+
|
25
|
+
Author
|
26
|
+
------
|
27
|
+
|
28
|
+
[Mark Sands](http://github.com/marksands) :: marksands07@gmail.com
|
data/bin/markview
ADDED
data/lib/markview.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
$:.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
|
2
|
+
|
3
|
+
require 'sinatra'
|
4
|
+
require 'rdiscount'
|
5
|
+
|
6
|
+
module Markview
|
7
|
+
class Application < Sinatra::Base
|
8
|
+
|
9
|
+
set :views, File.expand_path(File.dirname(__FILE__)) + '/views'
|
10
|
+
set :public, File.expand_path(File.dirname(__FILE__)) + '/static'
|
11
|
+
|
12
|
+
def markdown_me
|
13
|
+
ARGV[0] ||= Dir.glob("*.{md,markdown}")[0]; mdown=""
|
14
|
+
begin
|
15
|
+
File.open("#{ARGV[0]}", "r") { |f|
|
16
|
+
f.each_line do |line|
|
17
|
+
mdown += line
|
18
|
+
end
|
19
|
+
}
|
20
|
+
rescue Errno::ENOENT
|
21
|
+
raise "Failed to load README. Please specify a file."
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
RDiscount.new(mdown).to_html
|
25
|
+
end
|
26
|
+
|
27
|
+
get '/' do
|
28
|
+
@markdown = markdown_me
|
29
|
+
erb :base
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,
|
2
|
+
acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,
|
3
|
+
strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,
|
4
|
+
tbody,tfoot,thead,tr,th,td { margin:0; padding:0; border:0; outline:0;
|
5
|
+
font-weight:inherit; font-style:inherit; font-size:100%;
|
6
|
+
font-family:inherit; vertical-align:baseline; }
|
7
|
+
|
8
|
+
body { line-height:1; color:black; background: white; }
|
9
|
+
ol,ul { list-style:none; }
|
10
|
+
table { border-collapse:separate; border-spacing:0; }
|
11
|
+
caption,th,td { text-align:left; font-weight:normal; }
|
12
|
+
blockquote:before,blockquote:after,q:before,q:after { content:""; }
|
13
|
+
blockquote,q { quotes:"" ""; }
|
14
|
+
|
15
|
+
.clear:after { clear:both; content:""; display:block; height:0; zoom:1; }
|
16
|
+
|
17
|
+
body { background:#fff; font-size:15px; }
|
18
|
+
body * { line-height:1.4em; }
|
19
|
+
body,input,textarea { font-family:HelveticaNeue,'Helvetica Neue',Helvetica,Arial,sans-serif; color:#333; }
|
20
|
+
|
21
|
+
a { color:#2e80d3; text-decoration:none; }
|
22
|
+
a:hover { text-decoration:underline; }
|
23
|
+
|
24
|
+
div#content { margin: 0 auto; position:relative; }
|
25
|
+
div#content > div { float:left; }
|
26
|
+
div#content div#markdown-output { border:0px solid #999; background:#fff; padding:5% 20%; overflow-y:auto; }
|
27
|
+
|
28
|
+
.markdown * { line-height:1.4em; }
|
29
|
+
.markdown em { background-color:#fffeca; padding:0 0.08em;}
|
30
|
+
.markdown i{font-style:italic}
|
31
|
+
.markdown strong,.markdown b{font-weight:bold}
|
32
|
+
.markdown abbr{border-bottom:1px dashed;cursor:help}
|
33
|
+
.markdown small{font-size:0.8em}
|
34
|
+
|
35
|
+
.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5,.markdown h6{margin-bottom:0.5em}
|
36
|
+
.markdown h1{font-size:170%;font-weight:bold}
|
37
|
+
.markdown h2{font-size:150%;font-weight:bold}
|
38
|
+
.markdown h3{color:#555;font-size:110%;font-weight:bold}
|
39
|
+
.markdown h4{color:#777;font-weight:bold}
|
40
|
+
.markdown h5{color:#777}
|
41
|
+
.markdown h6{color:#777;font-size:90%}
|
42
|
+
|
43
|
+
.markdown a{text-decoration:underline}
|
44
|
+
.markdown p{line-height:1.5em;margin:0 0 1em}
|
45
|
+
|
46
|
+
.markdown ul ul,.markdown ol ol{margin-bottom:0;margin-top:0}
|
47
|
+
.markdown ul,.markdown ol{margin:0 0 2em 0.5em}
|
48
|
+
.markdown ul li,.markdown ol li{margin-left:1em}
|
49
|
+
.markdown ul li{list-style:disc}
|
50
|
+
.markdown ol li{list-style:decimal}
|
51
|
+
|
52
|
+
.markdown blockquote{border-left:5px solid #ddd;color:#555;margin:0 0 1em;padding-left:0.6em}
|
53
|
+
.markdown dt{font-weight:bold;margin-left:1em}.markdown dd{margin-bottom:1em;margin-left:2em}
|
54
|
+
|
55
|
+
.markdown table{margin:0 0 1em;width:100%}
|
56
|
+
.markdown table th{background:#eee;border-bottom:1px solid #bbb;padding:0.2em 1em}
|
57
|
+
.markdown table td{border-bottom:1px solid #ddd;padding:0.2em 1em}
|
58
|
+
|
59
|
+
.markdown pre{background-color:#f8f8ff;border:1px solid #dedede;color:#444;font-size:90%;line-height:1.5em;margin:0 0 1em;overflow:auto;padding:0.5em}
|
60
|
+
.markdown pre code{background-color:#f8f8ff;border:medium none;font-size:100%;padding:0}
|
61
|
+
.markdown code{background-color:#f8f8ff;border:1px solid #dedede;color:#444;font-size:90%;padding:0 0.2em}
|
62
|
+
|
63
|
+
.markdown pre.console{background-color:#000;color:white;font-size:90%;line-height:1.5em;margin:0 0 1em;padding:0.5em}
|
64
|
+
.markdown pre.console code{background-color:#000;border:medium none;color:#fff;font-size:100%;padding:0}
|
65
|
+
.markdown pre.console span{color:#888}
|
66
|
+
.markdown pre.console span.command{color:yellow};
|
data/lib/views/base.erb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
5
|
+
<title>Markview</title>
|
6
|
+
<link rel="stylesheet" href="/style.css" type="text/css" media="screen" charset="utf-8">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id="content" class="clear">
|
10
|
+
<div id="markdown-output" class="markdown">
|
11
|
+
<%= @markdown %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: markview
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Sands
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-24 00:00:00 -06:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: vegas
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.1.2
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sinatra
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.4
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rdiscount
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.5.8
|
44
|
+
version:
|
45
|
+
description:
|
46
|
+
email: marksands07@gmail.com
|
47
|
+
executables:
|
48
|
+
- markview
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files: []
|
52
|
+
|
53
|
+
files:
|
54
|
+
- README.md
|
55
|
+
- lib/markview.rb
|
56
|
+
- lib/static/style.css
|
57
|
+
- lib/views/base.erb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://github.com/marksands/markview
|
60
|
+
licenses: []
|
61
|
+
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 1.3.5
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: A markdown viewer that renders on the fly.
|
86
|
+
test_files: []
|
87
|
+
|