glorify 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +107 -0
- data/lib/glorify/version.rb +1 -1
- metadata +4 -8
- data/LICENSE +0 -0
- data/example/app.rb +0 -23
- data/example/example.md +0 -14
- data/example/subclassed_app.rb +0 -32
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1 +1,108 @@
|
|
1
1
|
# glorify
|
2
|
+
|
3
|
+
Sinatra helper to parse markdown with syntax highlighting like the pros
|
4
|
+
|
5
|
+
Renders via redcarpet with syntax highlighting thanks to albino. Able to use
|
6
|
+
fenced code blocks like github, and includes a default pygments stylesheet.
|
7
|
+
|
8
|
+
## install
|
9
|
+
|
10
|
+
```bash
|
11
|
+
gem install glorify
|
12
|
+
```
|
13
|
+
or with bundler
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
# Gemfile
|
17
|
+
source :rubygems
|
18
|
+
gem 'sinatra'
|
19
|
+
gem 'glorify'
|
20
|
+
```
|
21
|
+
|
22
|
+
## usage
|
23
|
+
|
24
|
+
given the following `markdown` example
|
25
|
+
|
26
|
+
# a sip of glory
|
27
|
+
|
28
|
+
providing a sinatra helper, glorify lets you parse markdown with ease.
|
29
|
+
|
30
|
+
you can even parse code blocks, in any language you'd like. just like you can
|
31
|
+
with github flavored markdown. because glorify uses much of the same technology
|
32
|
+
as github, you can highlight code from nearly any language, without any extra
|
33
|
+
dependencies.
|
34
|
+
|
35
|
+
the snippet below will render a bit of some ruby with syntax highlighting.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
['toast', 'cheese', 'wine'].each { |food| print food.capitalize }
|
39
|
+
```
|
40
|
+
|
41
|
+
### classical app
|
42
|
+
|
43
|
+
simply `require 'glorify'` to use with a classic style sinatra app.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require 'sinatra'
|
47
|
+
require 'glorify'
|
48
|
+
require 'erb'
|
49
|
+
get '/' do
|
50
|
+
@example = File.open("#{File.dirname(__FILE__)}/example.md", "rb").read
|
51
|
+
erb :index
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
### modular app
|
56
|
+
|
57
|
+
you'll need to `register Sinatra::Glorify` in your sub-classed app, along with
|
58
|
+
`require 'glorify'`, to use with a modular style sinatra app.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
require 'sinatra/base'
|
62
|
+
require 'glorify'
|
63
|
+
require 'erb'
|
64
|
+
class SubclassedApp < Sinatra::Base
|
65
|
+
register Sinatra::Glorify
|
66
|
+
get '/' do
|
67
|
+
@example = File.open("#{File.dirname(__FILE__)}/example.md", "rb").read
|
68
|
+
erb :index
|
69
|
+
end
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
### the view
|
74
|
+
|
75
|
+
this is just a simple `erb` template, but you get the idea.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
<html>
|
79
|
+
<head>
|
80
|
+
<link rel="stylesheet" type="text/css" href="/pygments.css" />
|
81
|
+
</head>
|
82
|
+
<body>
|
83
|
+
<%= glorify @example %>
|
84
|
+
</body>
|
85
|
+
</html>
|
86
|
+
```
|
87
|
+
|
88
|
+
## license
|
89
|
+
|
90
|
+
```plaintext
|
91
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
92
|
+
of this software and associated documentation files (the 'Software'), to deal
|
93
|
+
in the Software without restriction, including without limitation the rights
|
94
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
95
|
+
copies of the Software, and to permit persons to whom the Software is
|
96
|
+
furnished to do so, subject to the following conditions:
|
97
|
+
|
98
|
+
The above copyright notice and this permission notice shall be included in
|
99
|
+
all copies or substantial portions of the Software.
|
100
|
+
|
101
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
102
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
103
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
104
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
105
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
106
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
107
|
+
THE SOFTWARE.
|
108
|
+
```
|
data/lib/glorify/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glorify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Zachary Scott
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-04-14 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: sinatra
|
@@ -87,12 +87,8 @@ extra_rdoc_files: []
|
|
87
87
|
files:
|
88
88
|
- .gitignore
|
89
89
|
- Gemfile
|
90
|
-
- LICENSE
|
91
90
|
- README.md
|
92
91
|
- Rakefile
|
93
|
-
- example/app.rb
|
94
|
-
- example/example.md
|
95
|
-
- example/subclassed_app.rb
|
96
92
|
- glorify.gemspec
|
97
93
|
- lib/glorify.rb
|
98
94
|
- lib/glorify/renderer.rb
|
data/LICENSE
DELETED
File without changes
|
data/example/app.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'sinatra'
|
3
|
-
require 'glorify'
|
4
|
-
require 'erb'
|
5
|
-
|
6
|
-
get '/' do
|
7
|
-
@example = File.open("#{File.dirname(__FILE__)}/example.md", "rb").read
|
8
|
-
erb :index
|
9
|
-
end
|
10
|
-
|
11
|
-
__END__
|
12
|
-
@@layout
|
13
|
-
<html>
|
14
|
-
<head>
|
15
|
-
<link rel="stylesheet" type="text/css" href="/pygments.css" />
|
16
|
-
</head>
|
17
|
-
<body>
|
18
|
-
<%= yield %>
|
19
|
-
</body>
|
20
|
-
</html>
|
21
|
-
|
22
|
-
@@index
|
23
|
-
<%= glorify @example %>
|
data/example/example.md
DELETED
data/example/subclassed_app.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'sinatra/base'
|
3
|
-
require 'glorify'
|
4
|
-
require 'erb'
|
5
|
-
|
6
|
-
class SubclassedApp < Sinatra::Base
|
7
|
-
register Sinatra::Glorify
|
8
|
-
|
9
|
-
set :views, File.dirname(__FILE__)
|
10
|
-
enable :inline_templates
|
11
|
-
|
12
|
-
get '/' do
|
13
|
-
@example = File.open("#{File.dirname(__FILE__)}/example.md", "rb").read
|
14
|
-
erb :index
|
15
|
-
end
|
16
|
-
|
17
|
-
run! if app_file == $0
|
18
|
-
end
|
19
|
-
|
20
|
-
__END__
|
21
|
-
@@layout
|
22
|
-
<html>
|
23
|
-
<head>
|
24
|
-
<link rel="stylesheet" type="text/css" href="/pygments.css" />
|
25
|
-
</head>
|
26
|
-
<body>
|
27
|
-
<%= yield %>
|
28
|
-
</body>
|
29
|
-
</html>
|
30
|
-
|
31
|
-
@@index
|
32
|
-
<%= glorify @example %>
|