acts_as_markup 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +69 -0
- data/README.rdoc +11 -10
- data/Rakefile +31 -26
- data/acts_as_markup.gemspec +88 -40
- data/lib/acts_as_markup.rb +21 -49
- data/lib/acts_as_markup/active_record_extension.rb +217 -0
- data/lib/acts_as_markup/exts/bluecloth.rb +16 -0
- data/lib/acts_as_markup/exts/rdoc.rb +3 -4
- data/lib/acts_as_markup/exts/redcarpet.rb +9 -0
- data/lib/acts_as_markup/exts/wikicloth.rb +18 -0
- data/lib/acts_as_markup/railtie.rb +26 -0
- data/lib/acts_as_markup/version.rb +3 -0
- data/tasks/rdoc.rb +7 -13
- data/test/acts_as_markdown_test.rb +65 -2
- data/test/acts_as_markup_test.rb +91 -15
- data/test/acts_as_mediawiki_test.rb +152 -0
- data/test/acts_as_rdoc_test.rb +1 -1
- data/test/test_helper.rb +21 -3
- metadata +262 -109
- data/.gitignore +0 -4
- data/lib/acts/as_markup.rb +0 -204
- data/test/acts_as_wikitext_test.rb +0 -77
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 1.4.0 / 2011-11-17
|
2
|
+
* Make more like modern Rails 3 plugin.
|
3
|
+
* Fix broken markup processors integration.
|
4
|
+
* Refactor .acts_as_markup method
|
5
|
+
* Allow use of different mediawiki libraries
|
6
|
+
* Default mediawiki library is WikiCloth
|
7
|
+
* Add support for Redcarpet markdown parser
|
8
|
+
|
1
9
|
== 1.3.4 / 2010-09-04
|
2
10
|
* Rails 3.x release
|
3
11
|
|
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem 'activesupport'
|
4
|
+
gem 'activerecord'
|
5
|
+
gem 'rdiscount'
|
6
|
+
gem 'wikicloth'
|
7
|
+
gem 'RedCloth'
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem "shoulda", ">= 0"
|
11
|
+
gem "bundler", "~> 1.0.0"
|
12
|
+
gem "jeweler", "~> 1.6.4"
|
13
|
+
gem "rcov", ">= 0"
|
14
|
+
gem 'sqlite3-ruby'
|
15
|
+
gem 'brianjlandau-sdoc-helpers', :require => 'sdoc_helpers'
|
16
|
+
gem 'rpeg-markdown'
|
17
|
+
gem 'rdoc'
|
18
|
+
gem 'bluecloth'
|
19
|
+
gem 'maruku'
|
20
|
+
gem 'wikitext'
|
21
|
+
gem 'redcarpet'
|
22
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
RedCloth (4.2.8)
|
5
|
+
activemodel (3.1.1)
|
6
|
+
activesupport (= 3.1.1)
|
7
|
+
builder (~> 3.0.0)
|
8
|
+
i18n (~> 0.6)
|
9
|
+
activerecord (3.1.1)
|
10
|
+
activemodel (= 3.1.1)
|
11
|
+
activesupport (= 3.1.1)
|
12
|
+
arel (~> 2.2.1)
|
13
|
+
tzinfo (~> 0.3.29)
|
14
|
+
activesupport (3.1.1)
|
15
|
+
multi_json (~> 1.0)
|
16
|
+
arel (2.2.1)
|
17
|
+
bluecloth (2.2.0)
|
18
|
+
brianjlandau-sdoc-helpers (0.1.4)
|
19
|
+
builder (3.0.0)
|
20
|
+
expression_parser (0.9.0)
|
21
|
+
git (1.2.5)
|
22
|
+
i18n (0.6.0)
|
23
|
+
jeweler (1.6.4)
|
24
|
+
bundler (~> 1.0)
|
25
|
+
git (>= 1.2.5)
|
26
|
+
rake
|
27
|
+
json (1.6.1)
|
28
|
+
maruku (0.6.0)
|
29
|
+
syntax (>= 1.0.0)
|
30
|
+
multi_json (1.0.3)
|
31
|
+
rake (0.9.2.2)
|
32
|
+
rcov (0.9.11)
|
33
|
+
rdiscount (1.6.8)
|
34
|
+
rdoc (3.11)
|
35
|
+
json (~> 1.4)
|
36
|
+
redcarpet (1.17.2)
|
37
|
+
rpeg-markdown (1.4.6)
|
38
|
+
shoulda (2.11.3)
|
39
|
+
sqlite3 (1.3.4)
|
40
|
+
sqlite3-ruby (1.3.3)
|
41
|
+
sqlite3 (>= 1.3.3)
|
42
|
+
syntax (1.0.0)
|
43
|
+
tzinfo (0.3.31)
|
44
|
+
wikicloth (0.7.1)
|
45
|
+
builder
|
46
|
+
expression_parser
|
47
|
+
wikitext (3.0)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
RedCloth
|
54
|
+
activerecord
|
55
|
+
activesupport
|
56
|
+
bluecloth
|
57
|
+
brianjlandau-sdoc-helpers
|
58
|
+
bundler (~> 1.0.0)
|
59
|
+
jeweler (~> 1.6.4)
|
60
|
+
maruku
|
61
|
+
rcov
|
62
|
+
rdiscount
|
63
|
+
rdoc
|
64
|
+
redcarpet
|
65
|
+
rpeg-markdown
|
66
|
+
shoulda
|
67
|
+
sqlite3-ruby
|
68
|
+
wikicloth
|
69
|
+
wikitext
|
data/README.rdoc
CHANGED
@@ -17,12 +17,12 @@ text or +to_html+ to get the formated HTML.
|
|
17
17
|
|
18
18
|
Additionally you can have a model that contains a column that has a column with
|
19
19
|
markup text, and another that defines what language to process it as. If the field
|
20
|
-
is listed as "markdown" "textile", "
|
20
|
+
is listed as "markdown" "textile", "mediawiki" or "rdoc" (case insensitive) it will
|
21
21
|
treat it as such, any other value for markup language will have the value pass
|
22
22
|
through as a normal string.
|
23
23
|
|
24
24
|
This AR extension can use 3 different types of Markdown processing backends:
|
25
|
-
BlueCloth, RDiscount, Ruby PEG or Maruku. You specify which one you want to use by setting
|
25
|
+
BlueCloth, RDiscount, Ruby PEG, Redcarpet or Maruku. You specify which one you want to use by setting
|
26
26
|
a config value in your environment.rb file:
|
27
27
|
|
28
28
|
ActsAsMarkup.markdown_library = :bluecloth
|
@@ -30,7 +30,7 @@ a config value in your environment.rb file:
|
|
30
30
|
By default RDiscount will be used.
|
31
31
|
|
32
32
|
You can specify additional options to pass to the markup library by using
|
33
|
-
<tt>:markdown_options</tt>, <tt>:textile_options</tt> or <tt>:
|
33
|
+
<tt>:markdown_options</tt>, <tt>:textile_options</tt> or <tt>:mediawiki_options</tt>.
|
34
34
|
RDoc does not support any useful options. The options should be given as an
|
35
35
|
array of arguments. You can specify options for multiple languages when
|
36
36
|
allowing more than one. See each library's documentation for more details on
|
@@ -60,10 +60,10 @@ what options are available.
|
|
60
60
|
@post.body.to_html #=> "<h2>Textile Headline</h2>"
|
61
61
|
|
62
62
|
|
63
|
-
==== Using +
|
63
|
+
==== Using +acts_as_mediawiki+:
|
64
64
|
|
65
65
|
class Post < ActiveRecord
|
66
|
-
|
66
|
+
acts_as_mediawiki :body
|
67
67
|
end
|
68
68
|
|
69
69
|
@post = Post.find(:first)
|
@@ -116,23 +116,24 @@ what options are available.
|
|
116
116
|
end
|
117
117
|
|
118
118
|
class Post < ActiveRecord
|
119
|
-
|
119
|
+
acts_as_mediawiki :body, :mediawiki_options => [ { :space_to_underscore => true } ]
|
120
120
|
end
|
121
121
|
|
122
122
|
|
123
123
|
== REQUIREMENTS:
|
124
124
|
|
125
125
|
You will need the RedCloth[http://whytheluckystiff.net/ruby/redcloth/] library
|
126
|
-
for processing the Textile text, and the
|
127
|
-
library for processing
|
126
|
+
for processing the Textile text, and the WikiCloth[https://github.com/nricciar/wikicloth]
|
127
|
+
library for processing mediawiki text.
|
128
128
|
|
129
129
|
You will also need to install some type of Markdown processor.
|
130
|
-
The
|
130
|
+
The four options currently supported are:
|
131
131
|
|
132
132
|
* BlueCloth
|
133
133
|
* RDiscount[http://github.com/rtomayko/rdiscount]
|
134
|
-
* {Ruby PEG}[http://github.com/rtomayko/rpeg-markdown
|
134
|
+
* {Ruby PEG}[http://github.com/rtomayko/rpeg-markdown]
|
135
135
|
* Maruku[http://maruku.rubyforge.org/]
|
136
|
+
* Redcarpet[https://github.com/tanoku/redcarpet]
|
136
137
|
|
137
138
|
== INSTALL:
|
138
139
|
|
data/Rakefile
CHANGED
@@ -1,35 +1,40 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler'
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
6
11
|
require 'rake'
|
12
|
+
|
13
|
+
require 'jeweler'
|
14
|
+
|
15
|
+
$:.unshift(File.expand_path('lib'))
|
16
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__)))
|
7
17
|
require 'acts_as_markup'
|
8
18
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
25
|
-
end
|
26
|
-
Jeweler::GemcutterTasks.new
|
27
|
-
rescue LoadError
|
28
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
Jeweler::Tasks.new do |gem|
|
20
|
+
gem.name = "acts_as_markup"
|
21
|
+
gem.summary = %Q{Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML.}
|
22
|
+
gem.description = %Q{Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML.}
|
23
|
+
gem.email = "brian.landau@viget.com"
|
24
|
+
gem.homepage = "http://vigetlabs.github.com/acts_as_markup/"
|
25
|
+
gem.license = "MIT"
|
26
|
+
gem.authors = ["Brian Landau"]
|
27
|
+
gem.version = ActsAsMarkup::VERSION
|
28
|
+
gem.add_dependency('activesupport', '>= 2.3.2')
|
29
|
+
gem.add_dependency('activerecord', '>= 2.3.2')
|
30
|
+
gem.add_dependency('rdiscount', '~> 1.3')
|
31
|
+
gem.add_dependency('wikitext', '~> 2.0')
|
32
|
+
gem.add_dependency('RedCloth', '~> 4.2')
|
33
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
29
34
|
end
|
35
|
+
Jeweler::RubygemsDotOrgTasks.new
|
30
36
|
|
31
37
|
require 'tasks/test'
|
32
38
|
require 'tasks/rdoc'
|
33
39
|
|
34
|
-
task :test => :check_dependencies
|
35
40
|
task :default => :test
|
data/acts_as_markup.gemspec
CHANGED
@@ -1,71 +1,102 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_markup}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{
|
11
|
+
s.authors = [%q{Brian Landau}]
|
12
|
+
s.date = %q{2011-11-17}
|
13
13
|
s.description = %q{Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML.}
|
14
14
|
s.email = %q{brian.landau@viget.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
20
|
+
"CHANGELOG",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"acts_as_markup.gemspec",
|
27
|
+
"lib/acts_as_markup.rb",
|
28
|
+
"lib/acts_as_markup/active_record_extension.rb",
|
29
|
+
"lib/acts_as_markup/exts/bluecloth.rb",
|
30
|
+
"lib/acts_as_markup/exts/maruku.rb",
|
31
|
+
"lib/acts_as_markup/exts/object.rb",
|
32
|
+
"lib/acts_as_markup/exts/peg_markdown.rb",
|
33
|
+
"lib/acts_as_markup/exts/rdiscount.rb",
|
34
|
+
"lib/acts_as_markup/exts/rdoc.rb",
|
35
|
+
"lib/acts_as_markup/exts/redcarpet.rb",
|
36
|
+
"lib/acts_as_markup/exts/wikicloth.rb",
|
37
|
+
"lib/acts_as_markup/exts/wikitext.rb",
|
38
|
+
"lib/acts_as_markup/railtie.rb",
|
39
|
+
"lib/acts_as_markup/stringlike.rb",
|
40
|
+
"lib/acts_as_markup/version.rb",
|
41
|
+
"tasks/rdoc.rb",
|
42
|
+
"tasks/test.rb",
|
43
|
+
"test/acts_as_markdown_test.rb",
|
44
|
+
"test/acts_as_markup_test.rb",
|
45
|
+
"test/acts_as_mediawiki_test.rb",
|
46
|
+
"test/acts_as_rdoc_test.rb",
|
47
|
+
"test/acts_as_textile_test.rb",
|
48
|
+
"test/test_helper.rb"
|
43
49
|
]
|
44
50
|
s.homepage = %q{http://vigetlabs.github.com/acts_as_markup/}
|
45
|
-
s.
|
46
|
-
s.require_paths = [
|
47
|
-
s.rubygems_version = %q{1.
|
51
|
+
s.licenses = [%q{MIT}]
|
52
|
+
s.require_paths = [%q{lib}]
|
53
|
+
s.rubygems_version = %q{1.8.6}
|
48
54
|
s.summary = %q{Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML.}
|
49
|
-
s.test_files = [
|
50
|
-
"test/acts_as_markdown_test.rb",
|
51
|
-
"test/acts_as_markup_test.rb",
|
52
|
-
"test/acts_as_rdoc_test.rb",
|
53
|
-
"test/acts_as_textile_test.rb",
|
54
|
-
"test/acts_as_wikitext_test.rb",
|
55
|
-
"test/test_helper.rb"
|
56
|
-
]
|
57
55
|
|
58
56
|
if s.respond_to? :specification_version then
|
59
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
60
57
|
s.specification_version = 3
|
61
58
|
|
62
59
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
61
|
+
s.add_runtime_dependency(%q<activerecord>, [">= 0"])
|
62
|
+
s.add_runtime_dependency(%q<rdiscount>, [">= 0"])
|
63
|
+
s.add_runtime_dependency(%q<wikicloth>, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<RedCloth>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
66
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
67
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
68
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
70
|
+
s.add_development_dependency(%q<brianjlandau-sdoc-helpers>, [">= 0"])
|
71
|
+
s.add_development_dependency(%q<rpeg-markdown>, [">= 0"])
|
72
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
73
|
+
s.add_development_dependency(%q<bluecloth>, [">= 0"])
|
74
|
+
s.add_development_dependency(%q<maruku>, [">= 0"])
|
75
|
+
s.add_development_dependency(%q<wikitext>, [">= 0"])
|
76
|
+
s.add_development_dependency(%q<redcarpet>, [">= 0"])
|
63
77
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.2"])
|
64
78
|
s.add_runtime_dependency(%q<activerecord>, [">= 2.3.2"])
|
65
79
|
s.add_runtime_dependency(%q<rdiscount>, ["~> 1.3"])
|
66
80
|
s.add_runtime_dependency(%q<wikitext>, ["~> 2.0"])
|
67
81
|
s.add_runtime_dependency(%q<RedCloth>, ["~> 4.2"])
|
68
82
|
else
|
83
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
84
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
85
|
+
s.add_dependency(%q<rdiscount>, [">= 0"])
|
86
|
+
s.add_dependency(%q<wikicloth>, [">= 0"])
|
87
|
+
s.add_dependency(%q<RedCloth>, [">= 0"])
|
88
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
89
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
90
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
91
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
92
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
93
|
+
s.add_dependency(%q<brianjlandau-sdoc-helpers>, [">= 0"])
|
94
|
+
s.add_dependency(%q<rpeg-markdown>, [">= 0"])
|
95
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
96
|
+
s.add_dependency(%q<bluecloth>, [">= 0"])
|
97
|
+
s.add_dependency(%q<maruku>, [">= 0"])
|
98
|
+
s.add_dependency(%q<wikitext>, [">= 0"])
|
99
|
+
s.add_dependency(%q<redcarpet>, [">= 0"])
|
69
100
|
s.add_dependency(%q<activesupport>, [">= 2.3.2"])
|
70
101
|
s.add_dependency(%q<activerecord>, [">= 2.3.2"])
|
71
102
|
s.add_dependency(%q<rdiscount>, ["~> 1.3"])
|
@@ -73,6 +104,23 @@ Gem::Specification.new do |s|
|
|
73
104
|
s.add_dependency(%q<RedCloth>, ["~> 4.2"])
|
74
105
|
end
|
75
106
|
else
|
107
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
108
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
109
|
+
s.add_dependency(%q<rdiscount>, [">= 0"])
|
110
|
+
s.add_dependency(%q<wikicloth>, [">= 0"])
|
111
|
+
s.add_dependency(%q<RedCloth>, [">= 0"])
|
112
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
113
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
114
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
115
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
116
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
117
|
+
s.add_dependency(%q<brianjlandau-sdoc-helpers>, [">= 0"])
|
118
|
+
s.add_dependency(%q<rpeg-markdown>, [">= 0"])
|
119
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
120
|
+
s.add_dependency(%q<bluecloth>, [">= 0"])
|
121
|
+
s.add_dependency(%q<maruku>, [">= 0"])
|
122
|
+
s.add_dependency(%q<wikitext>, [">= 0"])
|
123
|
+
s.add_dependency(%q<redcarpet>, [">= 0"])
|
76
124
|
s.add_dependency(%q<activesupport>, [">= 2.3.2"])
|
77
125
|
s.add_dependency(%q<activerecord>, [">= 2.3.2"])
|
78
126
|
s.add_dependency(%q<rdiscount>, ["~> 1.3"])
|
data/lib/acts_as_markup.rb
CHANGED
@@ -2,13 +2,10 @@ require 'set'
|
|
2
2
|
require 'active_support'
|
3
3
|
require 'active_support/core_ext'
|
4
4
|
|
5
|
+
require 'acts_as_markup/version'
|
6
|
+
require 'acts_as_markup/railtie' if defined?(Rails)
|
7
|
+
|
5
8
|
module ActsAsMarkup
|
6
|
-
# :stopdoc:
|
7
|
-
VERSION = '1.3.4'.freeze
|
8
|
-
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
9
|
-
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
10
|
-
# :startdoc:
|
11
|
-
|
12
9
|
# This exception is raised when an unsupported markup language is supplied to acts_as_markup.
|
13
10
|
class UnsupportedMarkupLanguage < ArgumentError
|
14
11
|
end
|
@@ -17,61 +14,36 @@ module ActsAsMarkup
|
|
17
14
|
class UnsportedMarkdownLibrary < ArgumentError
|
18
15
|
end
|
19
16
|
|
20
|
-
|
17
|
+
# This exception is raised when an unsupported Mediawiki library is set to the config value.
|
18
|
+
class UnsportedMediawikiLibrary < ArgumentError
|
19
|
+
end
|
21
20
|
|
22
21
|
MARKDOWN_LIBS = { :rdiscount => {:class_name => "RDiscount",
|
23
22
|
:lib_name => "rdiscount"},
|
24
|
-
:bluecloth => {:class_name => "
|
23
|
+
:bluecloth => {:class_name => "BlueClothText",
|
25
24
|
:lib_name => "bluecloth"},
|
26
25
|
:rpeg => {:class_name => "PEGMarkdown",
|
27
26
|
:lib_name => "peg_markdown"},
|
28
27
|
:maruku => {:class_name => "Maruku",
|
29
|
-
:lib_name => "maruku"}
|
28
|
+
:lib_name => "maruku"},
|
29
|
+
:redcarpet => {:class_name => "Redcarpet",
|
30
|
+
:lib_name => 'redcarpet'} }
|
31
|
+
|
32
|
+
MEDIAWIKI_LIBS = { :wikitext => {:class_name => "WikitextString",
|
33
|
+
:lib_name => "wikitext"},
|
34
|
+
:wikicloth => {:class_name => "WikiClothText",
|
35
|
+
:lib_name => 'wikicloth'} }
|
30
36
|
|
31
|
-
LIBRARY_EXTENSIONS = ::Set.new(Dir[
|
32
|
-
|
33
|
-
@@markdown_library = DEFAULT_MARKDOWN_LIB
|
37
|
+
LIBRARY_EXTENSIONS = ::Set.new(Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'acts_as_markup/exts/*.rb')].map {|file| File.basename(file, '.rb')}).delete('string')
|
38
|
+
|
34
39
|
mattr_accessor :markdown_library
|
35
|
-
|
36
|
-
|
40
|
+
mattr_accessor :mediawiki_library
|
41
|
+
|
37
42
|
# Returns the version string for the library.
|
38
|
-
#
|
39
43
|
def self.version
|
40
44
|
VERSION
|
41
45
|
end
|
42
46
|
|
43
|
-
|
44
|
-
# they will be joined to the end of the library path using
|
45
|
-
# <tt>File.join</tt>.
|
46
|
-
#
|
47
|
-
def self.libpath( *args )
|
48
|
-
args.empty? ? LIBPATH : ::File.join(LIBPATH, *args)
|
49
|
-
end
|
50
|
-
|
51
|
-
# Returns the path for the module. If any arguments are given,
|
52
|
-
# they will be joined to the end of the path using
|
53
|
-
# <tt>File.join</tt>.
|
54
|
-
#
|
55
|
-
def self.path( *args )
|
56
|
-
args.empty? ? PATH : ::File.join(PATH, *args)
|
57
|
-
end
|
58
|
-
|
59
|
-
# Utility method used to rquire all files ending in .rb that lie in the
|
60
|
-
# directory below this file that has the same name as the filename passed
|
61
|
-
# in. Optionally, a specific _directory_ name can be passed in such that
|
62
|
-
# the _filename_ does not have to be equivalent to the directory.
|
63
|
-
#
|
64
|
-
def self.require_all_libs_relative_to( fname, dir = nil )
|
65
|
-
dir ||= ::File.basename(fname, '.*')
|
66
|
-
search_me = ::File.expand_path(
|
67
|
-
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
68
|
-
|
69
|
-
Dir.glob(search_me).sort.each {|rb| require rb}
|
70
|
-
end
|
71
|
-
# :startdoc:
|
72
|
-
|
73
|
-
end # module ActsAsMarkup
|
47
|
+
end
|
74
48
|
|
75
|
-
|
76
|
-
require 'acts_as_markup/stringlike'
|
77
|
-
ActsAsMarkup.require_all_libs_relative_to __FILE__, 'acts'
|
49
|
+
ActiveSupport.run_load_hooks(:acts_as_markup, ActsAsMarkup)
|