trainbbcode 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -56
- data/Rakefile +2 -2
- data/lib/trainbbcode.rb +11 -8
- data/trainbbcode.gemspec +3 -3
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -47,59 +47,4 @@ This would output:
|
|
47
47
|
|
48
48
|
"[b]bold text[/b] and <i>italic</i>"
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
:url_target can be set to anything valid for a link target.
|
53
|
-
:image_alt the default value for the alt attribute in images
|
54
|
-
:allow_defaults if set to false the default tags (see Tags) will be disabled
|
55
|
-
:disable_html if set to false < and > will not be removed, all HTML will be allowed
|
56
|
-
:newline_enabled if set to false \n wont be turned into html breaks
|
57
|
-
:syntax_highlighting if set to false (or if the gem isnt installed) syntax highlighting will not be used
|
58
|
-
|
59
|
-
:TAG_enabled set for each tag in use e.g. :italic_enabled, it can be set to false to disable the tag
|
60
|
-
|
61
|
-
=== Adding Custom Tags
|
62
|
-
|
63
|
-
:custom_tags is used to define custom tags. you pass an array of tag arrays, the bold tag would be added like this:
|
64
|
-
|
65
|
-
:custom_tags => [[/\[b\](.*?)\[\/b\]/,'<strong>\1</strong>',true]]
|
66
|
-
|
67
|
-
The tag array is formatted like this:
|
68
|
-
|
69
|
-
[REGEX_PATTERN,HTML,ENABLED]
|
70
|
-
|
71
|
-
=== Adding the CSS
|
72
|
-
|
73
|
-
call the css method
|
74
|
-
|
75
|
-
== Tags
|
76
|
-
|
77
|
-
=== Standard
|
78
|
-
|
79
|
-
[b]BOLD[/b] => <strong>BOLD</strong>
|
80
|
-
[i]ITALICS[/i] => <i>ITALICS</i>
|
81
|
-
[u]UNDERLINE[/u] => <u>UNDERLINE</u>
|
82
|
-
[url=http://example.com]example[/url] => <a href="http://example.com" target="YOURDEFAULT">example</a>
|
83
|
-
[url]http://example.com[/url] => <a href="http://example.com" target="YOURDEFAULT">http://example.com</a>
|
84
|
-
[img]http://example.com/test.jpg[/img] => <img src="http://example.com/test.jpg" alt="DEAFULTALT" />
|
85
|
-
[img alt=Test]http://example.com/test.jpg[/img] => <img src="http://example.com/test.jpg" alt="Test" />
|
86
|
-
|
87
|
-
=== Block
|
88
|
-
|
89
|
-
[ul]
|
90
|
-
[li]Test[/li]
|
91
|
-
[li]Test2[/li]
|
92
|
-
[/ul]
|
93
|
-
|
94
|
-
becomes
|
95
|
-
|
96
|
-
<ul>
|
97
|
-
<li>Test</li>
|
98
|
-
<li>Test2</li>
|
99
|
-
</ul>
|
100
|
-
|
101
|
-
same applies for [ol]
|
102
|
-
|
103
|
-
=== Special
|
104
|
-
|
105
|
-
[nobbc][b]BOLD[/b][/nobbc] => [b]BOLD[/b] (using the char codes for [ and ])
|
50
|
+
For More information and examples visit http://www.arcath.net/pages/2
|
data/Rakefile
CHANGED
@@ -2,9 +2,9 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('trainbbcode','0.2.
|
5
|
+
Echoe.new('trainbbcode','0.2.5') do |p|
|
6
6
|
p.description = "Provides BBCode for Ruby."
|
7
|
-
p.url = "http://www.arcath.net"
|
7
|
+
p.url = "http://www.arcath.net/pages/2"
|
8
8
|
p.author = "Adam \"Arcath\" Laycock"
|
9
9
|
p.email = "adam@arcath.net"
|
10
10
|
p.ignore_pattern= ["tmp/*", "scripts/*"]
|
data/lib/trainbbcode.rb
CHANGED
@@ -7,7 +7,7 @@ class TBBC
|
|
7
7
|
begin
|
8
8
|
require 'uv'
|
9
9
|
#UV Settings
|
10
|
-
config[:syntax_output] ||= "
|
10
|
+
config[:syntax_output] ||= "HTML"
|
11
11
|
config[:syntax_line_numbers] ||= true
|
12
12
|
config[:syntax_theme] ||= "twilight"
|
13
13
|
rescue LoadError
|
@@ -22,17 +22,13 @@ class TBBC
|
|
22
22
|
end
|
23
23
|
def parse(s)
|
24
24
|
#Run the UV Parser (if enabled) to sort out any code
|
25
|
-
unless @config[:syntax_highlighting] == false
|
26
|
-
s=uv s
|
27
|
-
end
|
25
|
+
s=uv s unless @config[:syntax_highlighting] == false
|
28
26
|
#Remove the < and > which will disable all HTML
|
29
27
|
s=s.gsub("<","<").gsub(">",">") unless @config[:disable_html] == false
|
30
28
|
#Convert new lines to <br />'s
|
31
29
|
s=s.gsub(/\n/,'<br />') unless @config[:newline_enabled] == false
|
32
30
|
#[nobbc] tags
|
33
|
-
unless @config[:nobbc_enabled] == false
|
34
|
-
s=nobbc s
|
35
|
-
end
|
31
|
+
s=nobbc s unless @config[:nobbc_enabled] == false
|
36
32
|
#Loading Custom Tags
|
37
33
|
begin
|
38
34
|
if @config[:custom_tags] then
|
@@ -83,7 +79,14 @@ class TBBC
|
|
83
79
|
[/\[left\](.*?)\[\/left\]/,'<div style="text-align:left">\1</div>',@config[:alignment_enabled]],
|
84
80
|
[/\[right\](.*?)\[\/right\]/,'<div style="text-align:right">\1</div>',@config[:alignment_enabled]],
|
85
81
|
#Acronym
|
86
|
-
[/\[acronym=(.*?)\](.*?)\[\/acronym\]/,'<acronym title="\1">\2</acronym>',@config[:acronym_enabled]]
|
82
|
+
[/\[acronym=(.*?)\](.*?)\[\/acronym\]/,'<acronym title="\1">\2</acronym>',@config[:acronym_enabled]],
|
83
|
+
#Tables
|
84
|
+
#Table Tag
|
85
|
+
[/\[table\](.*?)\[\/table\]/,'<table width="' + @config[:table_width]+ '">\1</table>',@config[:table_enabled]],
|
86
|
+
#Table Elements
|
87
|
+
[/\[tr\](.*?)\[\/tr\]/,'<tr>\1</tr>',@config[:table_enabled]],
|
88
|
+
[/\[td\](.*?)\[\/td\]/,'<td>\1</td>',@config[:table_enabled]],
|
89
|
+
[/\[th\](.*?)\[\/th\]/,'<th>\1</th>',@config[:table_enabled]]
|
87
90
|
]
|
88
91
|
end
|
89
92
|
def nobbc(s)
|
data/trainbbcode.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{trainbbcode}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Adam \"Arcath\" Laycock"]
|
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = %q{adam@arcath.net}
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/trainbbcode.rb"]
|
13
13
|
s.files = ["Manifest", "README.rdoc", "Rakefile", "lib/trainbbcode.rb", "trainbbcode.gemspec"]
|
14
|
-
s.homepage = %q{http://www.arcath.net}
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Trainbbcode", "--main", "README.rdoc"]
|
14
|
+
s.homepage = %q{http://www.arcath.net/pages/2}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Trainbbcode", "--main", "README.rdoc~"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{trainbbcode}
|
18
18
|
s.rubygems_version = %q{1.3.5}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trainbbcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam "Arcath" Laycock
|
@@ -29,7 +29,7 @@ files:
|
|
29
29
|
- lib/trainbbcode.rb
|
30
30
|
- trainbbcode.gemspec
|
31
31
|
has_rdoc: true
|
32
|
-
homepage: http://www.arcath.net
|
32
|
+
homepage: http://www.arcath.net/pages/2
|
33
33
|
licenses: []
|
34
34
|
|
35
35
|
post_install_message:
|
@@ -39,7 +39,7 @@ rdoc_options:
|
|
39
39
|
- --title
|
40
40
|
- Trainbbcode
|
41
41
|
- --main
|
42
|
-
- README.rdoc
|
42
|
+
- README.rdoc~
|
43
43
|
require_paths:
|
44
44
|
- lib
|
45
45
|
required_ruby_version: !ruby/object:Gem::Requirement
|