acts_as_markup 1.0.0 → 1.1.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/CHANGELOG +4 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/acts_as_markup.gemspec +4 -4
- data/lib/acts/as_markup.rb +10 -8
- data/lib/acts_as_markup.rb +1 -1
- data/test/acts_as_markup_test.rb +23 -1
- data/test/test_helper.rb +7 -0
- metadata +4 -4
    
        data/CHANGELOG
    CHANGED
    
    
    
        data/README.rdoc
    CHANGED
    
    | @@ -87,7 +87,7 @@ By default RDiscount will be used. | |
| 87 87 | 
             
            ==== Using +acts_as_markup+ with <tt>:variable</tt> language:
         | 
| 88 88 |  | 
| 89 89 | 
             
                class Post < ActiveRecrod
         | 
| 90 | 
            -
                  acts_as_markup :language => :variable, :columns => [:body] | 
| 90 | 
            +
                  acts_as_markup :language => :variable, :columns => [:body]
         | 
| 91 91 | 
             
                end
         | 
| 92 92 |  | 
| 93 93 | 
             
                @post = Post.find(:first)
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -13,7 +13,7 @@ PROJ.name = 'acts_as_markup' | |
| 13 13 | 
             
            PROJ.authors = 'Brian Landau'
         | 
| 14 14 | 
             
            PROJ.email = 'brian.landau@viget.com'
         | 
| 15 15 | 
             
            PROJ.url = 'http://viget.rubyforge.com/acts_as_markup'
         | 
| 16 | 
            -
            PROJ.description = "Represent ActiveRecord Markdown, Textile,  | 
| 16 | 
            +
            PROJ.description = "Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML."
         | 
| 17 17 | 
             
            PROJ.rubyforge.name = 'viget'
         | 
| 18 18 | 
             
            PROJ.version = ActsAsMarkup::VERSION
         | 
| 19 19 | 
             
            PROJ.rdoc.include = %w(^lib/ LICENSE CHANGELOG README\.rdoc)
         | 
    
        data/acts_as_markup.gemspec
    CHANGED
    
    | @@ -1,11 +1,11 @@ | |
| 1 1 | 
             
            Gem::Specification.new do |s|
         | 
| 2 2 | 
             
              s.name = %q{acts_as_markup}
         | 
| 3 | 
            -
              s.version = "1. | 
| 3 | 
            +
              s.version = "1.1.0"
         | 
