mattmatt-jekyll 0.4.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/History.txt +91 -0
 - data/README.textile +494 -0
 - data/Rakefile +76 -0
 - data/TODO +3 -0
 - data/VERSION.yml +4 -0
 - data/bin/jekyll +142 -0
 - data/lib/jekyll.rb +64 -0
 - data/lib/jekyll/albino.rb +116 -0
 - data/lib/jekyll/converters/csv.rb +26 -0
 - data/lib/jekyll/converters/mephisto.rb +79 -0
 - data/lib/jekyll/converters/mt.rb +59 -0
 - data/lib/jekyll/converters/textpattern.rb +50 -0
 - data/lib/jekyll/converters/typo.rb +49 -0
 - data/lib/jekyll/converters/wordpress.rb +54 -0
 - data/lib/jekyll/convertible.rb +71 -0
 - data/lib/jekyll/core_ext.rb +22 -0
 - data/lib/jekyll/filters.rb +39 -0
 - data/lib/jekyll/layout.rb +33 -0
 - data/lib/jekyll/page.rb +64 -0
 - data/lib/jekyll/post.rb +194 -0
 - data/lib/jekyll/site.rb +173 -0
 - data/lib/jekyll/tags/highlight.rb +53 -0
 - data/lib/jekyll/tags/include.rb +31 -0
 - data/test/helper.rb +14 -0
 - data/test/source/_includes/sig.markdown +3 -0
 - data/test/source/_layouts/default.html +27 -0
 - data/test/source/_layouts/simple.html +1 -0
 - data/test/source/_posts/2008-02-02-not-published.textile +8 -0
 - data/test/source/_posts/2008-02-02-published.textile +8 -0
 - data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
 - data/test/source/_posts/2008-11-21-complex.textile +8 -0
 - data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
 - data/test/source/_posts/2008-12-13-include.markdown +8 -0
 - data/test/source/_posts/2009-01-27-categories.textile +7 -0
 - data/test/source/_posts/2009-01-27-category.textile +7 -0
 - data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
 - data/test/source/css/screen.css +76 -0
 - data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
 - data/test/source/index.html +22 -0
 - data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
 - data/test/suite.rb +9 -0
 - data/test/test_filters.rb +37 -0
 - data/test/test_generated_site.rb +32 -0
 - data/test/test_jekyll.rb +0 -0
 - data/test/test_post.rb +144 -0
 - data/test/test_site.rb +36 -0
 - data/test/test_tags.rb +31 -0
 - metadata +230 -0
 
    
        data/test/helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'test/unit'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'redgreen'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            include Jekyll
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            def dest_dir
         
     | 
| 
      
 9 
     | 
    
         
            +
              File.join(File.dirname(__FILE__), *%w[dest])
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            def clear_dest
         
     | 
| 
      
 13 
     | 
    
         
            +
              FileUtils.rm_rf(dest_dir)
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         
     | 
| 
      
 2 
     | 
    
         
            +
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
         
     | 
| 
      
 5 
     | 
    
         
            +
            <head>
         
     | 
| 
      
 6 
     | 
    
         
            +
               <meta http-equiv="content-type" content="text/html; charset=utf-8" />
         
     | 
| 
      
 7 
     | 
    
         
            +
               <title>{{ page.title }}</title>
         
     | 
| 
      
 8 
     | 
    
         
            +
               <meta name="author" content="<%= @page.author %>" />
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
               <!-- CodeRay syntax highlighting CSS -->
         
     | 
| 
      
 11 
     | 
    
         
            +
               <link rel="stylesheet" href="/css/coderay.css" type="text/css" />
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
               <!-- Homepage CSS -->
         
     | 
| 
      
 14 
     | 
    
         
            +
               <link rel="stylesheet" href="/css/screen.css" type="text/css" media="screen, projection" />
         
     | 
| 
      
 15 
     | 
    
         
            +
            </head>
         
     | 
| 
      
 16 
     | 
    
         
            +
            <body>
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            <div class="site">
         
     | 
