jekyll 3.2.0.pre.beta1 → 3.2.0.pre.beta2
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.
Potentially problematic release.
This version of jekyll might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/.rubocop.yml +17 -95
 - data/README.markdown +6 -4
 - data/{bin → exe}/jekyll +18 -14
 - data/lib/jekyll.rb +79 -76
 - data/lib/jekyll/collection.rb +32 -16
 - data/lib/jekyll/command.rb +17 -13
 - data/lib/jekyll/commands/build.rb +7 -2
 - data/lib/jekyll/commands/doctor.rb +3 -1
 - data/lib/jekyll/commands/new.rb +3 -0
 - data/lib/jekyll/commands/new_theme.rb +7 -4
 - data/lib/jekyll/commands/serve.rb +2 -0
 - data/lib/jekyll/commands/serve/servlet.rb +2 -2
 - data/lib/jekyll/configuration.rb +187 -125
 - data/lib/jekyll/converters/markdown.rb +19 -9
 - data/lib/jekyll/converters/markdown/kramdown_parser.rb +12 -5
 - data/lib/jekyll/converters/markdown/rdiscount_parser.rb +4 -4
 - data/lib/jekyll/converters/markdown/redcarpet_parser.rb +90 -84
 - data/lib/jekyll/convertible.rb +34 -21
 - data/lib/jekyll/deprecator.rb +11 -6
 - data/lib/jekyll/document.rb +52 -50
 - data/lib/jekyll/drops/document_drop.rb +40 -5
 - data/lib/jekyll/drops/drop.rb +49 -10
 - data/lib/jekyll/drops/excerpt_drop.rb +15 -0
 - data/lib/jekyll/drops/jekyll_drop.rb +12 -0
 - data/lib/jekyll/drops/site_drop.rb +4 -2
 - data/lib/jekyll/drops/url_drop.rb +4 -4
 - data/lib/jekyll/entry_filter.rb +9 -6
 - data/lib/jekyll/errors.rb +4 -3
 - data/lib/jekyll/excerpt.rb +4 -6
 - data/lib/jekyll/external.rb +4 -4
 - data/lib/jekyll/filters.rb +67 -34
 - data/lib/jekyll/frontmatter_defaults.rb +45 -38
 - data/lib/jekyll/hooks.rb +21 -21
 - data/lib/jekyll/layout.rb +3 -1
 - data/lib/jekyll/liquid_renderer.rb +7 -3
 - data/lib/jekyll/liquid_renderer/file.rb +1 -1
 - data/lib/jekyll/liquid_renderer/table.rb +11 -11
 - data/lib/jekyll/log_adapter.rb +2 -2
 - data/lib/jekyll/page.rb +10 -10
 - data/lib/jekyll/plugin.rb +5 -5
 - data/lib/jekyll/plugin_manager.rb +12 -8
 - data/lib/jekyll/publisher.rb +1 -1
 - data/lib/jekyll/reader.rb +11 -7
 - data/lib/jekyll/readers/data_reader.rb +9 -9
 - data/lib/jekyll/readers/layout_reader.rb +7 -7
 - data/lib/jekyll/readers/page_reader.rb +3 -1
 - data/lib/jekyll/readers/post_reader.rb +9 -10
 - data/lib/jekyll/readers/static_file_reader.rb +3 -1
 - data/lib/jekyll/regenerator.rb +50 -28
 - data/lib/jekyll/related_posts.rb +1 -1
 - data/lib/jekyll/renderer.rb +29 -20
 - data/lib/jekyll/site.rb +92 -50
 - data/lib/jekyll/static_file.rb +33 -26
 - data/lib/jekyll/stevenson.rb +6 -5
 - data/lib/jekyll/tags/highlight.rb +50 -35
 - data/lib/jekyll/tags/include.rb +42 -31
 - data/lib/jekyll/tags/link.rb +11 -4
 - data/lib/jekyll/tags/post_url.rb +8 -7
 - data/lib/jekyll/theme.rb +4 -3
 - data/lib/jekyll/theme_builder.rb +18 -6
 - data/lib/jekyll/url.rb +21 -14
 - data/lib/jekyll/utils.rb +57 -28
 - data/lib/jekyll/utils/ansi.rb +9 -9
 - data/lib/jekyll/utils/platforms.rb +2 -2
 - data/lib/jekyll/version.rb +1 -1
 - data/lib/site_template/_config.yml +2 -0
 - data/lib/site_template/css/main.scss +3 -17
 - data/lib/theme_template/_layouts/default.html +1 -0
 - data/lib/theme_template/_layouts/page.html +5 -0
 - data/lib/theme_template/_layouts/post.html +5 -0
 - data/lib/theme_template/example/_post.md +1 -2
 - data/lib/theme_template/example/index.html +2 -2
 - data/lib/theme_template/gitignore.erb +4 -0
 - data/lib/theme_template/theme.gemspec.erb +2 -6
 - metadata +10 -18
 - data/lib/site_template/_includes/footer.html +0 -38
 - data/lib/site_template/_includes/head.html +0 -12
 - data/lib/site_template/_includes/header.html +0 -27
 - data/lib/site_template/_includes/icon-github.html +0 -1
 - data/lib/site_template/_includes/icon-github.svg +0 -1
 - data/lib/site_template/_includes/icon-twitter.html +0 -1
 - data/lib/site_template/_includes/icon-twitter.svg +0 -1
 - data/lib/site_template/_layouts/default.html +0 -20
 - data/lib/site_template/_layouts/page.html +0 -14
 - data/lib/site_template/_layouts/post.html +0 -15
 - data/lib/site_template/_sass/_base.scss +0 -200
 - data/lib/site_template/_sass/_layout.scss +0 -242
 - data/lib/site_template/_sass/_syntax-highlighting.scss +0 -71
 
