breakout_parser 0.0.17-x86-mswin32 → 0.0.18-x86-mswin32
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/ChangeLog +6 -0
- data/README +28 -0
- data/spec/parser_spec.rb +37 -5
- metadata +14 -4
data/ChangeLog
CHANGED
data/README
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Breakout Parser
|
2
|
+
===============
|
3
|
+
|
4
|
+
- simplified Textile parser with some Assembla-specific features
|
5
|
+
- converts Textile into HTML
|
6
|
+
|
7
|
+
|
8
|
+
Usage
|
9
|
+
===============
|
10
|
+
|
11
|
+
require 'breakout_parser'
|
12
|
+
puts BreakoutParser.parse("h1. xxx", "my_space")
|
13
|
+
# prints: <h1 id="h-xxx">xxx</h1>
|
14
|
+
|
15
|
+
puts BreakoutParser.parse_links_only("h1. http://xxx", "my_space")
|
16
|
+
# prints: h1. <a rel="nofollow" href="http://xxx">http://xxx</a>
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Arguments
|
21
|
+
===============
|
22
|
+
|
23
|
+
BreakoutParser.parse(
|
24
|
+
data, # data to parse
|
25
|
+
space_name, # space name - for links parsing
|
26
|
+
site_url, # [optional] global site url
|
27
|
+
git_url # [optional] custom GIT url - f.ex. for github-hosted repos
|
28
|
+
)
|
data/spec/parser_spec.rb
CHANGED
@@ -24,13 +24,13 @@ describe 'BreakoutParser' do
|
|
24
24
|
r
|
25
25
|
end
|
26
26
|
|
27
|
-
it 'accepts from 2 to
|
28
|
-
[0,1,
|
27
|
+
it 'accepts from 2 to 5 arguments' do
|
28
|
+
[0,1,6,7,8,9,10].each do |argc|
|
29
29
|
lambda{
|
30
30
|
BreakoutParser.parse(*(['a']*argc))
|
31
|
-
}.should raise_error(ArgumentError, "wrong number of arguments (#{argc} for 2..
|
31
|
+
}.should raise_error(ArgumentError, "wrong number of arguments (#{argc} for 2..5)")
|
32
32
|
end
|
33
|
-
(2..
|
33
|
+
(2..5).each do |argc|
|
34
34
|
lambda{
|
35
35
|
BreakoutParser.parse(*(['a']*argc))
|
36
36
|
}.should_not raise_error
|
@@ -924,6 +924,33 @@ describe 'BreakoutParser' do
|
|
924
924
|
}.should_not raise_error
|
925
925
|
end
|
926
926
|
|
927
|
+
describe "absolute_urls" do
|
928
|
+
# 'true' values
|
929
|
+
[true, 1, 'x'].each do |v|
|
930
|
+
it "should NOT convert relative url to absolute when absolute_urls = #{v.inspect} AND site_url is NULL" do
|
931
|
+
parse("[[url:/rel]]", :absolute_urls => v).should ==
|
932
|
+
'<a rel="nofollow" href="/rel">/rel</a>'
|
933
|
+
parse("[[url:/rel|text]]", :absolute_urls => v).should ==
|
934
|
+
'<a rel="nofollow" href="/rel">text</a>'
|
935
|
+
end
|
936
|
+
it "should convert relative url to absolute when absolute_urls = #{v.inspect}" do
|
937
|
+
parse("[[url:/rel]]", :absolute_urls => v, :site_url => 'http://www.ru').should ==
|
938
|
+
'<a rel="nofollow" href="http://www.ru/rel">/rel</a>'
|
939
|
+
parse("[[url:/rel|text]]", :absolute_urls => v, :site_url => 'http://www.ru').should ==
|
940
|
+
'<a rel="nofollow" href="http://www.ru/rel">text</a>'
|
941
|
+
end
|
942
|
+
end
|
943
|
+
# 'false' values
|
944
|
+
[false, nil].each do |v|
|
945
|
+
it "should not convert relative url to absolute when absolute_urls = #{v.inspect}" do
|
946
|
+
parse("[[url:/rel]]", :absolute_urls => v).should ==
|
947
|
+
'<a rel="nofollow" href="/rel">/rel</a>'
|
948
|
+
parse("[[url:/rel|text]]", :absolute_urls => v).should ==
|
949
|
+
'<a rel="nofollow" href="/rel">text</a>'
|
950
|
+
end
|
951
|
+
end
|
952
|
+
end
|
953
|
+
|
927
954
|
a = {}
|
928
955
|
a["image:ExistingImage.png"] =
|
929
956
|
'<img src="/spaces/test_space/documents/download/ExistingImage.png" alt="ALT" />'
|
@@ -982,6 +1009,11 @@ describe 'BreakoutParser' do
|
|
982
1009
|
|
983
1010
|
def parse s, h = {}
|
984
1011
|
h[:space_name] = "test_space" unless h.key?(:space_name)
|
985
|
-
BreakoutParser.parse(s,
|
1012
|
+
BreakoutParser.parse(s,
|
1013
|
+
h[:space_name],
|
1014
|
+
h[:site_url],
|
1015
|
+
h[:git_url],
|
1016
|
+
h[:absolute_urls]
|
1017
|
+
).strip
|
986
1018
|
end
|
987
1019
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breakout_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 59
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 18
|
10
|
+
version: 0.0.18
|
10
11
|
platform: x86-mswin32
|
11
12
|
authors:
|
12
13
|
- Andrey "Zed" Zaikin
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-08-25 00:00:00 +04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 2
|
@@ -40,11 +43,14 @@ extensions: []
|
|
40
43
|
extra_rdoc_files:
|
41
44
|
- ChangeLog
|
42
45
|
- LICENSE
|
46
|
+
- README
|
43
47
|
files:
|
44
48
|
- ChangeLog
|
45
49
|
- LICENSE
|
50
|
+
- README
|
46
51
|
- lib/breakout_parser.rb
|
47
52
|
- lib/breakout_parser/win32-ruby1.8/breakout_parser.so
|
53
|
+
- spec/parser_spec.rb
|
48
54
|
has_rdoc: true
|
49
55
|
homepage: http://assembla.com
|
50
56
|
licenses: []
|
@@ -55,23 +61,27 @@ rdoc_options:
|
|
55
61
|
require_paths:
|
56
62
|
- lib
|
57
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
58
65
|
requirements:
|
59
66
|
- - ">="
|
60
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
61
69
|
segments:
|
62
70
|
- 0
|
63
71
|
version: "0"
|
64
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ">="
|
67
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
68
78
|
segments:
|
69
79
|
- 0
|
70
80
|
version: "0"
|
71
81
|
requirements: []
|
72
82
|
|
73
83
|
rubyforge_project:
|
74
|
-
rubygems_version: 1.3.
|
84
|
+
rubygems_version: 1.3.7
|
75
85
|
signing_key:
|
76
86
|
specification_version: 3
|
77
87
|
summary: BreakoutParser
|