| 
      
 19 
     | 
    
         
            +
              <div class="title">
         
     | 
| 
      
 20 
     | 
    
         
            +
                Tom Preston-Werner
         
     | 
| 
      
 21 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
              {{ content }}
         
     | 
| 
      
 24 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            </body>
         
     | 
| 
      
 27 
     | 
    
         
            +
            </html>
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <<< {{ content }} >>>
         
     | 
| 
         @@ -0,0 +1,76 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /*****************************************************************************/
         
     | 
| 
      
 2 
     | 
    
         
            +
            /*
         
     | 
| 
      
 3 
     | 
    
         
            +
            /* Common
         
     | 
| 
      
 4 
     | 
    
         
            +
            /*
         
     | 
| 
      
 5 
     | 
    
         
            +
            /*****************************************************************************/
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            /* Global Reset */
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * {
         
     | 
| 
      
 10 
     | 
    
         
            +
              margin: 0;
         
     | 
| 
      
 11 
     | 
    
         
            +
              padding: 0;
         
     | 
| 
      
 12 
     | 
    
         
            +
            }
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            html, body {
         
     | 
| 
      
 15 
     | 
    
         
            +
              height: 100%;
         
     | 
| 
      
 16 
     | 
    
         
            +
            }
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            body {
         
     | 
| 
      
 19 
     | 
    
         
            +
              background-color: white;
         
     | 
| 
      
 20 
     | 
    
         
            +
              font: 13.34px helvetica, arial, clean, sans-serif;
         
     | 
| 
      
 21 
     | 
    
         
            +
              *font-size: small;
         
     | 
| 
      
 22 
     | 
    
         
            +
              text-align: center;
         
     | 
| 
      
 23 
     | 
    
         
            +
            }
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            h1, h2, h3, h4, h5, h6 {
         
     | 
| 
      
 26 
     | 
    
         
            +
              font-size: 100%;
         
     | 
| 
      
 27 
     | 
    
         
            +
            }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            h1 {
         
     | 
| 
      
 30 
     | 
    
         
            +
              margin-bottom: 1em;
         
     | 
| 
      
 31 
     | 
    
         
            +
            }
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            p {
         
     | 
| 
      
 34 
     | 
    
         
            +
              margin: 1em 0;
         
     | 
| 
      
 35 
     | 
    
         
            +
            }
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            a {
         
     | 
| 
      
 38 
     | 
    
         
            +
              color: #00a;
         
     | 
| 
      
 39 
     | 
    
         
            +
            }
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            a:hover {
         
     | 
| 
      
 42 
     | 
    
         
            +
              color: black;
         
     | 
| 
      
 43 
     | 
    
         
            +
            }
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            a:visited {
         
     | 
| 
      
 46 
     | 
    
         
            +
              color: #a0a;
         
     | 
| 
      
 47 
     | 
    
         
            +
            }
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            table {
         
     | 
| 
      
 50 
     | 
    
         
            +
              font-size: inherit;
         
     | 
| 
      
 51 
     | 
    
         
            +
              font: 100%;
         
     | 
| 
      
 52 
     | 
    
         
            +
            }
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            /*****************************************************************************/
         
     | 
