bbcode-rails 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -3
- data/lib/bbcode-rails.rb +10 -0
- data/lib/bbcode-rails/tag.rb +2 -0
- data/lib/bbcode-rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85c25fceeb4fbc1b4c93491384ef5af2d867587d
|
4
|
+
data.tar.gz: 23873eb57b191664b7b6afd60e6590841e888d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12894618783176fcb4053053aac63ebc69e3a6d81de7208d060cd6aa14253b5817378de929cc025f96f9255595ab6b6fae2188d846e99356507a898d4f4d2412
|
7
|
+
data.tar.gz: ee74932ca1193c89a6cc4898696f390134975376b475241c459cc9b3c76b0d3f61793588a8493ab5cc20e20261bdcb92b65538699493c73977c8f107e2cce326
|
data/README.md
CHANGED
@@ -32,9 +32,12 @@ Or install it yourself as:
|
|
32
32
|
## Usage
|
33
33
|
|
34
34
|
To keep developement simple and easy to understand all tag definitions are found
|
35
|
-
in `app/bbcode/`.
|
36
|
-
|
37
|
-
|
35
|
+
in `app/bbcode/`. It is one file per tag.
|
36
|
+
|
37
|
+
#### Note
|
38
|
+
|
39
|
+
While in development the tags are loaded on use, in production they are then
|
40
|
+
eager loaded.
|
38
41
|
|
39
42
|
### Creating a new tag
|
40
43
|
|
data/lib/bbcode-rails.rb
CHANGED
@@ -15,6 +15,16 @@ module BBCode
|
|
15
15
|
str.gsub!( '"', '"' )
|
16
16
|
str.gsub!( "'", ''' )
|
17
17
|
|
18
|
+
# For eager loading
|
19
|
+
if defined?(Rails) && Rails.env.development?
|
20
|
+
str.scan(/\[(\w+)(?:=.+)?\]/).each do |tagname|
|
21
|
+
begin
|
22
|
+
"#{tagname[0]}_tag".camelize.constantize
|
23
|
+
rescue NameError
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
18
28
|
@@tags.each do |t|
|
19
29
|
str.gsub!(t.regex) { t.instance.instance_exec($~, &t.block) }
|
20
30
|
end
|
data/lib/bbcode-rails/tag.rb
CHANGED
data/lib/bbcode-rails/version.rb
CHANGED