albeano 1.0.0 → 1.1.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.
- data/README.md +23 -0
- data/lib/albeano.rb +4 -1
- metadata +6 -25
data/README.md
CHANGED
@@ -26,3 +26,26 @@ You can even have it return markdown. Just make sure you have
|
|
26
26
|
|
27
27
|
Albeano.new(text).to_markdown
|
28
28
|
Albeano.new(text).to_markdown(:smart, :filter_html)
|
29
|
+
|
30
|
+
### Rails 3
|
31
|
+
|
32
|
+
You can easily incorporate Albeano into your existing Rails applications, just
|
33
|
+
add `albeano` to your Gemfile.
|
34
|
+
|
35
|
+
You can then add a method do your models (assuming `body` contains the
|
36
|
+
body of your post or text):
|
37
|
+
|
38
|
+
class Post < ActiveRecord::Base
|
39
|
+
def content
|
40
|
+
Albeano.generate(body)
|
41
|
+
end
|
42
|
+
|
43
|
+
# with markdown
|
44
|
+
def content
|
45
|
+
Albeano.new(body).to_markdown
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
You can of course use these methods inside of your views, too. Remember to
|
50
|
+
use the `html_safe` method before rendering your markup, otherwise your HTML
|
51
|
+
will be escaped and rendered as entities.
|
data/lib/albeano.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'albino'
|
2
2
|
|
3
3
|
class Albeano
|
4
|
-
VERSION = '1.
|
4
|
+
VERSION = '1.1.0'
|
5
5
|
|
6
6
|
def self.generate(text)
|
7
7
|
new(text).generate
|
@@ -16,6 +16,7 @@ class Albeano
|
|
16
16
|
@markdown = nil
|
17
17
|
end
|
18
18
|
|
19
|
+
# @return [String] Newly generated Albino markup
|
19
20
|
def generate
|
20
21
|
@text.gsub(/\[code(?:=(.+?))?\]\s*(.+?)\s*\[\/code\]/m) do
|
21
22
|
Albino.colorize($2, $1 || :text)
|
@@ -24,6 +25,8 @@ class Albeano
|
|
24
25
|
|
25
26
|
alias :to_s :generate
|
26
27
|
|
28
|
+
# @raise [LoadError] Raised when unable to load RDiscount
|
29
|
+
# @return [String] The newly generated markup
|
27
30
|
def to_markdown(*extensions)
|
28
31
|
begin
|
29
32
|
require 'rdiscount'
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: albeano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 1.0.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.1.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Lee Jarvis
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
13
|
+
date: 2011-05-20 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: albino
|
@@ -23,12 +18,9 @@ dependencies:
|
|
23
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
19
|
none: false
|
25
20
|
requirements:
|
26
|
-
- -
|
21
|
+
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 1
|
30
|
-
- 0
|
31
|
-
version: "1.0"
|
23
|
+
version: 1.3.3
|
32
24
|
type: :runtime
|
33
25
|
version_requirements: *id001
|
34
26
|
- !ruby/object:Gem::Dependency
|
@@ -39,10 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - "="
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 2
|
44
|
-
- 1
|
45
|
-
- 0
|
46
34
|
version: 2.1.0
|
47
35
|
type: :development
|
48
36
|
version_requirements: *id002
|
@@ -59,7 +47,6 @@ files:
|
|
59
47
|
- README.md
|
60
48
|
- lib/albeano.rb
|
61
49
|
- spec/albeano_spec.rb
|
62
|
-
has_rdoc: true
|
63
50
|
homepage:
|
64
51
|
licenses: []
|
65
52
|
|
@@ -73,23 +60,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
60
|
requirements:
|
74
61
|
- - ">="
|
75
62
|
- !ruby/object:Gem::Version
|
76
|
-
segments:
|
77
|
-
- 1
|
78
|
-
- 8
|
79
|
-
- 6
|
80
63
|
version: 1.8.6
|
81
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
65
|
none: false
|
83
66
|
requirements:
|
84
67
|
- - ">="
|
85
68
|
- !ruby/object:Gem::Version
|
86
|
-
segments:
|
87
|
-
- 0
|
88
69
|
version: "0"
|
89
70
|
requirements: []
|
90
71
|
|
91
72
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.8.2
|
93
74
|
signing_key:
|
94
75
|
specification_version: 3
|
95
76
|
summary: BBCode style wrapper for Pygments
|