| 
      
 55 
     | 
    
         
            +
            /*
         
     | 
| 
      
 56 
     | 
    
         
            +
            /* Site
         
     | 
| 
      
 57 
     | 
    
         
            +
            /*
         
     | 
| 
      
 58 
     | 
    
         
            +
            /*****************************************************************************/
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            .site {
         
     | 
| 
      
 61 
     | 
    
         
            +
              font-size: 110%;
         
     | 
| 
      
 62 
     | 
    
         
            +
              text-align: justify;
         
     | 
| 
      
 63 
     | 
    
         
            +
              width: 40em;
         
     | 
| 
      
 64 
     | 
    
         
            +
              margin: 3em auto 2em auto;
         
     | 
| 
      
 65 
     | 
    
         
            +
              line-height: 1.5em;
         
     | 
| 
      
 66 
     | 
    
         
            +
            }
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            .title {
         
     | 
| 
      
 69 
     | 
    
         
            +
              color: #a00;
         
     | 
| 
      
 70 
     | 
    
         
            +
              font-weight: bold;
         
     | 
| 
      
 71 
     | 
    
         
            +
              margin-bottom: 2em;
         
     | 
| 
      
 72 
     | 
    
         
            +
            }
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            .site .meta {
         
     | 
| 
      
 75 
     | 
    
         
            +
              color: #aaa;
         
     | 
| 
      
 76 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            layout: default
         
     | 
| 
      
 3 
     | 
    
         
            +
            title: Tom Preston-Werner
         
     | 
| 
      
 4 
     | 
    
         
            +
            ---
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            h1. Welcome to my site
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            h2. Please read our {{ site.posts | size }} Posts
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            <ul>
         
     | 
| 
      
 11 
     | 
    
         
            +
              {% for post in site.posts %}
         
     | 
| 
      
 12 
     | 
    
         
            +
                <li>{{ post.date }} <a href="{{ post.url }}">{{ post.title }}</a></li>
         
     | 
| 
      
 13 
     | 
    
         
            +
              {% endfor %}
         
     | 
| 
      
 14 
     | 
    
         
            +
            </ul>
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            {% assign first_post = site.posts.first %}
         
     | 
| 
      
 17 
     | 
    
         
            +
            <div id="first_post">
         
     | 
| 
      
 18 
     | 
    
         
            +
              <h1>{{ first_post.title }}</h1>
         
     | 
| 
      
 19 
     | 
    
         
            +
              <div>
         
     | 
| 
      
 20 
     | 
    
         
            +
                {{ first_post.content }}
         
     | 
| 
      
 21 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 22 
     | 
    
         
            +
            </div>
         
     | 
    
        data/test/suite.rb
    ADDED
    
    
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TestFilters < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              
         
     | 
| 
      
 5 
     | 
    
         
            +
              class JekyllFilter
         
     | 
| 
      
 6 
     | 
    
         
            +
                include Jekyll::Filters
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 10 
     | 
    
         
            +
                @filter = JekyllFilter.new
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              def test_array_to_sentence_string_with_no_args
         
     | 
| 
      
 14 
     | 
    
         
            +
                assert_equal "", @filter.array_to_sentence_string([])
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def test_array_to_sentence_string_with_one_arg
         
     | 
| 
      
 18 
     | 
    
         
            +
                assert_equal "1", @filter.array_to_sentence_string([1])
         
     | 
| 
      
 19 
     | 
    
         
            +
                assert_equal "chunky", @filter.array_to_sentence_string(["chunky"])
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
              
         
     | 
| 
      
 22 
     | 
    
         
            +
              def test_array_to_sentence_string_with_two_args
         
     | 
| 
      
 23 
     | 
    
         
            +
                assert_equal "1 and 2", @filter.array_to_sentence_string([1, 2])
         
     | 
| 
      
 24 
     | 
    
         
            +
                assert_equal "chunky and bacon", @filter.array_to_sentence_string(["chunky", "bacon"])
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
              
         
     | 
| 
      
 27 
     | 
    
         
            +
              def test_array_to_sentence_string_with_multiple_args
         
     | 
| 
      
 28 
     | 
    
         
            +
                assert_equal "1, 2, 3, and 4", @filter.array_to_sentence_string([1, 2, 3, 4])
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"])
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
              
         
     | 
| 
      
 32 
     | 
    
         
            +
              def test_xml_escape_with_ampersands
         
     | 
| 
      
 33 
     | 
    
         
            +
                assert_equal "AT&T", @filter.xml_escape("AT&T")
         
     | 
| 
      
 34 
     | 
    
         
            +
                assert_equal "<code>command &lt;filename&gt;</code>", @filter.xml_escape("<code>command <filename></code>")
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
              
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TestGeneratedSite < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 5 
     | 
    
         
            +
                clear_dest
         
     | 
| 
      
 6 
     | 
    
         
            +
                @source = File.join(File.dirname(__FILE__), *%w[source])
         
     | 
| 
      
 7 
     | 
    
         
            +
                @s = Site.new(@source, dest_dir)
         
     | 
| 
      
 8 
     | 
    
         
            +
                @s.process
         
     | 
| 
      
 9 
     | 
    
         
            +
                @index = File.read(File.join(dest_dir, 'index.html'))
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
              
         
     | 
| 
      
 12 
     | 
    
         
            +
              def test_site_posts_in_index
         
     | 
| 
      
 13 
     | 
    
         
            +
                # confirm that {{ site.posts }} is working
         
     | 
| 
      
 14 
     | 
    
         
            +
                assert @index.include?("#{@s.posts.size} Posts")
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def test_post_content_in_index
         
     | 
| 
      
 18 
     | 
    
         
            +
                # confirm that the {{ post.content }} is rendered OK
         
     | 
| 
      
 19 
     | 
    
         
            +
                latest_post = Dir[File.join(@source, '_posts/*')].last
         
     | 
| 
      
 20 
     | 
    
         
            +
                post = Post.new(@source, '', File.basename(latest_post))
         
     | 
| 
      
 21 
     | 
    
         
            +
                Jekyll.content_type = post.determine_content_type
         
     | 
| 
      
 22 
     | 
    
         
            +
                post.transform
         
     | 
| 
      
 23 
     | 
    
         
            +
                assert @index.include?(post.content)
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def test_unpublished_posts_are_hidden
         
     | 
| 
      
 27 
     | 
    
         
            +
                published = Dir[File.join(dest_dir, 'publish_test/2008/02/02/*.html')].map {|f| File.basename(f)}
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                assert_equal 1, published.size
         
     | 
| 
      
 30 
     | 
    
         
            +
                assert_equal "published.html", published.first
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
    
        data/test/test_jekyll.rb
    ADDED
    
    | 
         
            File without changes
         
     | 
    
        data/test/test_post.rb
    ADDED
    
    | 
         @@ -0,0 +1,144 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TestPost < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 5 
     | 
    
         
            +
                
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              def test_valid
         
     | 
| 
      
 9 
     | 
    
         
            +
                assert Post.valid?("2008-10-19-foo-bar.textile")
         
     | 
| 
      
 10 
     | 
    
         
            +
                assert Post.valid?("foo/bar/2008-10-19-foo-bar.textile")
         
     | 
| 
      
 11 
     | 
    
         
            +
                
         
     | 
| 
      
 12 
     | 
    
         
            +
                assert !Post.valid?("lol2008-10-19-foo-bar.textile")
         
     | 
| 
      
 13 
     | 
    
         
            +
                assert !Post.valid?("blah")
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
              
         
     | 
| 
      
 16 
     | 
    
         
            +
              def test_process
         
     | 
| 
      
 17 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 18 
     | 
    
         
            +
                p.process("2008-10-19-foo-bar.textile")
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                assert_equal Time.parse("2008-10-19"), p.date
         
     | 
| 
      
 21 
     | 
    
         
            +
                assert_equal "foo-bar", p.slug
         
     | 
| 
      
 22 
     | 
    
         
            +
                assert_equal ".textile", p.ext
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
              
         
     | 
| 
      
 25 
     | 
    
         
            +
              def test_url
         
     | 
| 
      
 26 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 27 
     | 
    
         
            +
                p.categories = []
         
     | 
| 
      
 28 
     | 
    
         
            +
                p.process("2008-10-19-foo-bar.textile")
         
     | 
| 
      
 29 
     | 
    
         
            +
                
         
     | 
| 
      
 30 
     | 
    
         
            +
                assert_equal "/2008/10/19/foo-bar.html", p.url
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
              
         
     | 
| 
      
 33 
     | 
    
         
            +
              def test_permalink
         
     | 
| 
      
 34 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 35 
     | 
    
         
            +
                p.process("2008-12-03-permalinked-post.textile")
         
     | 
| 
      
 36 
     | 
    
         
            +
                p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                assert_equal "my_category/permalinked-post", p.permalink
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
              def test_dir_respects_permalink
         
     | 
| 
      
 42 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 43 
     | 
    
         
            +
                p.process("2008-12-03-permalinked-post.textile")
         
     | 
| 
      
 44 
     | 
    
         
            +
                p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                assert_equal "my_category/", p.dir
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
              
         
     | 
| 
      
 49 
     | 
    
         
            +
              def test_url_respects_permalink
         
     | 
| 
      
 50 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 51 
     | 
    
         
            +
                p.process("2008-12-03-permalinked-post.textile")
         
     | 
| 
      
 52 
     | 
    
         
            +
                p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                assert_equal "my_category/permalinked-post", p.url
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              def test_read_yaml
         
     | 
| 
      
 58 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 59 
     | 
    
         
            +
                p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
         
     | 
| 
      
 60 
     | 
    
         
            +
                
         
     | 
| 
      
 61 
     | 
    
         
            +
                assert_equal({"title" => "Foo Bar", "layout" => "default"}, p.data)
         
     | 
| 
      
 62 
     | 
    
         
            +
                assert_equal "\nh1. {{ page.title }}\n\nBest *post* ever", p.content
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
              
         
     | 
| 
      
 65 
     | 
    
         
            +
              def test_transform
         
     | 
| 
      
 66 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 67 
     | 
    
         
            +
                p.process("2008-10-18-foo-bar.textile")
         
     | 
| 
      
 68 
     | 
    
         
            +
                p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
         
     | 
| 
      
 69 
     | 
    
         
            +
                p.transform
         
     | 
| 
      
 70 
     | 
    
         
            +
                
         
     | 
| 
      
 71 
     | 
    
         
            +
                assert_equal "<h1>{{ page.title }}</h1>\n<p>Best <strong>post</strong> ever</p>", p.content
         
     | 
| 
      
 72 
     | 
    
         
            +
              end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
              def test_published
         
     | 
| 
      
 75 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '',  "2008-02-02-published.textile")
         
     | 
