parent
d157a04c6d
commit
2530a8cdfc
|
@ -56,7 +56,7 @@ module Jekyll
|
|||
full_path = collection_dir(file_path)
|
||||
next if File.directory?(full_path)
|
||||
if Utils.has_yaml_header? full_path
|
||||
doc = Jekyll::Document.new(full_path, { site: site, collection: self })
|
||||
doc = Jekyll::Document.new(full_path, { :site => site, :collection => self })
|
||||
doc.read
|
||||
if site.publisher.publish?(doc) || !write?
|
||||
docs << doc
|
||||
|
|
|
@ -197,9 +197,9 @@ module Jekyll
|
|||
# Returns the computed URL for the document.
|
||||
def url
|
||||
@url = URL.new({
|
||||
template: url_template,
|
||||
placeholders: url_placeholders,
|
||||
permalink: permalink
|
||||
:template => url_template,
|
||||
:placeholders => url_placeholders,
|
||||
:permalink => permalink
|
||||
}).to_s
|
||||
end
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ module Jekyll
|
|||
end
|
||||
|
||||
def title
|
||||
Utils.slugify(@obj.data['slug'], mode: "pretty", cased: true) ||
|
||||
Utils.slugify(@obj.basename_without_ext, mode: "pretty", cased: true)
|
||||
Utils.slugify(@obj.data['slug'], :mode => "pretty", :cased => true) ||
|
||||
Utils.slugify(@obj.basename_without_ext, :mode => "pretty", :cased => true)
|
||||
end
|
||||
|
||||
def slug
|
||||
|
|
|
@ -45,7 +45,7 @@ module Jekyll
|
|||
# Returns the given filename or title as a lowercase URL String.
|
||||
# See Utils.slugify for more detail.
|
||||
def slugify(input, mode=nil)
|
||||
Utils.slugify(input, mode: mode)
|
||||
Utils.slugify(input, :mode => mode)
|
||||
end
|
||||
|
||||
# Format a date in short format e.g. "27 Jan 2011".
|
||||
|
|
|
@ -4,37 +4,37 @@ module Jekyll
|
|||
|
||||
# compatibility layer for octopress-hooks users
|
||||
PRIORITY_MAP = {
|
||||
low: 10,
|
||||
normal: 20,
|
||||
high: 30,
|
||||
:low => 10,
|
||||
:normal => 20,
|
||||
:high => 30,
|
||||
}.freeze
|
||||
|
||||
# initial empty hooks
|
||||
@registry = {
|
||||
:site => {
|
||||
after_reset: [],
|
||||
post_read: [],
|
||||
pre_render: [],
|
||||
post_render: [],
|
||||
post_write: [],
|
||||
:after_reset => [],
|
||||
:post_read => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => [],
|
||||
},
|
||||
:pages => {
|
||||
post_init: [],
|
||||
pre_render: [],
|
||||
post_render: [],
|
||||
post_write: [],
|
||||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => [],
|
||||
},
|
||||
:posts => {
|
||||
post_init: [],
|
||||
pre_render: [],
|
||||
post_render: [],
|
||||
post_write: [],
|
||||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => [],
|
||||
},
|
||||
:documents => {
|
||||
post_init: [],
|
||||
pre_render: [],
|
||||
post_render: [],
|
||||
post_write: [],
|
||||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => [],
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,10 @@ module Jekyll
|
|||
# register a single hook to be called later, internal API
|
||||
def self.register_one(owner, event, priority, &block)
|
||||
@registry[owner] ||={
|
||||
post_init: [],
|
||||
pre_render: [],
|
||||
post_render: [],
|
||||
post_write: [],
|
||||
:post_init => [],
|
||||
:pre_render => [],
|
||||
:post_render => [],
|
||||
:post_write => [],
|
||||
}
|
||||
|
||||
unless @registry[owner][event]
|
||||
|
|
|
@ -53,8 +53,8 @@ module Jekyll
|
|||
next unless entry =~ matcher
|
||||
path = @site.in_source_dir(File.join(dir, magic_dir, entry))
|
||||
Document.new(path, {
|
||||
site: @site,
|
||||
collection: @site.posts
|
||||
:site => @site,
|
||||
:collection => @site.posts
|
||||
})
|
||||
end.reject(&:nil?)
|
||||
end
|
||||
|
|
|
@ -43,8 +43,8 @@ module Jekyll
|
|||
document.trigger_hooks(:pre_render, payload)
|
||||
|
||||
info = {
|
||||
filters: [Jekyll::Filters],
|
||||
registers: { :site => site, :page => payload.page }
|
||||
:filters => [Jekyll::Filters],
|
||||
:registers => { :site => site, :page => payload.page }
|
||||
}
|
||||
|
||||
# render and transform content (this becomes the final content of the object)
|
||||
|
|
|
@ -104,12 +104,12 @@ module Jekyll
|
|||
|
||||
def placeholders
|
||||
{
|
||||
collection: @collection.label,
|
||||
path: relative_path[
|
||||
:collection => @collection.label,
|
||||
:path => relative_path[
|
||||
@collection.relative_directory.size..relative_path.size],
|
||||
output_ext: '',
|
||||
name: '',
|
||||
title: '',
|
||||
:output_ext => '',
|
||||
:name => '',
|
||||
:title => '',
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -121,8 +121,8 @@ module Jekyll
|
|||
relative_path
|
||||
else
|
||||
::Jekyll::URL.new({
|
||||
template: @collection.url_template,
|
||||
placeholders: placeholders,
|
||||
:template => @collection.url_template,
|
||||
:placeholders => placeholders,
|
||||
})
|
||||
end.to_s.gsub /\/$/, ''
|
||||
end
|
||||
|
|
|
@ -99,7 +99,7 @@ eos
|
|||
|
||||
def render_rouge(code)
|
||||
Jekyll::External.require_with_graceful_fail('rouge')
|
||||
formatter = Rouge::Formatters::HTML.new(line_numbers: @highlight_options[:linenos], wrap: false)
|
||||
formatter = Rouge::Formatters::HTML.new(:line_numbers => @highlight_options[:linenos], :wrap => false)
|
||||
lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
|
||||
formatter.format(lexer.lex(code))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue