markview 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  Markview
2
2
  ========
3
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).
4
+ Markview allows you to view nearly any and all markup formatted files in a slick way. Markview is
5
+ inspired by the python library [restview](http://mg.pov.lt/restview/). As of v0.2.0, I've decided
6
+ to extend markview to render virtually any and all markup formatted README's or what-have-you using
7
+ the [github-markup](http://github.com/defunkt/github-markup) library.
8
8
 
9
9
  Install
10
10
  -------
@@ -17,7 +17,7 @@ Usage
17
17
  -----
18
18
 
19
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
20
+ a README or other markup file. Markview defaults to finding a README if you choose not to
21
21
  specify the file.
22
22
 
23
23
  $ markview README.md
@@ -21,46 +21,48 @@ body,input,textarea { font-family:HelveticaNeue,'Helvetica Neue',Helvetica,Arial
21
21
  a { color:#2e80d3; text-decoration:none; }
22
22
  a:hover { text-decoration:underline; }
23
23
 
24
+ p#file {font-size:150%;}
25
+
24
26
  div#content {margin:2% auto; position:relative; width:60%; }
25
27
  div#content > div { float:left; }
26
- div#content div#markdown-output { border: 1px solid #E9E9E9; background:#F8F8F8; padding:5%; overflow-y:auto; }
28
+ div#content div#markview-output { border: 1px solid #E9E9E9; background:#F8F8F8; padding:5%; overflow-y:auto; }
27
29
 
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}
30
+ .markview * { line-height:1.4em; }
31
+ .markview em { background-color:#fffeca; padding:0 0.08em;}
32
+ .markview i{font-style:italic}
33
+ .markview strong,.markview b{font-weight:bold}
34
+ .markview abbr{border-bottom:1px dashed;cursor:help}
35
+ .markview small{font-size:0.8em}
34
36
 
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%}
37
+ .markview h1,.markview h2,.markview h3,.markview h4,.markview h5,.markview h6{margin-bottom:0.5em}
38
+ .markview h1{font-size:170%;font-weight:bold}
39
+ .markview h2{font-size:150%;font-weight:bold}
40
+ .markview h3{color:#555;font-size:110%;font-weight:bold}
41
+ .markview h4{color:#777;font-weight:bold}
42
+ .markview h5{color:#777}
43
+ .markview h6{color:#777;font-size:90%}
42
44
 
43
- .markdown a{text-decoration:underline}
44
- .markdown p{line-height:1.5em;margin:0 0 1em}
45
+ .markview a{text-decoration:underline}
46
+ .markview p{line-height:1.5em;margin:0 0 1em}
45
47
 
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}
48
+ .markview ul ul,.markview ol ol{margin-bottom:0;margin-top:0}
49
+ .markview ul,.markview ol{margin:0 0 2em 0.5em}
50
+ .markview ul li,.markview ol li{margin-left:1em}
51
+ .markview ul li{list-style:disc}
52
+ .markview ol li{list-style:decimal}
51
53
 
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
+ .markview blockquote{border-left:5px solid #ddd;color:#555;margin:0 0 1em;padding-left:0.6em}
55
+ .markview dt{font-weight:bold;margin-left:1em}.markview dd{margin-bottom:1em;margin-left:2em}
54
56
 
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}
57
+ .markview table{margin:0 0 1em;width:100%}
58
+ .markview table th{background:#eee;border-bottom:1px solid #bbb;padding:0.2em 1em}
59
+ .markview table td{border-bottom:1px solid #ddd;padding:0.2em 1em}
58
60
 
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}
61
+ .markview 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}
62
+ .markview pre code{background-color:#f8f8ff;border:medium none;font-size:100%;padding:0}
63
+ .markview code{font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono';background-color:#f8f8ff;border:1px solid #dedede;color:#444;font-size:90%;padding:0 0.2em}
62
64
 
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};
65
+ .markview pre.console{background-color:#000;color:white;font-size:90%;line-height:1.5em;margin:0 0 1em;padding:0.5em}
66
+ .markview pre.console code{background-color:#000;border:medium none;color:#fff;font-size:100%;padding:0}
67
+ .markview pre.console span{color:#888}
68
+ .markview pre.console span.command{color:yellow};
@@ -6,8 +6,9 @@
6
6
  <link rel="stylesheet" href="/style.css" type="text/css" media="screen" charset="utf-8">
7
7
  </head>
8
8
  <body>
9
- <div id="content" class="clear">
10
- <div id="markdown-output" class="markdown">
9
+ <div id="content" class="clear">
10
+ <p id="file"><%= @title %></p>
11
+ <div id="markview-output" class="markview">
11
12
  <%= @markdown %>
12
13
  </div>
13
14
  </div>
data/lib/markview.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $:.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
2
2
 
3
3
  require 'sinatra'
4
- require 'rdiscount'
4
+ require 'github/markup'
5
5
 
6
6
  module Markview
7
7
  class Application < Sinatra::Base
@@ -10,19 +10,20 @@ module Markview
10
10
  set :views, "#{dir}/markview/views"
11
11
  set :public, "#{dir}/markview/public"
12
12
  set :static, true
13
-
13
+
14
14
  # Renders the html using RDiscount
15
15
  def self.markdown_me
16
- ARGV[0] ||= Dir.glob("*.{md,markdown}")[0];
16
+ ARGV[0] ||= Dir.glob("README*")[0]
17
17
  begin
18
- RDiscount.new( File.open("#{ARGV[0]}", 'r').read ).to_html
18
+ GitHub::Markup.render(ARGV[0], File.read(ARGV[0]))
19
19
  rescue Errno::ENOENT
20
20
  raise LoadError, "Failed open document. Please specify a file."; exit
21
21
  end
22
22
  end
23
23
 
24
24
  get '/' do
25
- @markdown = Markview::Application.markdown_me
25
+ @markdown = Application.markdown_me
26
+ @title = ARGV[0]
26
27
  erb :base
27
28
  end
28
29
  end
data/test/render_test.rb CHANGED
@@ -6,12 +6,12 @@ class RenderTest < Test::Unit::TestCase
6
6
 
7
7
  test "renders given file" do
8
8
  ARGV[0] = 'README.md'
9
- assert_equal RDiscount.new(File.read(ARGV[0])).to_html, Markview::Application.markdown_me
9
+ assert_equal GitHub::Markup.render(ARGV[0], File.read(ARGV[0])), Markview::Application.markdown_me
10
10
  end
11
11
 
12
12
  test "renders discovered file" do
13
- ARGV[0] = Dir.glob("*.{md,markdown}")[0]
14
- assert_equal RDiscount.new(File.read(ARGV[0])).to_html, Markview::Application.markdown_me
13
+ ARGV[0] = Dir.glob("README*")[0]
14
+ assert_equal GitHub::Markup.render(ARGV[0], File.read(ARGV[0])), Markview::Application.markdown_me
15
15
  end
16
16
 
17
17
  test "no markdown file given or found raises error" do
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Mark Sands
@@ -9,60 +14,80 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-27 00:00:00 -06:00
17
+ date: 2010-03-03 00:00:00 -06:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: vegas
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 1
30
+ - 4
23
31
  version: 0.1.4
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: sinatra
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 9
44
+ - 4
33
45
  version: 0.9.4
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: rdiscount
37
46
  type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: github-markup
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
43
- version: 1.5.8
44
- version:
55
+ segments:
56
+ - 0
57
+ - 2
58
+ - 2
59
+ version: 0.2.2
60
+ type: :runtime
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: contest
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ">="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ - 1
72
+ - 2
53
73
  version: 0.1.2
54
- version:
74
+ type: :development
75
+ version_requirements: *id004
55
76
  - !ruby/object:Gem::Dependency
56
77
  name: turn
57
- type: :development
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
60
80
  requirements:
61
81
  - - ">="
62
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
85
+ - 7
86
+ - 0
63
87
  version: 0.7.0
64
- version:
65
- description: Conveniently launches markdown formatted files in a browser, rendering on the fly.
88
+ type: :development
89
+ version_requirements: *id005
90
+ description: Conveniently launches practically any markup formatted files in a browser, rendering on the fly.
66
91
  email: marksands07@gmail.com
67
92
  executables:
68
93
  - markview
@@ -90,20 +115,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
115
  requirements:
91
116
  - - ">="
92
117
  - !ruby/object:Gem::Version
118
+ segments:
119
+ - 0
93
120
  version: "0"
94
- version:
95
121
  required_rubygems_version: !ruby/object:Gem::Requirement
96
122
  requirements:
97
123
  - - ">="
98
124
  - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
99
127
  version: "0"
100
- version:
101
128
  requirements: []
102
129
 
103
130
  rubyforge_project:
104
- rubygems_version: 1.3.5
131
+ rubygems_version: 1.3.6
105
132
  signing_key:
106
133
  specification_version: 3
107
- summary: A markdown viewer that renders on the fly.
134
+ summary: A markup viewer that renders on the fly.
108
135
  test_files:
109
136
  - test/render_test.rb