| 
      
 76 
     | 
    
         
            +
            		assert_equal true, p.published
         
     | 
| 
      
 77 
     | 
    
         
            +
              end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
              def test_not_published
         
     | 
| 
      
 80 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '',  "2008-02-02-not-published.textile")
         
     | 
| 
      
 81 
     | 
    
         
            +
            		assert_equal false, p.published
         
     | 
| 
      
 82 
     | 
    
         
            +
              end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
              def test_yaml_category
         
     | 
| 
      
 85 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '',  "2009-01-27-category.textile")
         
     | 
| 
      
 86 
     | 
    
         
            +
                assert p.categories.include?('foo')
         
     | 
| 
      
 87 
     | 
    
         
            +
              end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
              def test_yaml_categories
         
     | 
| 
      
 90 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '',  "2009-01-27-categories.textile")
         
     | 
| 
      
 91 
     | 
    
         
            +
                assert p.categories.include?('foo')
         
     | 
| 
      
 92 
     | 
    
         
            +
                assert p.categories.include?('bar')
         
     | 
| 
      
 93 
     | 
    
         
            +
                assert p.categories.include?('baz')
         
     | 
| 
      
 94 
     | 
    
         
            +
              end
         
     | 
| 
      
 95 
     | 
    
         
            +
              
         
     | 
