trainbbcode 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -3,3 +3,4 @@ README.rdoc
3
3
  Rakefile
4
4
  init.rb
5
5
  lib/trainbbcode.rb
6
+ trainbbcode.gemspec
data/README.rdoc CHANGED
@@ -10,22 +10,11 @@ gem install trainbbcode
10
10
 
11
11
  For rails you will need to add:
12
12
 
13
- config.gem "trainbbcode"
14
-
15
- to config/enviroments.rb
16
-
17
- == Optional Requirements
18
-
19
- === Ultraviolet
20
-
21
- If you want to use syntax highlighting you will need to install the "ultraviolet" gem
22
-
23
- Once you have the gem installed you will need to run:
24
-
25
- uv -s ruby --copy-files css
26
- gief css filez
13
+ config.gem "trainbbcode"
27
14
 
15
+ to config/enviroments.rb and then install the gem using:
28
16
 
17
+ rake gems:install
29
18
 
30
19
  == Usage
31
20
 
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('trainbbcode','0.3.1') do |p|
5
+ Echoe.new('trainbbcode','0.3.2') do |p|
6
6
  p.description = "Provides BBCode for Ruby."
7
7
  p.url = "http://www.arcath.net/pages/2"
8
8
  p.author = "Adam \"Arcath\" Laycock"
data/lib/trainbbcode.rb CHANGED
@@ -30,6 +30,7 @@ class TBBC
30
30
  config[:syntax_highlighting_symbol] ||= "color:#6C9CBD"
31
31
  config[:syntax_highlighting_html] ||= "color:#E7BE69"
32
32
  config[:syntax_highlighting_boolean] ||= "color:#6C9CBD"
33
+ config[:syntax_highlighting_line_numbers]||= :inline
33
34
  #Instanize the config variable
34
35
  @config=config
35
36
  end
@@ -37,7 +38,7 @@ class TBBC
37
38
  #Remove the < and > which will disable all HTML
38
39
  s=s.gsub("<","&lt;").gsub(">","&gt;") unless @config[:disable_html] == false
39
40
  #CodeRay
40
- s=coderay(s)
41
+ s=coderay(s) unless @config[:syntax_highlighting] == false
41
42
  #Convert new lines to <br />'s
42
43
  s=s.gsub(/\n/,'<br />') unless @config[:newline_enabled] == false
43
44
  #[nobbc] tags
@@ -154,12 +155,11 @@ class TBBC
154
155
  s=s.gsub(/<br \/><(ul|li|table|tr|td|th)/,'<\1')
155
156
  s=s.gsub(/<br \/><\/(ul|li|table|tr|td|th)/,'</\1')
156
157
  end
157
- def coderay(s)
158
-
159
- s.gsub(/\[code( lang=(.+?))?\](.+?)\[\/code\]/m) do
160
- parse=$3.gsub("&lt;","<").gsub("&gt;",">")
161
- "[nobbc]" + CodeRay.scan(parse, $2).div(:css => :class) + "[/nobbc]"
162
- end
158
+ def coderay(s)
159
+ scan=s.scan(/\[code lang=(.+?)\](.+?)\[\/code\]/m)
160
+ parse=scan[0][1].gsub("&lt;","<").gsub("&gt;",">")
161
+ lang=scan[0][0]
162
+ "[nobbc]" + CodeRay.scan(parse, lang).div(:css => :class, :line_numbers => @config[:syntax_highlighting_line_numbers]) + "[/nobbc]"
163
163
  end
164
164
  end
165
165
 
data/trainbbcode.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{trainbbcode}
5
- s.version = "0.3.1"
5
+ s.version = "0.3.2"
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"]
9
- s.date = %q{2010-03-30}
9
+ s.date = %q{2010-03-31}
10
10
  s.description = %q{Provides BBCode for Ruby.}
11
11
  s.email = %q{adam@arcath.net}
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/trainbbcode.rb"]
13
- s.files = ["README.rdoc", "Rakefile", "init.rb", "lib/trainbbcode.rb", "Manifest", "trainbbcode.gemspec"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/trainbbcode.rb", "trainbbcode.gemspec"]
14
14
  s.homepage = %q{http://www.arcath.net/pages/2}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Trainbbcode", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam "Arcath" Laycock
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-30 00:00:00 +01:00
12
+ date: 2010-03-31 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,11 +32,11 @@ extra_rdoc_files:
32
32
  - README.rdoc
33
33
  - lib/trainbbcode.rb
34
34
  files:
35
+ - Manifest
35
36
  - README.rdoc
36
37
  - Rakefile
37
38
  - init.rb
38
39
  - lib/trainbbcode.rb
39
- - Manifest
40
40
  - trainbbcode.gemspec
41
41
  has_rdoc: true
42
42
  homepage: http://www.arcath.net/pages/2