| 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- | 
| 8 | 
            -
              s.description = %q{Represent ActiveRecord Markdown, Textile,  | 
| 7 | 
            +
              s.date = %q{2008-08-12}
         | 
| 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"]
         | 
| 11 11 | 
             
              s.files = ["CHANGELOG", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "acts_as_markup.gemspec", "lib/acts/as_markup.rb", "lib/acts_as_markup.rb", "lib/acts_as_markup/exts/maruku.rb", "lib/acts_as_markup/exts/rdiscount.rb", "lib/acts_as_markup/exts/rdoc.rb", "lib/acts_as_markup/exts/string.rb", "lib/acts_as_markup/exts/wikitext.rb", "tasks/bones.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/manifest.rake", "tasks/post_load.rake", "tasks/rdoc.rake", "tasks/rubyforge.rake", "tasks/setup.rb", "tasks/test.rake", "test/acts_as_markdown_test.rb", "test/acts_as_markup_test.rb", "test/acts_as_rdoc_test.rb", "test/acts_as_textile_test.rb", "test/acts_as_wikitext_test.rb", "test/test_helper.rb"]
         | 
| @@ -15,7 +15,7 @@ Gem::Specification.new do |s| | |
| 15 15 | 
             
              s.require_paths = ["lib"]
         | 
| 16 16 | 
             
              s.rubyforge_project = %q{viget}
         | 
| 17 17 | 
             
              s.rubygems_version = %q{1.2.0}
         | 
| 18 | 
            -
              s.summary = %q{Represent ActiveRecord Markdown, Textile,  | 
| 18 | 
            +
              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}
         | 
| 19 19 | 
             
              s.test_files = ["test/acts_as_markdown_test.rb", "test/acts_as_markup_test.rb", "test/acts_as_rdoc_test.rb", "test/acts_as_textile_test.rb", "test/acts_as_wikitext_test.rb"]
         | 
| 20 20 |  | 
| 21 21 | 
             
              if s.respond_to? :specification_version then
         | 
    
        data/lib/acts/as_markup.rb
    CHANGED
    
    | @@ -13,12 +13,13 @@ module ActiveRecord # :nodoc: | |
| 13 13 | 
             
                    # Markdown, Textile, Wikitext or RDoc content.
         | 
| 14 14 | 
             
                    # Then you can simply call <tt>.to_html</tt> method on the attribute.
         | 
| 15 15 | 
             
                    # 
         | 
| 16 | 
            -
                    # You can also specify the language as <tt>:variable</tt | 
| 17 | 
            -
                    #  | 
| 18 | 
            -
                    #  | 
| 19 | 
            -
                    #  | 
| 20 | 
            -
                    #  | 
| 21 | 
            -
                    #  | 
| 16 | 
            +
                    # You can also specify the language as <tt>:variable</tt>. The language used
         | 
| 17 | 
            +
                    # to process the column will be based on another column. By default a column
         | 
| 18 | 
            +
                    # named "<tt>markup_language</tt>" is used, but this can be changed by providing 
         | 
| 19 | 
            +
                    # a <tt>:language_column</tt> option. When a value is accessed it will create 
         | 
| 20 | 
            +
                    # the correct object (Markdown, Textile, Wikitext or RDoc) based on the value 
         | 
| 21 | 
            +
                    # of the language column. If any value besides markdown, textile, wikitext, or 
         | 
| 22 | 
            +
                    # RDoc is supplied for the markup language the text will pass through as a string.
         | 
| 22 23 | 
             
                    # 
         | 
| 23 24 | 
             
                    # 
         | 
| 24 25 | 
             
                    # ==== Examples
         | 
| @@ -37,11 +38,11 @@ module ActiveRecord # :nodoc: | |
| 37 38 | 
             
                    # ===== Using variable language
         | 
| 38 39 | 
             
                    # 
         | 
| 39 40 | 
             
                    #     class Post < ActiveRecrod
         | 
| 40 | 
            -
                    #       acts_as_markup :language => :variable, :columns => [:body], :language_column => ' | 
| 41 | 
            +
                    #       acts_as_markup :language => :variable, :columns => [:body], :language_column => 'language_name'
         | 
| 41 42 | 
             
                    #     end
         | 
| 42 43 | 
             
                    #     
         | 
| 43 44 | 
             
                    #     @post = Post.find(:first)
         | 
| 44 | 
            -
                    #     @post. | 
| 45 | 
            +
                    #     @post.language_name        # => "markdown"
         | 
| 45 46 | 
             
                    #     @post.body.to_s            # => "## Markdown Headline"
         | 
| 46 47 | 
             
                    #     @post.body.to_html         # => "<h2> Markdown Headline</h2>"
         | 
| 47 48 | 
             
                    #     
         | 
| @@ -73,6 +74,7 @@ module ActiveRecord # :nodoc: | |
| 73 74 | 
             
                        textile_klass = 'RedCloth'
         | 
| 74 75 | 
             
                        wiki_klass = 'WikitextString'
         | 
| 75 76 | 
             
                        rdoc_klass = 'RDocText'
         | 
| 77 | 
            +
                        options[:language_column] ||= :markup_language
         | 
| 76 78 | 
             
                      else
         | 
| 77 79 | 
             
                        raise ActsAsMarkup::UnsportedMarkupLanguage, "#{options[:langauge]} is not a currently supported markup language."
         | 
| 78 80 | 
             
                      end
         | 
    
        data/lib/acts_as_markup.rb
    CHANGED
    
    
    
        data/test/acts_as_markup_test.rb
    CHANGED
    
    | @@ -78,7 +78,7 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase | |
| 78 78 | 
             
                setup do
         | 
| 79 79 | 
             
                  ActsAsMarkup.markdown_library = ActsAsMarkup::DEFAULT_MAKRDOWN_LIB
         | 
| 80 80 | 
             
                  class ::VariablePost < ActiveRecord::Base
         | 
| 81 | 
            -
                    acts_as_markup :language => :variable, :columns => [:body] | 
| 81 | 
            +
                    acts_as_markup :language => :variable, :columns => [:body]
         | 
| 82 82 | 
             
                  end
         | 
| 83 83 | 
             
                end
         | 
| 84 84 |  | 
| @@ -323,6 +323,28 @@ class ActsAsMarkupTest < ActsAsMarkupTestCase | |
| 323 323 | 
             
                end
         | 
| 324 324 | 
             
              end
         | 
| 325 325 |  | 
| 326 | 
            +
              context 'acts_as_markup with variable language setting the language column' do
         | 
| 327 | 
            +
                setup do
         | 
| 328 | 
            +
                  ActsAsMarkup.markdown_library = ActsAsMarkup::DEFAULT_MAKRDOWN_LIB
         | 
| 329 | 
            +
                  class ::VariableLanguagePost < ActiveRecord::Base
         | 
| 330 | 
            +
                    acts_as_markup :language => :variable, :columns => [:body], :language_column => :language_name
         | 
| 331 | 
            +
                  end
         | 
| 332 | 
            +
                end
         | 
| 333 | 
            +
                
         | 
| 334 | 
            +
                should "use the correct language column" do
         | 
| 335 | 
            +
                  markdown_text = '## Markdown Test Text'
         | 
| 336 | 
            +
                  markdown_post = VariableLanguagePost.create!(:title => 'Blah', :body => markdown_text, :language_name => 'Markdown')
         | 
| 337 | 
            +
                  
         | 
| 338 | 
            +
                  assert_kind_of RDiscount, markdown_post.body
         | 
| 339 | 
            +
                  assert_equal markdown_text, markdown_post.body.to_s
         | 
| 340 | 
            +
                  assert_match(/<h2(\s\w+\=['"]\w*['"])*\s*>\s*Markdown Test Text\s*<\/h2>/, markdown_post.body.to_html)
         | 
| 341 | 
            +
                end
         | 
| 342 | 
            +
                
         | 
| 343 | 
            +
                teardown do
         | 
| 344 | 
            +
                  VariableLanguagePost.delete_all
         | 
| 345 | 
            +
                end
         | 
| 346 | 
            +
              end
         | 
| 347 | 
            +
              
         | 
| 326 348 | 
             
              context 'with a nil value for the text' do
         | 
| 327 349 | 
             
                setup do
         | 
| 328 350 | 
             
                  @text = nil
         | 
    
        data/test/test_helper.rb
    CHANGED
    
    | @@ -32,6 +32,13 @@ def setup_db | |
| 32 32 | 
             
                  t.column :markup_language, :string
         | 
| 33 33 | 
             
                  t.timestamps
         | 
| 34 34 | 
             
                end
         | 
| 35 | 
            +
                
         | 
| 36 | 
            +
                create_table :variable_language_posts do |t|
         | 
| 37 | 
            +
                  t.column :title, :string
         | 
| 38 | 
            +
                  t.column :body, :text
         | 
| 39 | 
            +
                  t.column :language_name, :string
         | 
| 40 | 
            +
                  t.timestamps
         | 
| 41 | 
            +
                end
         | 
| 35 42 | 
             
              end
         | 
| 36 43 | 
             
            end
         | 
| 37 44 |  | 
    
        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. | 
| 4 | 
            +
              version: 1.1.0
         | 
| 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-12 00:00:00 -04:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -62,7 +62,7 @@ dependencies: | |
| 62 62 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 63 63 | 
             
                    version: 1.1.1
         | 
| 64 64 | 
             
                version: 
         | 
| 65 | 
            -
            description: Represent ActiveRecord Markdown, Textile,  | 
| 65 | 
            +
            description: Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML.
         | 
| 66 66 | 
             
            email: brian.landau@viget.com
         | 
| 67 67 | 
             
            executables: []
         | 
| 68 68 |  | 
| @@ -127,7 +127,7 @@ rubyforge_project: viget | |
| 127 127 | 
             
            rubygems_version: 1.2.0
         | 
| 128 128 | 
             
            signing_key: 
         | 
| 129 129 | 
             
            specification_version: 2
         | 
| 130 | 
            -
            summary: Represent ActiveRecord Markdown, Textile,  | 
| 130 | 
            +
            summary: Represent ActiveRecord Markdown, Textile, Wiki text, RDoc columns as Markdown, Textile Wikitext, RDoc objects using various external libraries to convert to HTML
         | 
| 131 131 | 
             
            test_files: 
         | 
| 132 132 | 
             
            - test/acts_as_markdown_test.rb
         | 
| 133 133 | 
             
            - test/acts_as_markup_test.rb
         |