acts_as_markup 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +25 -0
- data/acts_as_markup.gemspec +2 -2
- data/lib/acts/as_markup.rb +1 -1
- data/lib/acts_as_markup.rb +3 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -118,3 +118,28 @@ Add "+acts_as_markup+" to your environment.rb:
|
|
118
118
|
|
119
119
|
config.gem "acts_as_markup"
|
120
120
|
|
121
|
+
== CONTRIBUTING:
|
122
|
+
|
123
|
+
Make a fork on GitHub, make your changes and do a pull request. Good places to start are adding new Markdown libraries or new markup languages, here's instructions for both:
|
124
|
+
|
125
|
+
=== Instructions for how to add a new Markdown Library:
|
126
|
+
|
127
|
+
1. Add another item to the <tt>ActsAsMarkup::MARKDOWN_LIBS</tt> hash in the form of:
|
128
|
+
:bluecloth => {:class_name => "BlueCloth",
|
129
|
+
:lib_name => "bluecloth"}
|
130
|
+
<tt>:lib_name</tt> should be the name needed to require the library, while <tt>:class_name</tt> should be the class that we are making an instance of.
|
131
|
+
2. If you need to modify the object in anyway (e.g. to add a <tt>to_s</tt> or <tt>to_html</tt> method), add a file to the "lib/acts_as_markup/exts/" directory.
|
132
|
+
3. Add appropriate tests (see current tests).
|
133
|
+
|
134
|
+
=== Instructions for how to add a new Markup Language:
|
135
|
+
|
136
|
+
1. Add a "<tt>when</tt>" statement to the "<tt>case</tt>" statement in <tt>acts_as_markup</tt>. The "<tt>when</tt>" statement should match with a symbol that represents the language name in some way (e.g. "<tt>:markdown</tt>").
|
137
|
+
2. In the "<tt>when</tt>" block you need to set the "<tt>klass</tt>" local variable and require the library and the extension file if you need one (use the special <tt>require_extensions</tt> method to require extensions).
|
138
|
+
3. Add the same lines you added to the previous "<tt>when</tt>" statement to the "<tt>:variable</tt>" "<tt>when</tt>" statement. But replace "<tt>klass</tt>" with "<tt>language_klass</tt>" (e.g. "<tt>markdown_klass</tt>").
|
139
|
+
4. Add a relevant "<tt>when</tt>" statement to the <tt>class_eval</tt> block for the "<tt>:variable</tt>" language option. This should look something like:
|
140
|
+
when /markdown/i
|
141
|
+
@#{col.to_s} = #{markdown_klass}.new(self['#{col.to_s}'].to_s)
|
142
|
+
5. Add a convenience method (e.g. "<tt>acts_as_markdown</tt>")
|
143
|
+
6. Add an extension file to the "lib/acts_as_markup/exts/" directory if you need to modify the object in anyway.
|
144
|
+
7. Add appropriate tests (see current tests).
|
145
|
+
|
data/acts_as_markup.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{acts_as_markup}
|
3
|
-
s.version = "1.1.
|
3
|
+
s.version = "1.1.1"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Brian Landau"]
|
7
|
-
s.date = %q{2008-08-
|
7
|
+
s.date = %q{2008-08-14}
|
8
8
|
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.}
|
9
9
|
s.email = %q{brian.landau@viget.com}
|
10
10
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc"]
|
data/lib/acts/as_markup.rb
CHANGED
@@ -159,7 +159,7 @@ module ActiveRecord # :nodoc:
|
|
159
159
|
end
|
160
160
|
|
161
161
|
def require_extensions(library)# :nodoc:
|
162
|
-
if
|
162
|
+
if ActsAsMarkup::LIBRARY_EXTENSIONS.include? library.to_s
|
163
163
|
require "acts_as_markup/exts/#{library.to_s}"
|
164
164
|
end
|
165
165
|
end
|
data/lib/acts_as_markup.rb
CHANGED
@@ -2,7 +2,7 @@ require 'active_support'
|
|
2
2
|
|
3
3
|
module ActsAsMarkup
|
4
4
|
# :stopdoc:
|
5
|
-
VERSION = '1.1.
|
5
|
+
VERSION = '1.1.1'
|
6
6
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
7
7
|
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
8
8
|
# :startdoc:
|
@@ -25,6 +25,8 @@ module ActsAsMarkup
|
|
25
25
|
:lib_name => "peg_markdown"},
|
26
26
|
:maruku => {:class_name => "Maruku",
|
27
27
|
:lib_name => "maruku"} }
|
28
|
+
|
29
|
+
LIBRARY_EXTENSIONS = Set.new(Dir[ActsAsMarkup::LIBPATH + 'acts_as_markup/exts/*.rb'].map {|file| File.basename(file, '.rb')}).delete('string')
|
28
30
|
|
29
31
|
@@markdown_library = DEFAULT_MAKRDOWN_LIB
|
30
32
|
mattr_accessor :markdown_library
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Landau
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-14 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|