| 
      
 96 
     | 
    
         
            +
              def test_render
         
     | 
| 
      
 97 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '',  "2008-10-18-foo-bar.textile")
         
     | 
| 
      
 98 
     | 
    
         
            +
                layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
         
     | 
| 
      
 99 
     | 
    
         
            +
                p.render(layouts, {"site" => {"posts" => []}})
         
     | 
| 
      
 100 
     | 
    
         
            +
                
         
     | 
| 
      
 101 
     | 
    
         
            +
                assert_equal "<<< <h1>Foo Bar</h1>\n<p>Best <strong>post</strong> ever</p> >>>", p.output
         
     | 
| 
      
 102 
     | 
    
         
            +
              end
         
     | 
| 
      
 103 
     | 
    
         
            +
              
         
     | 
| 
      
 104 
     | 
    
         
            +
              def test_write
         
     | 
| 
      
 105 
     | 
    
         
            +
                clear_dest
         
     | 
| 
      
 106 
     | 
    
         
            +
                
         
     | 
| 
      
 107 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-10-18-foo-bar.textile")
         
     | 
| 
      
 108 
     | 
    
         
            +
                layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
         
     | 
| 
      
 109 
     | 
    
         
            +
                p.render(layouts, {"site" => {"posts" => []}})
         
     | 