| 
         @@ -9,23 +9,33 @@ module Jekyll 
     | 
|
| 
       9 
9 
     | 
    
         
             
                    return if @setup ||= false
         
     | 
| 
       10 
10 
     | 
    
         
             
                    unless (@parser = get_processor)
         
     | 
| 
       11 
11 
     | 
    
         
             
                      Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
         
     | 
| 
       12 
     | 
    
         
            -
                       
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
                      if @config["safe"]
         
     | 
| 
      
 13 
     | 
    
         
            +
                        Jekyll.logger.info "", "Custom processors are not loaded in safe mode"
         
     | 
| 
      
 14 
     | 
    
         
            +
                      end
         
     | 
| 
      
 15 
     | 
    
         
            +
                      Jekyll.logger.error(
         
     | 
| 
      
 16 
     | 
    
         
            +
                        "",
         
     | 
| 
      
 17 
     | 
    
         
            +
                        "Available processors are: #{valid_processors.join(", ")}"
         
     | 
| 
      
 18 
     | 
    
         
            +
                      )
         
     | 
| 
       14 
19 
     | 
    
         
             
                      raise Errors::FatalException, "Bailing out; invalid Markdown processor."
         
     | 
| 
       15 
20 
     | 
    
         
             
                    end
         
     | 
| 
       16 
21 
     | 
    
         | 
| 
       17 
22 
     | 
    
         
             
                    @setup = true
         
     | 
| 
       18 
23 
     | 
    
         
             
                  end
         
     | 
| 
       19 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
                  # Rubocop does not allow reader methods to have names starting with `get_`
         
     | 
| 
      
 26 
     | 
    
         
            +
                  # To ensure compatibility, this check has been disabled on this method
         
     | 
| 
      
 27 
     | 
    
         
            +
                  #
         
     | 
| 
      
 28 
     | 
    
         
            +
                  # rubocop:disable Style/AccessorMethodName
         
     | 
| 
       20 
29 
     | 
    
         
             
                  def get_processor
         
     | 
| 
       21 
30 
     | 
    
         
             
                    case @config["markdown"].downcase
         
     | 
| 
       22 
31 
     | 
    
         
             
                    when "redcarpet" then return RedcarpetParser.new(@config)
         
     | 
| 
       23 
32 
     | 
    
         
             
                    when "kramdown"  then return KramdownParser.new(@config)
         
     | 
| 
       24 
33 
     | 
    
         
             
                    when "rdiscount" then return RDiscountParser.new(@config)
         
     | 
| 
       25 
34 
     | 
    
         
             
                    else
         
     | 
| 
       26 
     | 
    
         
            -
                       
     | 
| 
      
 35 
     | 
    
         
            +
                      custom_processor
         
     | 
| 
       27 
36 
     | 
    
         
             
                    end
         
     | 
| 
       28 
37 
     | 
    
         
             
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  # rubocop:enable Style/AccessorMethodName
         
     | 
| 
       29 
39 
     | 
    
         | 
| 
       30 
40 
     | 
    
         
             
                  # Public: Provides you with a list of processors, the ones we
         
     | 
| 
       31 
41 
     | 
    
         
             
                  # support internally and the ones that you have provided to us (if you
         
     | 
| 
         @@ -41,13 +51,13 @@ module Jekyll 
     | 
|
| 
       41 
51 
     | 
    
         | 
| 
       42 
52 
     | 
    
         
             
                  def third_party_processors
         
     | 
| 
       43 
53 
     | 
    
         
             
                    self.class.constants - \
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 54 
     | 
    
         
            +
                      %w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
         
     | 
| 
      
 55 
     | 
    
         
            +
                        &:to_sym
         
     | 
| 
      
 56 
     | 
    
         
            +
                      )
         
     | 
| 
       47 
57 
     | 
    
         
             
                  end
         
     | 
| 
       48 
58 
     | 
    
         | 
| 
       49 
59 
     | 
    
         
             
                  def extname_list
         
     | 
