nuke whitespace
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module Gollum
|
||||
# Responsible for handling the commit process for a Wiki. It sets up the
|
||||
# Responsible for handling the commit process for a Wiki. It sets up the
|
||||
# Git index, provides methods for modifying the tree, and stores callbacks
|
||||
# to be fired after the commit has been made. This is specifically
|
||||
# to be fired after the commit has been made. This is specifically
|
||||
# designed to handle multiple updated pages in a single commit.
|
||||
class Committer
|
||||
# Gets the instance of the Gollum::Wiki that is being updated.
|
||||
@@ -21,7 +21,7 @@ module Gollum
|
||||
# :tree - Optional String SHA of the tree to create the
|
||||
# index from.
|
||||
# :committer - Optional Gollum::Committer instance. If provided,
|
||||
# assume that this operation is part of batch of
|
||||
# assume that this operation is part of batch of
|
||||
# updates and the commit happens later.
|
||||
#
|
||||
# Returns the Committer instance.
|
||||
@@ -152,7 +152,7 @@ module Gollum
|
||||
|
||||
# Adds a callback to be fired after a commit.
|
||||
#
|
||||
# block - A block that expects this Committer instance and the created
|
||||
# block - A block that expects this Committer instance and the created
|
||||
# commit's SHA1 as the arguments.
|
||||
#
|
||||
# Returns nothing.
|
||||
|
||||
@@ -16,7 +16,7 @@ module Precious
|
||||
set :public_folder, "#{dir}/public"
|
||||
set :static, true
|
||||
set :default_markup, :markdown
|
||||
|
||||
|
||||
set :mustache, {
|
||||
# Tell mustache where the Views constant lives
|
||||
:namespace => Precious,
|
||||
|
||||
@@ -8,15 +8,15 @@ module Precious
|
||||
def title
|
||||
"Create a new page"
|
||||
end
|
||||
|
||||
|
||||
def is_create_page
|
||||
true
|
||||
end
|
||||
|
||||
|
||||
def is_edit_page
|
||||
false
|
||||
end
|
||||
|
||||
|
||||
def format
|
||||
@format = (@page.format || false) if @format.nil? && @page
|
||||
@format.to_s.downcase
|
||||
@@ -39,10 +39,10 @@ module Precious
|
||||
def formats
|
||||
super(:markdown)
|
||||
end
|
||||
|
||||
|
||||
def default_markup
|
||||
Precious::App.settings.default_markup
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,8 +10,8 @@ module Precious
|
||||
def has_results
|
||||
!@results.empty?
|
||||
end
|
||||
|
||||
def no_results
|
||||
|
||||
def no_results
|
||||
@results.empty?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,8 +10,8 @@ module Precious
|
||||
def has_results
|
||||
!@results.empty?
|
||||
end
|
||||
|
||||
def no_results
|
||||
|
||||
def no_results
|
||||
@results.empty?
|
||||
end
|
||||
|
||||
|
||||
@@ -422,7 +422,7 @@ module Gollum
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
# Extract all sequence diagram blocks into the wsdmap and replace with
|
||||
# Extract all sequence diagram blocks into the wsdmap and replace with
|
||||
# placeholders.
|
||||
#
|
||||
# data - The raw String data.
|
||||
@@ -436,7 +436,7 @@ module Gollum
|
||||
end
|
||||
end
|
||||
|
||||
# Process all diagrams from the wsdmap and replace the placeholders with
|
||||
# Process all diagrams from the wsdmap and replace the placeholders with
|
||||
# the final HTML.
|
||||
#
|
||||
# data - The String data (with placeholders).
|
||||
@@ -487,7 +487,7 @@ module Gollum
|
||||
if Gem::Version.new(Redcarpet::VERSION) > Gem::Version.new("1.17.2")
|
||||
html_renderer = Redcarpet::Render::HTML.new({
|
||||
:autolink => true,
|
||||
:fenced_code_blocks => true,
|
||||
:fenced_code_blocks => true,
|
||||
:tables => true,
|
||||
:strikethrough => true,
|
||||
:lax_htmlblock => true,
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ module Gollum
|
||||
#
|
||||
# filename - The string path or filename to strip
|
||||
#
|
||||
# Returns the stripped String.
|
||||
# Returns the stripped String.
|
||||
def self.strip_filename(filename)
|
||||
::File.basename(filename, ::File.extname(filename))
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ module Gollum
|
||||
([1, page.to_i].max - 1) * per_page
|
||||
end
|
||||
|
||||
# Fills in git-specific options for the log command using simple
|
||||
# Fills in git-specific options for the log command using simple
|
||||
# pagination options.
|
||||
#
|
||||
# options - Hash of options:
|
||||
@@ -45,7 +45,7 @@ module Gollum
|
||||
self.class.page_to_skip(page)
|
||||
end
|
||||
|
||||
# Fills in git-specific options for the log command using simple
|
||||
# Fills in git-specific options for the log command using simple
|
||||
# pagination options.
|
||||
#
|
||||
# options - Hash of options:
|
||||
|
||||
+17
-17
@@ -20,10 +20,10 @@ module Gollum
|
||||
|
||||
# Sets the default email for commits.
|
||||
attr_accessor :default_committer_email
|
||||
|
||||
|
||||
# Array of chars to substitute whitespace for when trying to locate file in git repo.
|
||||
attr_accessor :default_ws_subs
|
||||
|
||||
|
||||
# Sets sanitization options. Set to false to deactivate
|
||||
# sanitization altogether.
|
||||
attr_writer :sanitization
|
||||
@@ -105,7 +105,7 @@ module Gollum
|
||||
self.default_ref = 'master'
|
||||
self.default_committer_name = 'Anonymous'
|
||||
self.default_committer_email = 'anon@anon.com'
|
||||
|
||||
|
||||
self.default_ws_subs = ['_','-']
|
||||
|
||||
# The String base path to prefix to internal links. For example, when set
|
||||
@@ -124,7 +124,7 @@ module Gollum
|
||||
|
||||
# Gets the String directory in which all page files reside.
|
||||
attr_reader :page_file_dir
|
||||
|
||||
|
||||
# Gets the Array of chars to sub for ws in filenames.
|
||||
attr_reader :ws_subs
|
||||
|
||||
@@ -225,10 +225,10 @@ module Gollum
|
||||
# :tree - Optional String SHA of the tree to create the
|
||||
# index from.
|
||||
# :committer - Optional Gollum::Committer instance. If provided,
|
||||
# assume that this operation is part of batch of
|
||||
# assume that this operation is part of batch of
|
||||
# updates and the commit happens later.
|
||||
#
|
||||
# Returns the String SHA1 of the newly written version, or the
|
||||
# Returns the String SHA1 of the newly written version, or the
|
||||
# Gollum::Committer instance if this is part of a batch update.
|
||||
def write_page(name, format, data, commit = {})
|
||||
multi_commit = false
|
||||
@@ -239,9 +239,9 @@ module Gollum
|
||||
else
|
||||
Committer.new(self, commit)
|
||||
end
|
||||
|
||||
|
||||
filename = Gollum::Page.cname(name)
|
||||
|
||||
|
||||
committer.add_to_index('', filename, format, data)
|
||||
|
||||
committer.after_commit do |index, sha|
|
||||
@@ -269,19 +269,19 @@ module Gollum
|
||||
# :tree - Optional String SHA of the tree to create the
|
||||
# index from.
|
||||
# :committer - Optional Gollum::Committer instance. If provided,
|
||||
# assume that this operation is part of batch of
|
||||
# assume that this operation is part of batch of
|
||||
# updates and the commit happens later.
|
||||
#
|
||||
# Returns the String SHA1 of the newly written version, or the
|
||||
# Returns the String SHA1 of the newly written version, or the
|
||||
# Gollum::Committer instance if this is part of a batch update.
|
||||
def update_page(page, name, format, data, commit = {})
|
||||
name ||= page.name
|
||||
format ||= page.format
|
||||
dir = ::File.dirname(page.path)
|
||||
dir = '' if dir == '.'
|
||||
dir = '' if dir == '.'
|
||||
filename = (rename = page.name != name) ?
|
||||
Gollum::Page.cname(name) : page.filename_stripped
|
||||
|
||||
|
||||
multi_commit = false
|
||||
|
||||
committer = if obj = commit[:committer]
|
||||
@@ -290,14 +290,14 @@ module Gollum
|
||||
else
|
||||
Committer.new(self, commit)
|
||||
end
|
||||
|
||||
|
||||
if !rename && page.format == format
|
||||
committer.add(page.path, normalize(data))
|
||||
else
|
||||
committer.delete(page.path)
|
||||
committer.add_to_index(dir, filename, format, data, :allow_same_ext)
|
||||
end
|
||||
|
||||
|
||||
committer.after_commit do |index, sha|
|
||||
@access.refresh
|
||||
index.update_working_dir(dir, page.filename_stripped, page.format)
|
||||
@@ -318,10 +318,10 @@ module Gollum
|
||||
# :tree - Optional String SHA of the tree to create the
|
||||
# index from.
|
||||
# :committer - Optional Gollum::Committer instance. If provided,
|
||||
# assume that this operation is part of batch of
|
||||
# assume that this operation is part of batch of
|
||||
# updates and the commit happens later.
|
||||
#
|
||||
# Returns the String SHA1 of the newly written version, or the
|
||||
# Returns the String SHA1 of the newly written version, or the
|
||||
# Gollum::Committer instance if this is part of a batch update.
|
||||
def delete_page(page, commit)
|
||||
multi_commit = false
|
||||
@@ -628,7 +628,7 @@ module Gollum
|
||||
rescue Grit::GitRuby::Repository::NoSuchShaFound
|
||||
[]
|
||||
end
|
||||
|
||||
|
||||
def inspect
|
||||
%(#<#{self.class.name}:#{object_id} #{@repo.path}>)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user