acts_as_markup 1.4.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile DELETED
@@ -1,23 +0,0 @@
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 'sdoc'
16
- gem 'brianjlandau-sdoc-helpers', :require => 'sdoc_helpers'
17
- gem 'rpeg-markdown'
18
- gem 'rdoc'
19
- gem 'bluecloth'
20
- gem 'maruku'
21
- gem 'wikitext'
22
- gem 'redcarpet'
23
- end
data/Gemfile.lock DELETED
@@ -1,73 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- RedCloth (4.2.8)
5
- activemodel (3.1.2)
6
- activesupport (= 3.1.2)
7
- builder (~> 3.0.0)
8
- i18n (~> 0.6)
9
- activerecord (3.1.2)
10
- activemodel (= 3.1.2)
11
- activesupport (= 3.1.2)
12
- arel (~> 2.2.1)
13
- tzinfo (~> 0.3.29)
14
- activesupport (3.1.2)
15
- multi_json (~> 1.0)
16
- arel (2.2.1)
17
- bluecloth (2.2.0)
18
- brianjlandau-sdoc-helpers (0.1.5)
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
- sdoc (0.3.16)
39
- json (>= 1.1.3)
40
- rdoc (~> 3.10)
41
- shoulda (2.11.3)
42
- sqlite3 (1.3.4)
43
- sqlite3-ruby (1.3.3)
44
- sqlite3 (>= 1.3.3)
45
- syntax (1.0.0)
46
- tzinfo (0.3.31)
47
- wikicloth (0.7.1)
48
- builder
49
- expression_parser
50
- wikitext (3.0)
51
-
52
- PLATFORMS
53
- ruby
54
-
55
- DEPENDENCIES
56
- RedCloth
57
- activerecord
58
- activesupport
59
- bluecloth
60
- brianjlandau-sdoc-helpers
61
- bundler (~> 1.0.0)
62
- jeweler (~> 1.6.4)
63
- maruku
64
- rcov
65
- rdiscount
66
- rdoc
67
- redcarpet
68
- rpeg-markdown
69
- sdoc
70
- shoulda
71
- sqlite3-ruby
72
- wikicloth
73
- wikitext
@@ -1,134 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "acts_as_markup"
8
- s.version = "1.4.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Brian Landau"]
12
- s.date = "2012-03-09"
13
- s.description = "Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML."
14
- s.email = "brian.landau@viget.com"
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
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"
49
- ]
50
- s.homepage = "http://vigetlabs.github.com/acts_as_markup/"
51
- s.licenses = ["MIT"]
52
- s.require_paths = ["lib"]
53
- s.rubygems_version = "1.8.15"
54
- s.summary = "Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML."
55
-
56
- if s.respond_to? :specification_version then
57
- s.specification_version = 3
58
-
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<sdoc>, [">= 0"])
71
- s.add_development_dependency(%q<brianjlandau-sdoc-helpers>, [">= 0"])
72
- s.add_development_dependency(%q<rpeg-markdown>, [">= 0"])
73
- s.add_development_dependency(%q<rdoc>, [">= 0"])
74
- s.add_development_dependency(%q<bluecloth>, [">= 0"])
75
- s.add_development_dependency(%q<maruku>, [">= 0"])
76
- s.add_development_dependency(%q<wikitext>, [">= 0"])
77
- s.add_development_dependency(%q<redcarpet>, [">= 0"])
78
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.2"])
79
- s.add_runtime_dependency(%q<activerecord>, [">= 2.3.2"])
80
- s.add_runtime_dependency(%q<rdiscount>, ["~> 1.3"])
81
- s.add_runtime_dependency(%q<wikitext>, ["~> 2.0"])
82
- s.add_runtime_dependency(%q<RedCloth>, ["~> 4.2"])
83
- else
84
- s.add_dependency(%q<activesupport>, [">= 0"])
85
- s.add_dependency(%q<activerecord>, [">= 0"])
86
- s.add_dependency(%q<rdiscount>, [">= 0"])
87
- s.add_dependency(%q<wikicloth>, [">= 0"])
88
- s.add_dependency(%q<RedCloth>, [">= 0"])
89
- s.add_dependency(%q<shoulda>, [">= 0"])
90
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
91
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
92
- s.add_dependency(%q<rcov>, [">= 0"])
93
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
94
- s.add_dependency(%q<sdoc>, [">= 0"])
95
- s.add_dependency(%q<brianjlandau-sdoc-helpers>, [">= 0"])
96
- s.add_dependency(%q<rpeg-markdown>, [">= 0"])
97
- s.add_dependency(%q<rdoc>, [">= 0"])
98
- s.add_dependency(%q<bluecloth>, [">= 0"])
99
- s.add_dependency(%q<maruku>, [">= 0"])
100
- s.add_dependency(%q<wikitext>, [">= 0"])
101
- s.add_dependency(%q<redcarpet>, [">= 0"])
102
- s.add_dependency(%q<activesupport>, [">= 2.3.2"])
103
- s.add_dependency(%q<activerecord>, [">= 2.3.2"])
104
- s.add_dependency(%q<rdiscount>, ["~> 1.3"])
105
- s.add_dependency(%q<wikitext>, ["~> 2.0"])
106
- s.add_dependency(%q<RedCloth>, ["~> 4.2"])
107
- end
108
- else
109
- s.add_dependency(%q<activesupport>, [">= 0"])
110
- s.add_dependency(%q<activerecord>, [">= 0"])
111
- s.add_dependency(%q<rdiscount>, [">= 0"])
112
- s.add_dependency(%q<wikicloth>, [">= 0"])
113
- s.add_dependency(%q<RedCloth>, [">= 0"])
114
- s.add_dependency(%q<shoulda>, [">= 0"])
115
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
116
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
117
- s.add_dependency(%q<rcov>, [">= 0"])
118
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
119
- s.add_dependency(%q<sdoc>, [">= 0"])
120
- s.add_dependency(%q<brianjlandau-sdoc-helpers>, [">= 0"])
121
- s.add_dependency(%q<rpeg-markdown>, [">= 0"])
122
- s.add_dependency(%q<rdoc>, [">= 0"])
123
- s.add_dependency(%q<bluecloth>, [">= 0"])
124
- s.add_dependency(%q<maruku>, [">= 0"])
125
- s.add_dependency(%q<wikitext>, [">= 0"])
126
- s.add_dependency(%q<redcarpet>, [">= 0"])
127
- s.add_dependency(%q<activesupport>, [">= 2.3.2"])
128
- s.add_dependency(%q<activerecord>, [">= 2.3.2"])
129
- s.add_dependency(%q<rdiscount>, ["~> 1.3"])
130
- s.add_dependency(%q<wikitext>, ["~> 2.0"])
131
- s.add_dependency(%q<RedCloth>, ["~> 4.2"])
132
- end
133
- end
134
-
@@ -1,18 +0,0 @@
1
- require 'wikicloth'
2
-
3
- class WikiClothText < WikiCloth::Parser
4
- include Stringlike
5
-
6
- def initialize(string)
7
- @text = string
8
- super({:data => string.to_s})
9
- end
10
-
11
- def to_s
12
- @text
13
- end
14
-
15
- def blank?
16
- @text.blank?
17
- end
18
- end
@@ -1,20 +0,0 @@
1
- require 'wikitext'
2
-
3
- # This allows a us to create a wrapper object similar to those provided by the
4
- # Markdown and Textile libraries. It stores the original and formated HTML text
5
- # in instance variables.
6
- #
7
- class WikitextString < String
8
- attr_reader :text
9
- attr_reader :html
10
-
11
- def initialize(str, *options)
12
- super(str)
13
- @text = str.to_s
14
- @html = Wikitext::Parser.new(*options).parse(@text)
15
- end
16
-
17
- def to_html
18
- @html
19
- end
20
- end
data/tasks/rdoc.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'sdoc'
2
- require 'rake/sdoctask'
3
- require 'sdoc_helpers/pages'
4
-
5
- Rake::SDocTask.new do |rdoc|
6
- version = ActsAsMarkup::VERSION
7
- rdoc.title = "ActsAsMarkup #{version} Documentation"
8
- rdoc.rdoc_files.include('lib/**/*.rb')
9
- end
data/tasks/test.rb DELETED
@@ -1,17 +0,0 @@
1
- require 'rake/testtask'
2
- Rake::TestTask.new(:test) do |test|
3
- test.libs << 'lib' << 'test'
4
- test.pattern = 'test/**/*_test.rb'
5
- test.verbose = true
6
- end
7
-
8
- begin
9
- require 'rcov/rcovtask'
10
- Rcov::RcovTask.new do |test|
11
- test.libs << 'test'
12
- test.pattern = 'test/**/*_test.rb'
13
- test.verbose = true
14
- test.rcov_opts = %w[--sort coverage -T --only-uncovered]
15
- end
16
- rescue LoadError
17
- end
@@ -1,152 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class ActsAsMediawikiTest < ActsAsMarkupTestCase
4
- context 'acts_as_mediawiki' do
5
- setup do
6
- @wikitext = "== Wikitext Test Text =="
7
- end
8
-
9
- context 'using Wikitext' do
10
- setup do
11
- ActsAsMarkup.mediawiki_library = :wikitext
12
- class ::Post < ActiveRecord::Base
13
- acts_as_mediawiki :body
14
- end
15
- @post = Post.create!(:title => 'Blah', :body => @wikitext)
16
- end
17
-
18
- should "have a WikitextString object returned for the column value" do
19
- assert_kind_of WikitextString, @post.body
20
- end
21
-
22
- should "return original wikitext text for a `to_s` method call on the column value" do
23
- assert_equal @wikitext, @post.body.to_s
24
- end
25
-
26
- should 'return false for .blank?' do
27
- assert !@post.body.blank?
28
- end
29
-
30
- should "return formated html for a `to_html` method call on the column value" do
31
- assert_match(/<h2>Wikitext Test Text<\/h2>/, @post.body.to_html)
32
- end
33
-
34
- should "underscore spaces in URLs" do
35
- @post.body = "[[foo bar]]"
36
- assert_match(/<a href="\/wiki\/foo_bar">foo bar<\/a>/, @post.body.to_html)
37
- end
38
-
39
- context "changing value of wikitext field should return new wikitext object" do
40
- setup do
41
- @old_body = @post.body
42
- @post.body = "`@count = 20`"
43
- end
44
-
45
- should "still have an WikitextString object but not the same object" do
46
- assert_kind_of WikitextString, @post.body
47
- assert_not_same @post.body, @old_body
48
- end
49
-
50
- should "return correct text for `to_s`" do
51
- assert_equal "`@count = 20`", @post.body.to_s
52
- end
53
-
54
- should "return correct HTML for the `to_html` method" do
55
- assert_match(/<p><code>\@count\s\=\s20<\/code><\/p>/, @post.body.to_html)
56
- end
57
-
58
- teardown do
59
- @old_body = nil
60
- end
61
- end
62
-
63
- teardown do
64
- @post = nil
65
- Post.delete_all
66
- end
67
- end
68
-
69
- context 'using Wikitext with options' do
70
- setup do
71
- ActsAsMarkup.mediawiki_library = :wikitext
72
- class ::Post
73
- acts_as_mediawiki :body, :mediawiki_options => [ { :space_to_underscore => false } ]
74
- end
75
- @post = Post.new(:title => 'Blah')
76
- end
77
-
78
- should "not underscore spaces in URLs because of :space_to_underscore option" do
79
- @post.body = "[[foo bar]]"
80
- assert_match(/<a href="\/wiki\/foo%20bar">foo bar<\/a>/, @post.body.to_html)
81
- end
82
-
83
- teardown do
84
- @post = nil
85
- end
86
- end
87
-
88
- context 'using WikiCloth' do
89
- setup do
90
- ActsAsMarkup.mediawiki_library = :wikicloth
91
- class ::Post < ActiveRecord::Base
92
- acts_as_mediawiki :body
93
- end
94
- @post = Post.create!(:title => 'Blah', :body => @wikitext)
95
- end
96
-
97
- should "have a WikitextString object returned for the column value" do
98
- assert_kind_of WikiClothText, @post.body
99
- end
100
-
101
- should "return original wikitext text for a `to_s` method call on the column value" do
102
- assert_equal @wikitext, @post.body.to_s
103
- end
104
-
105
- should 'return false for .blank?' do
106
- assert !@post.body.blank?
107
- end
108
-
109
- should "return formated html for a `to_html` method call on the column value" do
110
- assert_match(/<h2>.*Wikitext Test Text.*<\/h2>/, @post.body.to_html)
111
- end
112
-
113
- should "render a link" do
114
- @post.body = "[http://www.example.com/ Test]"
115
- assert_match(%r[<a href="http://www.example.com/" target="_blank">Test</a>], @post.body.to_html)
116
- end
117
-
118
- context "changing value of wikitext field should return new wikitext object" do
119
- setup do
120
- @old_body = @post.body
121
- @post.body = "'''This is very important'''"
122
- end
123
-
124
- should "still have an WikitextString object but not the same object" do
125
- assert_kind_of WikiClothText, @post.body
126
- assert_not_same @post.body, @old_body
127
- end
128
-
129
- should "return correct text for `to_s`" do
130
- assert_equal "'''This is very important'''", @post.body.to_s
131
- end
132
-
133
- should "return correct HTML for the `to_html` method" do
134
- assert_match(/<p><b>This is very important<\/b><\/p>/, @post.body.to_html)
135
- end
136
-
137
- teardown do
138
- @old_body = nil
139
- end
140
- end
141
-
142
- teardown do
143
- @post = nil
144
- Post.delete_all
145
- end
146
- end
147
-
148
- teardown do
149
- @wikitext = nil
150
- end
151
- end
152
- end