| 
       50 
     | 
    
         
            -
                    @extname_list ||= @config[ 
     | 
| 
      
 60 
     | 
    
         
            +
                    @extname_list ||= @config["markdown_ext"].split(",").map do |e|
         
     | 
| 
       51 
61 
     | 
    
         
             
                      ".#{e.downcase}"
         
     | 
| 
       52 
62 
     | 
    
         
             
                    end
         
     | 
| 
       53 
63 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -66,7 +76,7 @@ module Jekyll 
     | 
|
| 
       66 
76 
     | 
    
         
             
                  end
         
     | 
| 
       67 
77 
     | 
    
         | 
| 
       68 
78 
     | 
    
         
             
                  private
         
     | 
| 
       69 
     | 
    
         
            -
                  def  
     | 
| 
      
 79 
     | 
    
         
            +
                  def custom_processor
         
     | 
| 
       70 
80 
     | 
    
         
             
                    converter_name = @config["markdown"]
         
     | 
| 
       71 
81 
     | 
    
         
             
                    if custom_class_allowed?(converter_name)
         
     | 
| 
       72 
82 
     | 
    
         
             
                      self.class.const_get(converter_name).new(@config)
         
     | 
| 
         @@ -83,7 +93,7 @@ module Jekyll 
     | 
|
| 
       83 
93 
     | 
    
         | 
| 
       84 
94 
     | 
    
         
             
                  private
         
     | 
| 
       85 
95 
     | 
    
         
             
                  def custom_class_allowed?(parser_name)
         
     | 
| 
       86 
     | 
    
         
            -
                    parser_name !~  
     | 
| 
      
 96 
     | 
    
         
            +
                    parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(
         
     | 
| 
       87 
97 
     | 
    
         
             
                      parser_name.to_sym
         
     | 
| 
       88 
98 
     | 
    
         
             
                    )
         
     | 
| 
       89 
99 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -24,7 +24,8 @@ module Jekyll 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                    # Setup and normalize the configuration:
         
     | 
| 
       26 
26 
     | 
    
         
             
                    #   * Create Kramdown if it doesn't exist.
         
     | 
| 
       27 
     | 
    
         
            -
                    #   * Set syntax_highlighter, detecting enable_coderay and merging 
     | 
| 
      
 27 
     | 
    
         
            +
                    #   * Set syntax_highlighter, detecting enable_coderay and merging
         
     | 
| 
      
 28 
     | 
    
         
            +
                    #       highlighter if none.
         
     | 
| 
       28 
29 
     | 
    
         
             
                    #   * Merge kramdown[coderay] into syntax_highlighter_opts stripping coderay_.
         
     | 
| 
       29 
30 
     | 
    
         
             
                    #   * Make sure `syntax_highlighter_opts` exists.
         
     | 
| 
       30 
31 
     | 
    
         | 
| 
         @@ -52,7 +53,9 @@ module Jekyll 
     | 
|
| 
       52 
53 
     | 
    
         
             
                      end
         
     | 
| 
       53 
54 
     | 
    
         
             
                    end
         
     | 
| 
       54 
55 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                    # config[kramdown][syntax_higlighter] > 
     | 
| 
      
 56 
     | 
    
         
            +
                    # config[kramdown][syntax_higlighter] >
         
     | 
| 
      
 57 
     | 
    
         
            +
                    #   config[kramdown][enable_coderay] >
         
     | 
| 
      
 58 
     | 
    
         
            +
                    #   config[highlighter]
         
     | 
| 
       56 
59 
     | 
    
         
             
                    # Where `enable_coderay` is now deprecated because Kramdown
         
     | 
| 
       57 
60 
     | 
    
         
             
                    # supports Rouge now too.
         
     | 
| 
       58 
61 
     | 
    
         | 
| 
         @@ -68,8 +71,10 @@ module Jekyll 
     | 
|
| 
       68 
71 
     | 
    
         | 
| 
       69 
72 
     | 
    
         
             
                      @highlighter = begin
         
     | 
| 
       70 
73 
     | 
    
         
             
                        if @config.key?("enable_coderay") && @config["enable_coderay"]
         
     | 
| 
       71 
     | 
    
         
            -
                          Jekyll::Deprecator.deprecation_message 
     | 
| 
      
 74 
     | 
    
         
            +
                          Jekyll::Deprecator.deprecation_message(
         
     | 
| 
      
 75 
     | 
    
         
            +
                            "You are using 'enable_coderay', " \
         
     | 
| 
       72 
76 
     | 
    
         
             
                            "use syntax_highlighter: coderay in your configuration file."
         
     | 
| 
      
 77 
     | 
    
         
            +
                          )
         
     | 
| 
       73 
78 
     | 
    
         | 
| 
       74 
79 
     | 
    
         
             
                          "coderay"
         
     | 
| 
       75 
80 
     | 
    
         
             
                        else
         
     | 
| 
         @@ -81,7 +86,7 @@ module Jekyll 
     | 
|
| 
       81 
86 
     | 
    
         
             
                    private
         
     | 
| 
       82 
87 
     | 
    
         
             
                    def strip_coderay_prefix(hash)
         
     | 
| 
       83 
88 
     | 
    
         
             
                      hash.each_with_object({}) do |(key, val), hsh|
         
     | 
| 
       84 
     | 
    
         
            -
                        cleaned_key = key.gsub( 
     | 
| 
      
 89 
     | 
    
         
            +
                        cleaned_key = key.gsub(%r!\Acoderay_!, "")
         
     | 
| 
       85 
90 
     | 
    
         | 
| 
       86 
91 
     | 
    
         
             
                        if key != cleaned_key
         
     | 
| 
       87 
92 
     | 
    
         
             
                          Jekyll::Deprecator.deprecation_message(
         
     | 
| 
         @@ -100,8 +105,10 @@ module Jekyll 
     | 
|
| 
       100 
105 
     | 
    
         
             
                    private
         
     | 
| 
       101 
106 
     | 
    
         
             
                    def modernize_coderay_config
         
     | 
| 
       102 
107 
     | 
    
         
             
                      if highlighter == "coderay"
         
     | 
| 
       103 
     | 
    
         
            -
                        Jekyll::Deprecator.deprecation_message 
     | 
| 
      
 108 
     | 
    
         
            +
                        Jekyll::Deprecator.deprecation_message(
         
     | 
| 
      
 109 
     | 
    
         
            +
                          "You are using 'kramdown.coderay' in your configuration, " \
         
     | 
| 
       104 
110 
     | 
    
         
             
                          "please use 'syntax_highlighter_opts' instead."
         
     | 
| 
      
 111 
     | 
    
         
            +
                        )
         
     | 
| 
       105 
112 
     | 
    
         | 
| 
       106 
113 
     | 
    
         
             
                        @config["syntax_highlighter_opts"] = begin
         
     | 
| 
       107 
114 
     | 
    
         
             
                          strip_coderay_prefix(
         
     | 
| 
         @@ -5,14 +5,14 @@ module Jekyll 
     | 
|
| 
       5 
5 
     | 
    
         
             
                    def initialize(config)
         
     | 
| 
       6 
6 
     | 
    
         
             
                      Jekyll::External.require_with_graceful_fail "rdiscount"
         
     | 
| 
       7 
7 
     | 
    
         
             
                      @config = config
         
     | 
| 
       8 
     | 
    
         
            -
                      @rdiscount_extensions = @config[ 
     | 
| 
      
 8 
     | 
    
         
            +
                      @rdiscount_extensions = @config["rdiscount"]["extensions"].map(&:to_sym)
         
     | 
| 
       9 
9 
     | 
    
         
             
                    end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                    def convert(content)
         
     | 
| 
       12 
12 
     | 
    
         
             
                      rd = RDiscount.new(content, *@rdiscount_extensions)
         
     | 
| 
       13 
13 
     | 
    
         
             
                      html = rd.to_html
         
     | 
| 
       14 
     | 
    
         
            -
                      if @config[ 
     | 
| 
       15 
     | 
    
         
            -
                        html = replace_generated_toc(rd, html, @config[ 
     | 
| 
      
 14 
     | 
    
         
            +
                      if @config["rdiscount"]["toc_token"]
         
     | 
| 
      
 15 
     | 
    
         
            +
                        html = replace_generated_toc(rd, html, @config["rdiscount"]["toc_token"])
         
     | 
| 
       16 
16 
     | 
    
         
             
                      end
         
     | 
| 
       17 
17 
     | 
    
         
             
                      html
         
     | 
| 
       18 
18 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -21,7 +21,7 @@ module Jekyll 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    def replace_generated_toc(rd, html, toc_token)
         
     | 
| 
       22 
22 
     | 
    
         
             
                      if rd.generate_toc && html.include?(toc_token)
         
     | 
| 
       23 
23 
     | 
    
         
             
                        utf8_toc = rd.toc_content
         
     | 
| 
       24 
     | 
    
         
            -
                        utf8_toc.force_encoding( 
     | 
| 
      
 24 
     | 
    
         
            +
                        utf8_toc.force_encoding("utf-8") if utf8_toc.respond_to?(:force_encoding)
         
     | 
| 
       25 
25 
     | 
    
         
             
                        html.gsub(toc_token, utf8_toc)
         
     | 
| 
       26 
26 
     | 
    
         
             
                      else
         
     | 
| 
       27 
27 
     | 
    
         
             
                        html
         
     | 
| 
         @@ -1,102 +1,108 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
              module  
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
                   
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                    module WithPygments
         
     | 
| 
       15 
     | 
    
         
            -
                      include CommonMethods
         
     | 
| 
       16 
     | 
    
         
            -
                      def block_code(code, lang)
         
     | 
| 
       17 
     | 
    
         
            -
                        Jekyll::External.require_with_graceful_fail("pygments")
         
     | 
| 
       18 
     | 
    
         
            -
                        lang = lang && lang.split.first || "text"
         
     | 
| 
       19 
     | 
    
         
            -
                        add_code_tags(
         
     | 
| 
       20 
     | 
    
         
            -
                          Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
         
     | 
| 
       21 
     | 
    
         
            -
                          lang
         
     | 
| 
       22 
     | 
    
         
            -
                        )
         
     | 
| 
       23 
     | 
    
         
            -
                      end
         
     | 
| 
       24 
     | 
    
         
            -
                    end
         
     | 
| 
      
 1 
     | 
    
         
            +
            class Jekyll::Converters::Markdown::RedcarpetParser
         
     | 
| 
      
 2 
     | 
    
         
            +
              module CommonMethods
         
     | 
| 
      
 3 
     | 
    
         
            +
                def add_code_tags(code, lang)
         
     | 
| 
      
 4 
     | 
    
         
            +
                  code = code.to_s
         
     | 
| 
      
 5 
     | 
    
         
            +
                  code = code.sub(
         
     | 
| 
      
 6 
     | 
    
         
            +
                    %r!<pre>!,
         
     | 
| 
      
 7 
     | 
    
         
            +
                    "<pre><code class=\"language-#{lang}\" data-lang=\"#{lang}\">"
         
     | 
| 
      
 8 
     | 
    
         
            +
                  )
         
     | 
| 
      
 9 
     | 
    
         
            +
                  code = code.sub(%r!</pre>!, "</code></pre>")
         
     | 
| 
      
 10 
     | 
    
         
            +
                  code
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
       25 
13 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
      
 14 
     | 
    
         
            +
              module WithPygments
         
     | 
| 
      
 15 
     | 
    
         
            +
                include CommonMethods
         
     | 
| 
      
 16 
     | 
    
         
            +
                def block_code(code, lang)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  Jekyll::External.require_with_graceful_fail("pygments")
         
     | 
| 
      
 18 
     | 
    
         
            +
                  lang = lang && lang.split.first || "text"
         
     | 
| 
      
 19 
     | 
    
         
            +
                  add_code_tags(
         
     | 
| 
      
 20 
     | 
    
         
            +
                    Pygments.highlight(
         
     | 
| 
      
 21 
     | 
    
         
            +
                      code,
         
     | 
| 
      
 22 
     | 
    
         
            +
                      {
         
     | 
| 
      
 23 
     | 
    
         
            +
                        :lexer   => lang,
         
     | 
| 
      
 24 
     | 
    
         
            +
                        :options => { :encoding => "utf-8" }
         
     | 
| 
      
 25 
     | 
    
         
            +
                      }
         
     | 
| 
      
 26 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 27 
     | 
    
         
            +
                    lang
         
     | 
| 
      
 28 
     | 
    
         
            +
                  )
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
       28 
31 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 32 
     | 
    
         
            +
              module WithoutHighlighting
         
     | 
| 
      
 33 
     | 
    
         
            +
                require "cgi"
         
     | 
| 
       30 
34 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                        "<figure class=\"highlight\"><pre>#{CGI::escapeHTML(code)}</pre></figure>"
         
     | 
| 
       33 
     | 
    
         
            -
                      end
         
     | 
| 
      
 35 
     | 
    
         
            +
                include CommonMethods
         
     | 
| 
       34 
36 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                      end
         
     | 
| 
       39 
     | 
    
         
            -
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                def code_wrap(code)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  "<figure class=\"highlight\"><pre>#{CGI.escapeHTML(code)}</pre></figure>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
                def block_code(code, lang)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  lang = lang && lang.split.first || "text"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  add_code_tags(code_wrap(code), lang)
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
       44 
46 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                      end
         
     | 
| 
      
 47 
     | 
    
         
            +
              module WithRouge
         
     | 
| 
      
 48 
     | 
    
         
            +
                def block_code(code, lang)
         
     | 
| 
      
 49 
     | 
    
         
            +
                  code = "<pre>#{super}</pre>"
         
     | 
| 
       49 
50 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
                    end
         
     | 
| 
      
 51 
     | 
    
         
            +
                  output = "<div class=\"highlight\">"
         
     | 
| 
      
 52 
     | 
    
         
            +
                  output << add_code_tags(code, lang)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  output << "</div>"
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                protected
         
     | 
| 
      
 57 
     | 
    
         
            +
                def rouge_formatter(_lexer)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  Rouge::Formatters::HTML.new(:wrap => false)
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 62 
     | 
    
         
            +
              def initialize(config)
         
     | 
| 
      
 63 
     | 
    
         
            +
                Jekyll::External.require_with_graceful_fail("redcarpet")
         
     | 
| 
      
 64 
     | 
    
         
            +
                @config = config
         
     | 
| 
      
 65 
     | 
    
         
            +
                @redcarpet_extensions = {}
         
     | 
| 
      
 66 
     | 
    
         
            +
                @config["redcarpet"]["extensions"].each do |e|
         
     | 
| 
      
 67 
     | 
    
         
            +
                  @redcarpet_extensions[e.to_sym] = true
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
       64 
69 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                      when "pygments"
         
     | 
| 
       68 
     | 
    
         
            -
                        Class.new(Redcarpet::Render::HTML) do
         
     | 
| 
       69 
     | 
    
         
            -
                          include WithPygments
         
     | 
| 
       70 
     | 
    
         
            -
                        end
         
     | 
| 
       71 
     | 
    
         
            -
                      when "rouge"
         
     | 
| 
       72 
     | 
    
         
            -
                        Class.new(Redcarpet::Render::HTML) do
         
     | 
| 
       73 
     | 
    
         
            -
                          Jekyll::External.require_with_graceful_fail(%w(
         
     | 
| 
       74 
     | 
    
         
            -
                            rouge
         
     | 
| 
       75 
     | 
    
         
            -
                            rouge/plugins/redcarpet
         
     | 
| 
       76 
     | 
    
         
            -
                          ))
         
     | 
| 
      
 70 
     | 
    
         
            +
                @renderer ||= class_with_proper_highlighter(@config["highlighter"])
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
       77 
72 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
              def class_with_proper_highlighter(highlighter)
         
     | 
| 
      
 74 
     | 
    
         
            +
                Class.new(Redcarpet::Render::HTML) do
         
     | 
| 
      
 75 
     | 
    
         
            +
                  case highlighter
         
     | 
| 
      
 76 
     | 
    
         
            +
                  when "pygments"
         
     | 
| 
      
 77 
     | 
    
         
            +
                    include WithPygments
         
     | 
| 
      
 78 
     | 
    
         
            +
                  when "rouge"
         
     | 
| 
      
 79 
     | 
    
         
            +
                    Jekyll::External.require_with_graceful_fail(%w(
         
     | 
| 
      
 80 
     | 
    
         
            +
                      rouge rouge/plugins/redcarpet
         
     | 
| 
      
 81 
     | 
    
         
            +
                    ))
         
     | 
| 
       81 
82 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                          include WithRouge
         
     | 
| 
       85 
     | 
    
         
            -
                        end
         
     | 
| 
       86 
     | 
    
         
            -
                      else
         
     | 
| 
       87 
     | 
    
         
            -
                        Class.new(Redcarpet::Render::HTML) do
         
     | 
| 
       88 
     | 
    
         
            -
                          include WithoutHighlighting
         
     | 
| 
       89 
     | 
    
         
            -
                        end
         
     | 
| 
       90 
     | 
    
         
            -
                      end
         
     | 
| 
      
 83 
     | 
    
         
            +
                    unless Gem::Version.new(Rouge.version) > Gem::Version.new("1.3.0")
         
     | 
| 
      
 84 
     | 
    
         
            +
                      abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
         
     | 
| 
       91 
85 
     | 
    
         
             
                    end
         
     | 
| 
       92 
86 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                     
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
                    include Rouge::Plugins::Redcarpet
         
     | 
| 
      
 88 
     | 
    
         
            +
                    include CommonMethods
         
     | 
| 
      
 89 
     | 
    
         
            +
                    include WithRouge
         
     | 
| 
      
 90 
     | 
    
         
            +
                  else
         
     | 
| 
      
 91 
     | 
    
         
            +
                    include WithoutHighlighting
         
     | 
| 
       99 
92 
     | 
    
         
             
                  end
         
     | 
| 
       100 
93 
     | 
    
         
             
                end
         
     | 
| 
       101 
94 
     | 
    
         
             
              end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
              def convert(content)
         
     | 
| 
      
 97 
     | 
    
         
            +
                @redcarpet_extensions[:fenced_code_blocks] = \
         
     | 
| 
      
 98 
     | 
    
         
            +
                  !@redcarpet_extensions[:no_fenced_code_blocks]
         
     | 
| 
      
 99 
     | 
    
         
            +
                if @redcarpet_extensions[:smart]
         
     | 
| 
      
 100 
     | 
    
         
            +
                  @renderer.send :include, Redcarpet::Render::SmartyPants
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
      
 102 
     | 
    
         
            +
                markdown = Redcarpet::Markdown.new(
         
     | 
| 
      
 103 
     | 
    
         
            +
                  @renderer.new(@redcarpet_extensions),
         
     | 
| 
      
 104 
     | 
    
         
            +
                  @redcarpet_extensions
         
     | 
| 
      
 105 
     | 
    
         
            +
                )
         
     | 
| 
      
 106 
     | 
    
         
            +
                markdown.render(content)
         
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
       102 
108 
     | 
    
         
             
            end
         
     | 
    
        data/lib/jekyll/convertible.rb
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: UTF-8
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require  
     | 
| 
      
 3 
     | 
    
         
            +
            require "set"
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            # Convertible provides methods for converting a pagelike item
         
     | 
| 
       6 
6 
     | 
    
         
             
            # from a certain type of markup into actual content
         
     | 
| 
         @@ -20,12 +20,12 @@ module Jekyll 
     | 
|
| 
       20 
20 
     | 
    
         
             
              module Convertible
         
     | 
| 
       21 
21 
     | 
    
         
             
                # Returns the contents as a String.
         
     | 
| 
       22 
22 
     | 
    
         
             
                def to_s
         
     | 
| 
       23 
     | 
    
         
            -
                  content ||  
     | 
| 
      
 23 
     | 
    
         
            +
                  content || ""
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                # Whether the file is published or not, as indicated in YAML front-matter
         
     | 
| 
       27 
27 
     | 
    
         
             
                def published?
         
     | 
| 
       28 
     | 
    
         
            -
                  !(data.key?( 
     | 
| 
      
 28 
     | 
    
         
            +
                  !(data.key?("published") && data["published"] == false)
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                # Read the YAML frontmatter.
         
     | 
| 
         @@ -47,7 +47,7 @@ module Jekyll 
     | 
|
| 
       47 
47 
     | 
    
         
             
                    end
         
     | 
| 
       48 
48 
     | 
    
         
             
                  rescue SyntaxError => e
         
     | 
| 
       49 
49 
     | 
    
         
             
                    Jekyll.logger.warn "YAML Exception reading #{filename}: #{e.message}"
         
     | 
| 
       50 
     | 
    
         
            -
                  rescue  
     | 
| 
      
 50 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
       51 
51 
     | 
    
         
             
                    Jekyll.logger.warn "Error reading file #{filename}: #{e.message}"
         
     | 
| 
       52 
52 
     | 
    
         
             
                  end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
         @@ -61,12 +61,13 @@ module Jekyll 
     | 
|
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
                def validate_data!(filename)
         
     | 
| 
       63 
63 
     | 
    
         
             
                  unless self.data.is_a?(Hash)
         
     | 
| 
       64 
     | 
    
         
            -
                    raise Errors::InvalidYAMLFrontMatterError, 
     | 
| 
      
 64 
     | 
    
         
            +
                    raise Errors::InvalidYAMLFrontMatterError,
         
     | 
| 
      
 65 
     | 
    
         
            +
                      "Invalid YAML front matter in #{filename}"
         
     | 
| 
       65 
66 
     | 
    
         
             
                  end
         
     | 
| 
       66 
67 
     | 
    
         
             
                end
         
     | 
| 
       67 
68 
     | 
    
         | 
| 
       68 
69 
     | 
    
         
             
                def validate_permalink!(filename)
         
     | 
| 
       69 
     | 
    
         
            -
                  if self.data[ 
     | 
| 
      
 70 
     | 
    
         
            +
                  if self.data["permalink"] && self.data["permalink"].empty?
         
     | 
| 
       70 
71 
     | 
    
         
             
                    raise Errors::InvalidPermalinkError, "Invalid permalink in #{filename}"
         
     | 
| 
       71 
72 
     | 
    
         
             
                  end
         
     | 
| 
       72 
73 
     | 
    
         
             
                end
         
     | 
| 
         @@ -79,7 +80,10 @@ module Jekyll 
     | 
|
| 
       79 
80 
     | 
    
         
             
                    begin
         
     | 
| 
       80 
81 
     | 
    
         
             
                      converter.convert output
         
     | 
| 
       81 
82 
     | 
    
         
             
                    rescue => e
         
     | 
| 
       82 
     | 
    
         
            -
                      Jekyll.logger.error 
     | 
| 
      
 83 
     | 
    
         
            +
                      Jekyll.logger.error(
         
     | 
| 
      
 84 
     | 
    
         
            +
                        "Conversion error:",
         
     | 
| 
      
 85 
     | 
    
         
            +
                        "#{converter.class} encountered an error while converting '#{path}':"
         
     | 
| 
      
 86 
     | 
    
         
            +
                      )
         
     | 
| 
       83 
87 
     | 
    
         
             
                      Jekyll.logger.error("", e.to_s)
         
     | 
| 
       84 
88 
     | 
    
         
             
                      raise e
         
     | 
| 
       85 
89 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -112,12 +116,17 @@ module Jekyll 
     | 
|
| 
       112 
116 
     | 
    
         
             
                def render_liquid(content, payload, info, path)
         
     | 
| 
       113 
117 
     | 
    
         
             
                  site.liquid_renderer.file(path).parse(content).render!(payload, info)
         
     | 
| 
       114 
118 
     | 
    
         
             
                rescue Tags::IncludeTagError => e
         
     | 
| 
       115 
     | 
    
         
            -
                  Jekyll.logger.error 
     | 
| 
      
 119 
     | 
    
         
            +
                  Jekyll.logger.error(
         
     | 
| 
      
 120 
     | 
    
         
            +
                    "Liquid Exception:",
         
     | 
| 
      
 121 
     | 
    
         
            +
                    "#{e.message} in #{e.path}, included in #{path || self.path}"
         
     | 
| 
      
 122 
     | 
    
         
            +
                  )
         
     | 
| 
       116 
123 
     | 
    
         
             
                  raise e
         
     | 
| 
      
 124 
     | 
    
         
            +
                # rubocop: disable RescueException
         
     | 
| 
       117 
125 
     | 
    
         
             
                rescue Exception => e
         
     | 
| 
       118 
126 
     | 
    
         
             
                  Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || self.path}"
         
     | 
| 
       119 
127 
     | 
    
         
             
                  raise e
         
     | 
| 
       120 
128 
     | 
    
         
             
                end
         
     | 
| 
      
 129 
     | 
    
         
            +
                # rubocop: enable RescueException
         
     | 
| 
       121 
130 
     | 
    
         | 
| 
       122 
131 
     | 
    
         
             
                # Convert this Convertible's data to a Hash suitable for use by Liquid.
         
     | 
| 
       123 
132 
     | 
    
         
             
                #
         
     | 
| 
         @@ -168,7 +177,7 @@ module Jekyll 
     | 
|
| 
       168 
177 
     | 
    
         
             
                #
         
     | 
| 
       169 
178 
     | 
    
         
             
                # Returns true if extname == .coffee, false otherwise.
         
     | 
| 
       170 
179 
     | 
    
         
             
                def coffeescript_file?
         
     | 
| 
       171 
     | 
    
         
            -
                   
     | 
| 
      
 180 
     | 
    
         
            +
                  ".coffee" == ext
         
     | 
| 
       172 
181 
     | 
    
         
             
                end
         
     | 
| 
       173 
182 
     | 
    
         | 
| 
       174 
183 
     | 
    
         
             
                # Determine whether the file should be rendered with Liquid.
         
     | 
| 
         @@ -205,14 +214,20 @@ module Jekyll 
     | 
|
| 
       205 
214 
     | 
    
         
             
                  # recursively render layouts
         
     | 
| 
       206 
215 
     | 
    
         
             
                  layout = layouts[data["layout"]]
         
     | 
| 
       207 
216 
     | 
    
         | 
| 
       208 
     | 
    
         
            -
                  Jekyll.logger.warn( 
     | 
| 
      
 217 
     | 
    
         
            +
                  Jekyll.logger.warn(
         
     | 
| 
      
 218 
     | 
    
         
            +
                    "Build Warning:",
         
     | 
| 
      
 219 
     | 
    
         
            +
                    "Layout '#{data["layout"]}' requested in #{path} does not exist."
         
     | 
| 
      
 220 
     | 
    
         
            +
                  ) if invalid_layout? layout
         
     | 
| 
       209 
221 
     | 
    
         | 
| 
       210 
222 
     | 
    
         
             
                  used = Set.new([layout])
         
     | 
| 
       211 
223 
     | 
    
         | 
| 
      
 224 
     | 
    
         
            +
                  # Reset the payload layout data to ensure it starts fresh for each page.
         
     | 
| 
      
 225 
     | 
    
         
            +
                  payload["layout"] = nil
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
       212 
227 
     | 
    
         
             
                  while layout
         
     | 
| 
       213 
228 
     | 
    
         
             
                    Jekyll.logger.debug "Rendering Layout:", path
         
     | 
| 
       214 
229 
     | 
    
         
             
                    payload["content"] = output
         
     | 
| 
       215 
     | 
    
         
            -
                    payload["layout"]  = Utils.deep_merge_hashes(payload["layout"] || {} 
     | 
| 
      
 230 
     | 
    
         
            +
                    payload["layout"]  = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
         
     | 
| 
       216 
231 
     | 
    
         | 
| 
       217 
232 
     | 
    
         
             
                    self.output = render_liquid(layout.content,
         
     | 
| 
       218 
233 
     | 
    
         
             
                                                payload,
         
     | 
| 
         @@ -225,12 +240,9 @@ module Jekyll 
     | 
|
| 
       225 
240 
     | 
    
         
             
                      site.in_source_dir(layout.path)
         
     | 
| 
       226 
241 
     | 
    
         
             
                    )
         
     | 
| 
       227 
242 
     | 
    
         | 
| 
       228 
     | 
    
         
            -
                    if layout = layouts[layout.data["layout"]]
         
     | 
| 
       229 
     | 
    
         
            -
                      if used.include?(layout)
         
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
                      else
         
     | 
| 
       232 
     | 
    
         
            -
                        used << layout
         
     | 
| 
       233 
     | 
    
         
            -
                      end
         
     | 
| 
      
 243 
     | 
    
         
            +
                    if (layout = layouts[layout.data["layout"]])
         
     | 
| 
      
 244 
     | 
    
         
            +
                      break if used.include?(layout)
         
     | 
| 
      
 245 
     | 
    
         
            +
                      used << layout
         
     | 
| 
       234 
246 
     | 
    
         
             
                    end
         
     | 
| 
       235 
247 
     | 
    
         
             
                  end
         
     | 
| 
       236 
248 
     | 
    
         
             
                end
         
     | 
| 
         @@ -246,7 +258,10 @@ module Jekyll 
     | 
|
| 
       246 
258 
     | 
    
         | 
| 
       247 
259 
     | 
    
         
             
                  Jekyll.logger.debug "Pre-Render Hooks:", self.relative_path
         
     | 
| 
       248 
260 
     | 
    
         
             
                  Jekyll::Hooks.trigger hook_owner, :pre_render, self, payload
         
     | 
| 
       249 
     | 
    
         
            -
                  info = { 
     | 
| 
      
 261 
     | 
    
         
            +
                  info = {
         
     | 
| 
      
 262 
     | 
    
         
            +
                    :filters   => [Jekyll::Filters],
         
     | 
| 
      
 263 
     | 
    
         
            +
                    :registers => { :site => site, :page => payload["page"] }
         
     | 
| 
      
 264 
     | 
    
         
            +
                  }
         
     | 
| 
       250 
265 
     | 
    
         | 
| 
       251 
266 
     | 
    
         
             
                  # render and transform content (this becomes the final content of the object)
         
     | 
| 
       252 
267 
     | 
    
         
             
                  payload["highlighter_prefix"] = converters.first.highlighter_prefix
         
     | 
| 
         @@ -275,9 +290,7 @@ module Jekyll 
     | 
|
| 
       275 
290 
     | 
    
         
             
                def write(dest)
         
     | 
| 
       276 
291 
     | 
    
         
             
                  path = destination(dest)
         
     | 
| 
       277 
292 
     | 
    
         
             
                  FileUtils.mkdir_p(File.dirname(path))
         
     | 
| 
       278 
     | 
    
         
            -
                  File. 
     | 
| 
       279 
     | 
    
         
            -
                    f.write(output)
         
     | 
| 
       280 
     | 
    
         
            -
                  end
         
     | 
| 
      
 293 
     | 
    
         
            +
                  File.write(path, output, :mode => "wb")
         
     | 
| 
       281 
294 
     | 
    
         
             
                  Jekyll::Hooks.trigger hook_owner, :post_write, self
         
     | 
| 
       282 
295 
     | 
    
         
             
                end
         
     | 
| 
       283 
296 
     | 
    
         |