| 
      
 110 
     | 
    
         
            +
                p.write(dest_dir)
         
     | 
| 
      
 111 
     | 
    
         
            +
              end
         
     | 
| 
      
 112 
     | 
    
         
            +
              
         
     | 
| 
      
 113 
     | 
    
         
            +
              def test_data
         
     | 
| 
      
 114 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-11-21-complex.textile")
         
     | 
| 
      
 115 
     | 
    
         
            +
                layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
         
     | 
| 
      
 116 
     | 
    
         
            +
                p.render(layouts, {"site" => {"posts" => []}})
         
     | 
| 
      
 117 
     | 
    
         
            +
                
         
     | 
| 
      
 118 
     | 
    
         
            +
                assert_equal "<<< <p>url: /2008/11/21/complex.html<br />\ndate: #{Time.parse("2008-11-21")}<br />\nid: /2008/11/21/complex</p> >>>", p.output
         
     | 
| 
      
 119 
     | 
    
         
            +
              end
         
     | 
| 
      
 120 
     | 
    
         
            +
              
         
     | 
| 
      
 121 
     | 
    
         
            +
              def test_categories_and_topics
         
     | 
| 
      
 122 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
         
     | 
| 
      
 123 
     | 
    
         
            +
                assert_equal ['foo'], p.categories
         
     | 
| 
      
 124 
     | 
    
         
            +
                assert_equal ['bar'], p.topics
         
     | 
| 
      
 125 
     | 
    
         
            +
              end    
         
     | 
| 
      
 126 
     | 
    
         
            +
              
         
     | 
| 
      
 127 
     | 
    
         
            +
              def test_include
         
     | 
| 
      
 128 
     | 
    
         
            +
                Jekyll.source = File.join(File.dirname(__FILE__), *%w[source])
         
     | 
| 
      
 129 
     | 
    
         
            +
                p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-12-13-include.markdown")
         
     | 
| 
      
 130 
     | 
    
         
            +
                layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
         
     | 
| 
      
 131 
     | 
    
         
            +
                p.render(layouts, {"site" => {"posts" => []}})
         
     | 
| 
      
 132 
     | 
    
         
            +
                
         
     | 
| 
      
 133 
     | 
    
         
            +
                assert_equal "<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p> >>>", p.output
         
     | 
| 
      
 134 
     | 
    
         
            +
              end
         
     | 
| 
      
 135 
     | 
    
         
            +
              
         
     | 
| 
      
 136 
     | 
    
         
            +
              def test_dir_with_short_date_permalink_type
         
     | 
| 
      
 137 
     | 
    
         
            +
                Jekyll.permalink_style = :shortdate
         
     | 
| 
      
 138 
     | 
    
         
            +
                p = Post.allocate
         
     | 
| 
      
 139 
     | 
    
         
            +
                p.process("2008-02-03-permalinked-post.textile")
         
     | 
| 
      
 140 
     | 
    
         
            +
                p.categories = []
         
     | 
| 
      
 141 
     | 
    
         
            +
                assert_equal "/2008/2/3/", p.dir
         
     | 
| 
      
 142 
     | 
    
         
            +
                Jekyll.permalink_style = :date
         
     | 
| 
      
 143 
     | 
    
         
            +
              end
         
     | 
| 
      
 144 
     | 
    
         
            +
            end
         
     |