markabb 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +19 -2
- data/lib/markabb.rb +7 -8
- data/lib/markabb/classes/parser.rb +1 -1
- data/lib/markabb/tags/list.rb +1 -1
- data/lib/markabb/version.rb +1 -1
- data/spec/tags/link_spec.rb +5 -0
- metadata +67 -69
data/Readme.md
CHANGED
@@ -9,9 +9,26 @@ To get the latest stable version install the gem by adding
|
|
9
9
|
|
10
10
|
to your Gemfile
|
11
11
|
|
12
|
-
##
|
12
|
+
## Usage
|
13
13
|
|
14
|
-
|
14
|
+
Before you can use Markabb you need to configure it. To do this create an intializer (config/intializers in rails) and pass a block to Markabb.configure like this:
|
15
|
+
|
16
|
+
Markabb.configure do |c|
|
17
|
+
end
|
18
|
+
|
19
|
+
`c` is an instance of Markabb::Config which is used by Markabb when ever you parse a string. You can pass any config options you want here.
|
20
|
+
|
21
|
+
To parse a string simply call `.markabb` on it e.g.
|
22
|
+
|
23
|
+
"[b]foo[/b] [i]bar[/i]".markabb # => <b>foo</b><i>bar</i>
|
24
|
+
|
25
|
+
If you need to configure Markabb for a one off parse e.g. if you want to disable links when parsing a forum post etc... to do that pass a block to `Markabb.parse`
|
26
|
+
|
27
|
+
Markabb.parse "[b]foo[/b] [i]bar[/i]" do |c|
|
28
|
+
c.disable_bold = true
|
29
|
+
end # => [b]foo[/b] <i>bar</i>
|
30
|
+
|
31
|
+
See the [Wiki](https://github.com/Arcath/Markabb/wiki) for instructions on Markabbs more advanced features like custom tags, callbacks and syntax highlighting.
|
15
32
|
|
16
33
|
## Developing & Testing
|
17
34
|
|
data/lib/markabb.rb
CHANGED
@@ -14,6 +14,13 @@ require "markabb/classes/syntax_highlighter"
|
|
14
14
|
# Highlighters
|
15
15
|
require "markabb/highlighters/coderay"
|
16
16
|
require "markabb/highlighters/raw"
|
17
|
+
# Tags
|
18
|
+
require "markabb/tags/formatting"
|
19
|
+
require "markabb/tags/image"
|
20
|
+
require "markabb/tags/link"
|
21
|
+
require "markabb/tags/list"
|
22
|
+
require "markabb/tags/nobbc"
|
23
|
+
require "markabb/tags/table"
|
17
24
|
|
18
25
|
# Main Markabb Module, all code is a sub of this
|
19
26
|
module Markabb
|
@@ -36,11 +43,3 @@ module Markabb
|
|
36
43
|
module Highlighters
|
37
44
|
end
|
38
45
|
end
|
39
|
-
|
40
|
-
# Tags
|
41
|
-
require "markabb/tags/formatting"
|
42
|
-
require "markabb/tags/image"
|
43
|
-
require "markabb/tags/link"
|
44
|
-
require "markabb/tags/list"
|
45
|
-
require "markabb/tags/nobbc"
|
46
|
-
require "markabb/tags/table"
|
data/lib/markabb/tags/list.rb
CHANGED
@@ -13,4 +13,4 @@ list_callback = Markabb::Callback.new(Proc.new { |s|
|
|
13
13
|
Markabb.register_tag :un_ordered, Markabb::Tag.new('ul', '<ul>\1</ul>'), :lists
|
14
14
|
Markabb.register_tag :ordered, Markabb::Tag.new('ol', '<ol>\1</ol>'), :lists
|
15
15
|
Markabb.register_tag :list_item, Markabb::Tag.new('li', '<li>\1</li>'), :lists
|
16
|
-
Markabb.register_tag :smart_list, Markabb::Tag.new(
|
16
|
+
Markabb.register_tag :smart_list, Markabb::Tag.new('list', list_callback), :lists
|
data/lib/markabb/version.rb
CHANGED
data/spec/tags/link_spec.rb
CHANGED
@@ -17,4 +17,9 @@ describe "Link Tags" do
|
|
17
17
|
default_config
|
18
18
|
Markabb.parse("[url=http://www.example.com]Example[/url]").should eq('<a href="http://www.example.com" target="_BLANK">Example</a>')
|
19
19
|
end
|
20
|
+
|
21
|
+
it "should prevent javascript injection" do
|
22
|
+
default_config
|
23
|
+
Markabb.parse('[url=" onclick="foo]Injected[/url]').should_not eq "<a href=\"\" onclick=\"foo\" target=\"_BLANK\">Injected</a>"
|
24
|
+
end
|
20
25
|
end
|
metadata
CHANGED
@@ -1,68 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: markabb
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Adam "Arcath" Laycock
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-02-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
30
22
|
type: :development
|
31
|
-
version_requirements: *id001
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: yard
|
34
23
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: yard
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
42
38
|
type: :development
|
43
|
-
version_requirements: *id002
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: coderay
|
46
39
|
prerelease: false
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: coderay
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
54
|
type: :runtime
|
55
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
56
62
|
description: Provides BBCode for Ruby and Rails
|
57
|
-
email:
|
63
|
+
email:
|
58
64
|
- gems@arcath.net
|
59
65
|
executables: []
|
60
|
-
|
61
66
|
extensions: []
|
62
|
-
|
63
67
|
extra_rdoc_files: []
|
64
|
-
|
65
|
-
files:
|
68
|
+
files:
|
66
69
|
- .gitignore
|
67
70
|
- .travis.yml
|
68
71
|
- Gemfile
|
@@ -102,37 +105,31 @@ files:
|
|
102
105
|
- spec/tags/link_spec.rb
|
103
106
|
- spec/tags/list_spec.rb
|
104
107
|
- spec/tags/table_spec.rb
|
105
|
-
has_rdoc: true
|
106
108
|
homepage: http://markabb.arcath.net
|
107
109
|
licenses: []
|
108
|
-
|
109
110
|
post_install_message:
|
110
111
|
rdoc_options: []
|
111
|
-
|
112
|
-
require_paths:
|
112
|
+
require_paths:
|
113
113
|
- lib
|
114
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
126
|
-
- 0
|
127
|
-
version: "0"
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
128
126
|
requirements: []
|
129
|
-
|
130
127
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.
|
128
|
+
rubygems_version: 1.8.23
|
132
129
|
signing_key:
|
133
130
|
specification_version: 3
|
134
131
|
summary: Provides BBCode for Ruby and Rails
|
135
|
-
test_files:
|
132
|
+
test_files:
|
136
133
|
- spec/highlighters/coderay_spec.rb
|
137
134
|
- spec/highlighters/raw_spec.rb
|
138
135
|
- spec/macros/formatting_macros.rb
|
@@ -148,3 +145,4 @@ test_files:
|
|
148
145
|
- spec/tags/link_spec.rb
|
149
146
|
- spec/tags/list_spec.rb
|
150
147
|
- spec/tags/table_spec.rb
|
148
|
+
has_rdoc:
|