glue 0.31.0 → 0.40.0
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/doc/AUTHORS +1 -1
- data/doc/LICENSE +2 -3
- data/doc/RELEASES +0 -4
- data/lib/glue.rb +3 -3
- data/lib/glue/attribute.rb +114 -0
- data/lib/glue/attributeutils.rb +117 -0
- data/lib/glue/autoreload.rb +0 -4
- data/lib/glue/builder.rb +0 -2
- data/lib/glue/builder/xml.rb +0 -2
- data/lib/glue/cache.rb +3 -5
- data/lib/glue/cache/drb.rb +0 -2
- data/lib/glue/cache/memory.rb +0 -2
- data/lib/glue/cache/og.rb +11 -6
- data/lib/glue/configuration.rb +60 -15
- data/lib/glue/fixture.rb +3 -5
- data/lib/glue/localization.rb +0 -2
- data/lib/glue/logger.rb +1 -2
- data/lib/glue/mail.rb +0 -2
- data/lib/glue/mailer.rb +4 -2
- data/lib/glue/mailer/incoming.rb +0 -2
- data/lib/glue/mailer/outgoing.rb +3 -5
- data/lib/glue/settings.rb +0 -2
- data/lib/glue/uri.rb +0 -2
- data/lib/glue/validation.rb +6 -8
- data/test/glue/builder/tc_xml.rb +3 -2
- data/test/glue/tc_attribute.rb +112 -0
- data/test/glue/{tc_property_mixins.rb → tc_attribute_mixins.rb} +9 -11
- data/test/glue/tc_configuration.rb +1 -1
- data/test/glue/tc_fixture.rb +4 -3
- data/test/glue/tc_logger.rb +2 -2
- data/test/glue/tc_mail.rb +22 -21
- data/test/glue/tc_stores.rb +0 -2
- data/test/glue/tc_uri.rb +12 -12
- data/test/glue/tc_validation.rb +13 -13
- metadata +52 -64
- data/INSTALL +0 -56
- data/ProjectInfo +0 -49
- data/README +0 -21
- data/lib/glue/markup.rb +0 -123
- data/lib/glue/property.rb +0 -290
- data/lib/glue/sanitize.rb +0 -48
- data/lib/glue/template.rb +0 -219
- data/setup.rb +0 -1585
- data/test/glue/tc_property.rb +0 -112
- data/test/glue/tc_property_type_checking.rb +0 -41
- data/test/glue/tc_template.rb +0 -35
data/test/glue/tc_stores.rb
CHANGED
data/test/glue/tc_uri.rb
CHANGED
@@ -53,10 +53,10 @@ class TC_Uri < Test::Unit::TestCase # :nodoc: all
|
|
53
53
|
uri = "people/gmosx.sx?koko=1;lala=2"
|
54
54
|
assert_equal("koko=1;lala=2", Glue::UriUtils.get_query_string(uri))
|
55
55
|
|
56
|
-
uri = "http://www.
|
56
|
+
uri = "http://www.nitroproject.org/people/gmosx.sx?koko=1&lala=2"
|
57
57
|
assert_equal("koko=1&lala=2", Glue::UriUtils.get_query_string(uri))
|
58
58
|
|
59
|
-
uri = "http://www.
|
59
|
+
uri = "http://www.nitroproject.org:8080/people/gmosx.sx?koko=1;lala=2"
|
60
60
|
assert_equal("koko=1;lala=2", Glue::UriUtils.get_query_string(uri))
|
61
61
|
end
|
62
62
|
|
@@ -67,11 +67,11 @@ class TC_Uri < Test::Unit::TestCase # :nodoc: all
|
|
67
67
|
uri = "people/gmosx.sx?koko=1;lala=2"
|
68
68
|
assert_equal("people/gmosx.sx", Glue::UriUtils.chomp_query_string(uri))
|
69
69
|
|
70
|
-
uri = "http://www.
|
71
|
-
assert_equal("http://www.
|
70
|
+
uri = "http://www.nitroproject.org/people/gmosx.sx?koko=1&lala=2"
|
71
|
+
assert_equal("http://www.nitroproject.org/people/gmosx.sx", Glue::UriUtils.chomp_query_string(uri))
|
72
72
|
|
73
|
-
uri = "http://www.
|
74
|
-
assert_equal("http://www.
|
73
|
+
uri = "http://www.nitroproject.org:8080/people/gmosx.sx?koko=1;lala=2"
|
74
|
+
assert_equal("http://www.nitroproject.org:8080/people/gmosx.sx", Glue::UriUtils.chomp_query_string(uri))
|
75
75
|
|
76
76
|
assert_equal(nil, Glue::UriUtils.chomp_query_string(nil))
|
77
77
|
end
|
@@ -81,17 +81,17 @@ class TC_Uri < Test::Unit::TestCase # :nodoc: all
|
|
81
81
|
hash = {"lala" => 2, "kaka" => 3}
|
82
82
|
assert_equal("ko/index.sx?koko=1;lala=2;kaka=3", Glue::UriUtils.update_query_string(uri, hash))
|
83
83
|
|
84
|
-
uri = "http://www.
|
84
|
+
uri = "http://www.nitroproject.org:8080/ko/index.sx?koko=1"
|
85
85
|
hash = {"lala" => 2, "kaka" => 3}
|
86
|
-
assert_equal("http://www.
|
86
|
+
assert_equal("http://www.nitroproject.org:8080/ko/index.sx?koko=1;lala=2;kaka=3", Glue::UriUtils.update_query_string(uri, hash))
|
87
87
|
|
88
|
-
uri = "http://www.
|
88
|
+
uri = "http://www.nitroproject.org"
|
89
89
|
hash = {"lala" => 2, "kaka" => 3}
|
90
|
-
assert_equal("http://www.
|
90
|
+
assert_equal("http://www.nitroproject.org?lala=2;kaka=3", Glue::UriUtils.update_query_string(uri, hash))
|
91
91
|
|
92
92
|
# bug: no ? when passed an empty hash
|
93
|
-
uri = "http://www.
|
94
|
-
assert_equal("http://www.
|
93
|
+
uri = "http://www.nitroproject.org"
|
94
|
+
assert_equal("http://www.nitroproject.org", Glue::UriUtils.update_query_string(uri, {}))
|
95
95
|
end
|
96
96
|
|
97
97
|
end
|
data/test/glue/tc_validation.rb
CHANGED
@@ -4,7 +4,7 @@ $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'og', 'lib')
|
|
4
4
|
require 'test/unit'
|
5
5
|
|
6
6
|
require 'glue'
|
7
|
-
require 'glue/
|
7
|
+
require 'glue/attribute'
|
8
8
|
require 'glue/validation'
|
9
9
|
|
10
10
|
# Glue::Property.type_checking = false
|
@@ -16,52 +16,52 @@ class TC_Validation < Test::Unit::TestCase # :nodoc: all
|
|
16
16
|
Validation::Errors.invalid_format = 'INVALID'
|
17
17
|
|
18
18
|
module Mixin
|
19
|
-
|
19
|
+
attr_accessor :value, String
|
20
20
|
validate_format :value, :format => /123/, :msg => 'mixin error'
|
21
21
|
end
|
22
22
|
|
23
23
|
class User
|
24
24
|
include Mixin
|
25
25
|
|
26
|
-
|
26
|
+
attr_accessor :name, String
|
27
27
|
validate_format :name, :format => /L.o/, :msg => 'per class override'
|
28
28
|
end
|
29
29
|
|
30
30
|
class Article
|
31
|
-
|
31
|
+
attr_accessor :name, String
|
32
32
|
validate_format :name, :format => /news/
|
33
33
|
end
|
34
34
|
|
35
35
|
class Dummy1
|
36
|
-
|
37
|
-
|
36
|
+
attr_accessor :test, Fixnum
|
37
|
+
attr_accessor :str, String
|
38
38
|
validate_value :test, :str
|
39
39
|
end
|
40
40
|
|
41
41
|
class Dummy2
|
42
|
-
|
42
|
+
attr_accessor :password, String
|
43
43
|
validate_confirmation :password
|
44
44
|
end
|
45
45
|
|
46
46
|
class Dummy3
|
47
|
-
|
47
|
+
attr_accessor :vmin, String
|
48
48
|
validate_length :vmin, :min => 2
|
49
49
|
|
50
|
-
|
50
|
+
attr_accessor :vmax, String
|
51
51
|
validate_length :vmax, :max => 3, :msg => 'LOOONG'
|
52
52
|
|
53
|
-
|
53
|
+
attr_accessor :vran, String
|
54
54
|
validate_length :vran, :range => 2..4, :msg_long => 'argh'
|
55
55
|
|
56
|
-
|
56
|
+
attr_accessor :vlen, String
|
57
57
|
validate_length :vlen, :length => 3, :msg => 'argh'
|
58
58
|
end
|
59
59
|
|
60
60
|
class Dummy4
|
61
|
-
|
61
|
+
attr_accessor :sex, String
|
62
62
|
validate_inclusion :sex, :in => %w{ Male Female }, :msg => 'huh?'
|
63
63
|
|
64
|
-
|
64
|
+
attr_accessor :age, Fixnum
|
65
65
|
validate_inclusion :age, :in => 5..99
|
66
66
|
end
|
67
67
|
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: glue
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-
|
8
|
-
summary: Utility methods and classes for Nitro
|
6
|
+
version: 0.40.0
|
7
|
+
date: 2006-11-13 10:56:17 +02:00
|
8
|
+
summary: Utility methods and classes for Nitro + Og
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
email:
|
11
|
+
email:
|
12
12
|
homepage: http://www.nitroproject.org
|
13
13
|
rubyforge_project:
|
14
|
-
description:
|
14
|
+
description: Utility methods and classes for Nitro + Og
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -27,79 +27,67 @@ signing_key:
|
|
27
27
|
cert_chain:
|
28
28
|
post_install_message:
|
29
29
|
authors:
|
30
|
-
- George Moschovitis
|
30
|
+
- George K. Moschovitis
|
31
31
|
files:
|
32
|
-
- doc
|
33
|
-
- lib
|
34
|
-
- test
|
35
|
-
- .
|
36
32
|
- lib/glue
|
33
|
+
- lib/glue.rb
|
37
34
|
- lib/html
|
35
|
+
- lib/glue/attributeutils.rb
|
36
|
+
- lib/glue/attribute.rb
|
37
|
+
- lib/glue/autoreload.rb
|
38
|
+
- lib/glue/builder
|
39
|
+
- lib/glue/builder.rb
|
38
40
|
- lib/glue/cache
|
41
|
+
- lib/glue/cache.rb
|
42
|
+
- lib/glue/configuration.rb
|
43
|
+
- lib/glue/fixture.rb
|
44
|
+
- lib/glue/html.rb
|
45
|
+
- lib/glue/localization.rb
|
46
|
+
- lib/glue/logger.rb
|
47
|
+
- lib/glue/mail.rb
|
39
48
|
- lib/glue/mailer
|
40
|
-
- lib/glue/
|
41
|
-
-
|
42
|
-
-
|
43
|
-
-
|
44
|
-
- test/glue/builder
|
45
|
-
- test/public/dummy_mailer
|
46
|
-
- test/fixture/article.csv
|
47
|
-
- test/glue/tc_builder.rb
|
48
|
-
- test/glue/tc_validation.rb
|
49
|
+
- lib/glue/mailer.rb
|
50
|
+
- lib/glue/settings.rb
|
51
|
+
- lib/glue/uri.rb
|
52
|
+
- lib/glue/validation.rb
|
49
53
|
- lib/glue/builder/xml.rb
|
50
|
-
- lib/glue/mailer/incoming.rb
|
51
|
-
- lib/glue/cache/memory.rb
|
52
54
|
- lib/glue/cache/drb.rb
|
53
|
-
-
|
54
|
-
- lib/html/tokenizer.rb
|
55
|
-
- lib/glue/mail.rb
|
56
|
-
- setup.rb
|
57
|
-
- lib/html/node.rb
|
58
|
-
- lib/glue/configuration.rb
|
59
|
-
- lib/glue.rb
|
60
|
-
- test/public/dummy_mailer/registration.xhtml
|
61
|
-
- test/glue/tc_property_mixins.rb
|
62
|
-
- test/glue/tc_stores.rb
|
63
|
-
- lib/glue/localization.rb
|
64
|
-
- doc/LICENSE
|
65
|
-
- README
|
66
|
-
- test/glue/tc_aspects.rb
|
67
|
-
- test/glue/tc_property.rb
|
68
|
-
- test/glue/tc_property_type_checking.rb
|
69
|
-
- lib/html/version.rb
|
55
|
+
- lib/glue/cache/file.rb
|
70
56
|
- lib/glue/cache/memcached.rb
|
71
|
-
- lib/glue/
|
72
|
-
-
|
73
|
-
-
|
57
|
+
- lib/glue/cache/memory.rb
|
58
|
+
- lib/glue/cache/og.rb
|
59
|
+
- lib/glue/mailer/incoming.rb
|
74
60
|
- lib/glue/mailer/outgoing.rb
|
75
|
-
- lib/
|
76
|
-
- lib/
|
77
|
-
-
|
78
|
-
-
|
79
|
-
- test/
|
80
|
-
- test/glue
|
81
|
-
-
|
82
|
-
-
|
83
|
-
- lib/glue/markup.rb
|
61
|
+
- lib/html/document.rb
|
62
|
+
- lib/html/node.rb
|
63
|
+
- lib/html/tokenizer.rb
|
64
|
+
- lib/html/version.rb
|
65
|
+
- test/fixture
|
66
|
+
- test/glue
|
67
|
+
- test/public
|
68
|
+
- test/fixture/article.csv
|
84
69
|
- test/fixture/article.yml
|
70
|
+
- test/fixture/user.yml
|
71
|
+
- test/glue/builder
|
72
|
+
- test/glue/tc_aspects.rb
|
73
|
+
- test/glue/tc_attribute_mixins.rb
|
74
|
+
- test/glue/tc_attribute.rb
|
75
|
+
- test/glue/tc_builder.rb
|
76
|
+
- test/glue/tc_configuration.rb
|
77
|
+
- test/glue/tc_fixture.rb
|
85
78
|
- test/glue/tc_localization.rb
|
86
|
-
- lib/glue/html.rb
|
87
|
-
- lib/glue/property.rb
|
88
|
-
- doc/RELEASES
|
89
|
-
- ProjectInfo
|
90
|
-
- lib/glue/builder.rb
|
91
|
-
- lib/glue/logger.rb
|
92
79
|
- test/glue/tc_logger.rb
|
93
80
|
- test/glue/tc_mail.rb
|
94
|
-
- test/glue/
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
- lib/glue/mailer.rb
|
101
|
-
- lib/glue/validation.rb
|
81
|
+
- test/glue/tc_stores.rb
|
82
|
+
- test/glue/tc_uri.rb
|
83
|
+
- test/glue/tc_validation.rb
|
84
|
+
- test/glue/builder/tc_xml.rb
|
85
|
+
- test/public/dummy_mailer
|
86
|
+
- test/public/dummy_mailer/registration.xhtml
|
102
87
|
- doc/AUTHORS
|
88
|
+
- doc/CHANGELOG.1
|
89
|
+
- doc/LICENSE
|
90
|
+
- doc/RELEASES
|
103
91
|
test_files: []
|
104
92
|
|
105
93
|
rdoc_options: []
|
data/INSTALL
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
= Instalation with RubyGems
|
2
|
-
|
3
|
-
1. Download and install RubyGems:
|
4
|
-
|
5
|
-
http://rubygems.rubyforge.org
|
6
|
-
|
7
|
-
2. Install the distribution:
|
8
|
-
|
9
|
-
gem install glue
|
10
|
-
|
11
|
-
When asked about the dependencies to include, only accept
|
12
|
-
the dependencies for the RDBMS backends you are planning
|
13
|
-
to use.
|
14
|
-
|
15
|
-
3. Set environment variable (required to load RubyGems):
|
16
|
-
|
17
|
-
export RUBYOPT=-rubygems
|
18
|
-
|
19
|
-
You can add this in you .bashrc in Unix.
|
20
|
-
|
21
|
-
Alternatively you can run your applications with the -rubygem
|
22
|
-
option:
|
23
|
-
|
24
|
-
ruby -rubygem xxx.rb
|
25
|
-
|
26
|
-
= Installation without RubyGems using script.
|
27
|
-
|
28
|
-
Installation without RubyGems is *strongly* discouraged.
|
29
|
-
However, as Glue is all about freedom and possibilities,
|
30
|
-
a standard installation script is provided.
|
31
|
-
|
32
|
-
1. Switch to an administrator account
|
33
|
-
|
34
|
-
For example in Unix:
|
35
|
-
|
36
|
-
$ su -
|
37
|
-
|
38
|
-
2. Run the installation script.
|
39
|
-
|
40
|
-
$ ruby setup.rb
|
41
|
-
|
42
|
-
This installation script also installs some vendor libraries
|
43
|
-
that you possibly have allready installed. Use with caution.
|
44
|
-
|
45
|
-
= Manual installation.
|
46
|
-
|
47
|
-
Uncompress your distribution (Unix example):
|
48
|
-
|
49
|
-
$ cd my_dir
|
50
|
-
$ tar xvfz glue-x.x.x.tar.gz
|
51
|
-
|
52
|
-
Put the libray dir in the Ruby path (Unix example):
|
53
|
-
|
54
|
-
$ export RUBYOPT='-I path/to/glue/lib'
|
55
|
-
|
56
|
-
|
data/ProjectInfo
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
--- %YAML:1.0
|
2
|
-
|
3
|
-
TITLE : &title Glue
|
4
|
-
NAME : &pkg glue
|
5
|
-
VERSION : '0.31.0'
|
6
|
-
STATUS : beta
|
7
|
-
|
8
|
-
AUTHOR : George Moschovitis
|
9
|
-
EMAIL : &email gm@navel.gr
|
10
|
-
HOMEPAGE : "http://www.nitroproject.org"
|
11
|
-
|
12
|
-
SUMMARY: Utility methods and classes for Nitro.
|
13
|
-
|
14
|
-
DESCRIPTION: >
|
15
|
-
Utility methods and classes for Nitro.
|
16
|
-
|
17
|
-
RUBYFORGE:
|
18
|
-
PROJECT: 'nitro'
|
19
|
-
USERNAME: 'gmosx'
|
20
|
-
|
21
|
-
DEPENDENCIES:
|
22
|
-
- [ facets, '= 1.4.5' ]
|
23
|
-
|
24
|
-
PACKAGE: !!package
|
25
|
-
distribute: [ gem, tgz, zip ]
|
26
|
-
|
27
|
-
RDOC: !!rdoc
|
28
|
-
dir: rdoc
|
29
|
-
options: ['--all', '--inline-source']
|
30
|
-
include:
|
31
|
-
- 'lib/glue/**/*'
|
32
|
-
- '[A-Z]*'
|
33
|
-
|
34
|
-
TEST: !!test
|
35
|
-
|
36
|
-
ANNOUNCE: !!announce
|
37
|
-
to: george.moschovitis@gmail.com
|
38
|
-
from: gm@navel.gr
|
39
|
-
domain: navel.gr
|
40
|
-
server: mail
|
41
|
-
port: 25 #587
|
42
|
-
account: gm@navel.gr
|
43
|
-
authtype: login #cram_md5 #plain
|
44
|
-
sectype: tls # ~, tls, ssl (tls is broke)
|
45
|
-
file: ANN
|
46
|
-
slogan: Glue
|
47
|
-
links:
|
48
|
-
- http://www.nitroproject.org
|
49
|
-
|
data/README
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
= Glue 0.30.0 README
|
2
|
-
|
3
|
-
Useful utilites and methods.
|
4
|
-
|
5
|
-
|
6
|
-
== Purpose
|
7
|
-
|
8
|
-
Useful libraries are stored here. An attempt is made to
|
9
|
-
graduate smaller libraries to the more general Facets
|
10
|
-
ruby project.
|
11
|
-
|
12
|
-
|
13
|
-
== Licence
|
14
|
-
|
15
|
-
Copyright (c) 2004-2006, George 'gmosx' Moschovitis (http://www.gmosx.com)
|
16
|
-
Copyright (c) 2004-2006, Navel Ltd (http://www.navel.gr)
|
17
|
-
|
18
|
-
Glue (http://www.rubyforge.org/projects/nitro) is copyrighted free
|
19
|
-
software created and maintained by George Moschovitis (mailto:gm@navel.gr)
|
20
|
-
and released under the standard BSD Licence. For details consult
|
21
|
-
the file LICENCE.
|
data/lib/glue/markup.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
require 'singleton'
|
2
|
-
require 'redcloth'
|
3
|
-
require 'cgi'
|
4
|
-
|
5
|
-
require 'facets/core/module/class_extension'
|
6
|
-
|
7
|
-
require 'glue/sanitize'
|
8
|
-
|
9
|
-
module Glue
|
10
|
-
|
11
|
-
# Generalised Markup transformations.
|
12
|
-
#
|
13
|
-
# The expand methods evaluate (expand) the markup
|
14
|
-
# code to produce the final content. The compact
|
15
|
-
# methods reverse this process to create the original
|
16
|
-
# markup code. Not all markup transformations are
|
17
|
-
# reversible.
|
18
|
-
#
|
19
|
-
# When this library is included, the default PropertyUtils
|
20
|
-
# implementation is overriden to add markup support.
|
21
|
-
#
|
22
|
-
# === Examples
|
23
|
-
#
|
24
|
-
# Define your custom markup methods like this:
|
25
|
-
#
|
26
|
-
# module Markup
|
27
|
-
# def markup_simple
|
28
|
-
# ...
|
29
|
-
# end
|
30
|
-
# def markup_special
|
31
|
-
# ...
|
32
|
-
# end
|
33
|
-
#
|
34
|
-
# # maps the {{..}} macro
|
35
|
-
# alias_method :sanitize, :markup_simple
|
36
|
-
# # maps the {|..|} macro
|
37
|
-
# alias_method :markup, :markup_special
|
38
|
-
# end
|
39
|
-
#
|
40
|
-
# here comes the #{obj.body} # => prints the expanded version.
|
41
|
-
#
|
42
|
-
# obj.body = markup(@params['body'])
|
43
|
-
|
44
|
-
module Markup
|
45
|
-
# The default markup method. You should override this method
|
46
|
-
# in your application to call your custom markup
|
47
|
-
# methods.
|
48
|
-
|
49
|
-
def expand(str)
|
50
|
-
if str
|
51
|
-
xstr = str.dup
|
52
|
-
xstr.gsub!(/</, '<')
|
53
|
-
xstr.gsub!(/>/, '>')
|
54
|
-
xstr.gsub!(/\r/, '<br />')
|
55
|
-
return String.sanitize(xstr)
|
56
|
-
end
|
57
|
-
return nil
|
58
|
-
end
|
59
|
-
alias_method :sanitize, :expand
|
60
|
-
|
61
|
-
# ...
|
62
|
-
|
63
|
-
def expand_redcloth(str)
|
64
|
-
if str
|
65
|
-
return RedCloth.new(expand(str)).to_html
|
66
|
-
end
|
67
|
-
return nil
|
68
|
-
end
|
69
|
-
alias_method :markup, :expand_redcloth
|
70
|
-
|
71
|
-
# Compact (reverse) the content to the origial markup
|
72
|
-
# code. Not all markup transformations are reversible.
|
73
|
-
# You should override this method in your application
|
74
|
-
# to call your custom markup methods.
|
75
|
-
#
|
76
|
-
# NOT IMPLEMENTED.
|
77
|
-
|
78
|
-
def compact(str, meth = nil)
|
79
|
-
end
|
80
|
-
|
81
|
-
# Remove markup code from the input string.
|
82
|
-
#
|
83
|
-
# NOT IMPLEMENTED.
|
84
|
-
|
85
|
-
def clear(str)
|
86
|
-
end
|
87
|
-
|
88
|
-
def escape(str)
|
89
|
-
return nil unless str
|
90
|
-
CGI.escape(str.gsub(/ /, '_'))
|
91
|
-
end
|
92
|
-
|
93
|
-
def unescape(str)
|
94
|
-
CGI.unescape(str.gsub(/_/, ' '))
|
95
|
-
end
|
96
|
-
|
97
|
-
class_extension do
|
98
|
-
# Helper method for manipulating the sanitize transformation.
|
99
|
-
|
100
|
-
def setup_sanitize_transform(&block)
|
101
|
-
self.send :define_method, :sanitize, block
|
102
|
-
end
|
103
|
-
alias_method :setup_sanitize_transformation, :setup_sanitize_transform
|
104
|
-
|
105
|
-
# Helper method for manipulating the markup transformation.
|
106
|
-
|
107
|
-
def setup_markup_transform(&block)
|
108
|
-
self.send :define_method, :markup, block
|
109
|
-
end
|
110
|
-
alias_method :setup_markup_transformation, :setup_markup_transform
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
# An abstract Markup class.
|
115
|
-
|
116
|
-
class MarkupKit
|
117
|
-
extend Markup
|
118
|
-
include Markup
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
# * George Moschovitis <gm@navel.gr>
|