nuke whitespace
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
module Gollum
|
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
|
# 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.
|
# designed to handle multiple updated pages in a single commit.
|
||||||
class Committer
|
class Committer
|
||||||
# Gets the instance of the Gollum::Wiki that is being updated.
|
# 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
|
# :tree - Optional String SHA of the tree to create the
|
||||||
# index from.
|
# index from.
|
||||||
# :committer - Optional Gollum::Committer instance. If provided,
|
# :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.
|
# updates and the commit happens later.
|
||||||
#
|
#
|
||||||
# Returns the Committer instance.
|
# Returns the Committer instance.
|
||||||
@@ -152,7 +152,7 @@ module Gollum
|
|||||||
|
|
||||||
# Adds a callback to be fired after a commit.
|
# 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.
|
# commit's SHA1 as the arguments.
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module Precious
|
|||||||
set :public_folder, "#{dir}/public"
|
set :public_folder, "#{dir}/public"
|
||||||
set :static, true
|
set :static, true
|
||||||
set :default_markup, :markdown
|
set :default_markup, :markdown
|
||||||
|
|
||||||
set :mustache, {
|
set :mustache, {
|
||||||
# Tell mustache where the Views constant lives
|
# Tell mustache where the Views constant lives
|
||||||
:namespace => Precious,
|
:namespace => Precious,
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ module Precious
|
|||||||
def title
|
def title
|
||||||
"Create a new page"
|
"Create a new page"
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_create_page
|
def is_create_page
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_edit_page
|
def is_edit_page
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def format
|
def format
|
||||||
@format = (@page.format || false) if @format.nil? && @page
|
@format = (@page.format || false) if @format.nil? && @page
|
||||||
@format.to_s.downcase
|
@format.to_s.downcase
|
||||||
@@ -39,10 +39,10 @@ module Precious
|
|||||||
def formats
|
def formats
|
||||||
super(:markdown)
|
super(:markdown)
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_markup
|
def default_markup
|
||||||
Precious::App.settings.default_markup
|
Precious::App.settings.default_markup
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ module Precious
|
|||||||
def has_results
|
def has_results
|
||||||
!@results.empty?
|
!@results.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def no_results
|
def no_results
|
||||||
@results.empty?
|
@results.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ module Precious
|
|||||||
def has_results
|
def has_results
|
||||||
!@results.empty?
|
!@results.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def no_results
|
def no_results
|
||||||
@results.empty?
|
@results.empty?
|
||||||
end
|
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.
|
# placeholders.
|
||||||
#
|
#
|
||||||
# data - The raw String data.
|
# data - The raw String data.
|
||||||
@@ -436,7 +436,7 @@ module Gollum
|
|||||||
end
|
end
|
||||||
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.
|
# the final HTML.
|
||||||
#
|
#
|
||||||
# data - The String data (with placeholders).
|
# data - The String data (with placeholders).
|
||||||
@@ -487,7 +487,7 @@ module Gollum
|
|||||||
if Gem::Version.new(Redcarpet::VERSION) > Gem::Version.new("1.17.2")
|
if Gem::Version.new(Redcarpet::VERSION) > Gem::Version.new("1.17.2")
|
||||||
html_renderer = Redcarpet::Render::HTML.new({
|
html_renderer = Redcarpet::Render::HTML.new({
|
||||||
:autolink => true,
|
:autolink => true,
|
||||||
:fenced_code_blocks => true,
|
:fenced_code_blocks => true,
|
||||||
:tables => true,
|
:tables => true,
|
||||||
:strikethrough => true,
|
:strikethrough => true,
|
||||||
:lax_htmlblock => true,
|
:lax_htmlblock => true,
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ module Gollum
|
|||||||
#
|
#
|
||||||
# filename - The string path or filename to strip
|
# filename - The string path or filename to strip
|
||||||
#
|
#
|
||||||
# Returns the stripped String.
|
# Returns the stripped String.
|
||||||
def self.strip_filename(filename)
|
def self.strip_filename(filename)
|
||||||
::File.basename(filename, ::File.extname(filename))
|
::File.basename(filename, ::File.extname(filename))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module Gollum
|
|||||||
([1, page.to_i].max - 1) * per_page
|
([1, page.to_i].max - 1) * per_page
|
||||||
end
|
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.
|
# pagination options.
|
||||||
#
|
#
|
||||||
# options - Hash of options:
|
# options - Hash of options:
|
||||||
@@ -45,7 +45,7 @@ module Gollum
|
|||||||
self.class.page_to_skip(page)
|
self.class.page_to_skip(page)
|
||||||
end
|
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.
|
# pagination options.
|
||||||
#
|
#
|
||||||
# options - Hash of options:
|
# options - Hash of options:
|
||||||
|
|||||||
+17
-17
@@ -20,10 +20,10 @@ module Gollum
|
|||||||
|
|
||||||
# Sets the default email for commits.
|
# Sets the default email for commits.
|
||||||
attr_accessor :default_committer_email
|
attr_accessor :default_committer_email
|
||||||
|
|
||||||
# Array of chars to substitute whitespace for when trying to locate file in git repo.
|
# Array of chars to substitute whitespace for when trying to locate file in git repo.
|
||||||
attr_accessor :default_ws_subs
|
attr_accessor :default_ws_subs
|
||||||
|
|
||||||
# Sets sanitization options. Set to false to deactivate
|
# Sets sanitization options. Set to false to deactivate
|
||||||
# sanitization altogether.
|
# sanitization altogether.
|
||||||
attr_writer :sanitization
|
attr_writer :sanitization
|
||||||
@@ -105,7 +105,7 @@ module Gollum
|
|||||||
self.default_ref = 'master'
|
self.default_ref = 'master'
|
||||||
self.default_committer_name = 'Anonymous'
|
self.default_committer_name = 'Anonymous'
|
||||||
self.default_committer_email = 'anon@anon.com'
|
self.default_committer_email = 'anon@anon.com'
|
||||||
|
|
||||||
self.default_ws_subs = ['_','-']
|
self.default_ws_subs = ['_','-']
|
||||||
|
|
||||||
# The String base path to prefix to internal links. For example, when set
|
# 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.
|
# Gets the String directory in which all page files reside.
|
||||||
attr_reader :page_file_dir
|
attr_reader :page_file_dir
|
||||||
|
|
||||||
# Gets the Array of chars to sub for ws in filenames.
|
# Gets the Array of chars to sub for ws in filenames.
|
||||||
attr_reader :ws_subs
|
attr_reader :ws_subs
|
||||||
|
|
||||||
@@ -225,10 +225,10 @@ module Gollum
|
|||||||
# :tree - Optional String SHA of the tree to create the
|
# :tree - Optional String SHA of the tree to create the
|
||||||
# index from.
|
# index from.
|
||||||
# :committer - Optional Gollum::Committer instance. If provided,
|
# :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.
|
# 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.
|
# Gollum::Committer instance if this is part of a batch update.
|
||||||
def write_page(name, format, data, commit = {})
|
def write_page(name, format, data, commit = {})
|
||||||
multi_commit = false
|
multi_commit = false
|
||||||
@@ -239,9 +239,9 @@ module Gollum
|
|||||||
else
|
else
|
||||||
Committer.new(self, commit)
|
Committer.new(self, commit)
|
||||||
end
|
end
|
||||||
|
|
||||||
filename = Gollum::Page.cname(name)
|
filename = Gollum::Page.cname(name)
|
||||||
|
|
||||||
committer.add_to_index('', filename, format, data)
|
committer.add_to_index('', filename, format, data)
|
||||||
|
|
||||||
committer.after_commit do |index, sha|
|
committer.after_commit do |index, sha|
|
||||||
@@ -269,19 +269,19 @@ module Gollum
|
|||||||
# :tree - Optional String SHA of the tree to create the
|
# :tree - Optional String SHA of the tree to create the
|
||||||
# index from.
|
# index from.
|
||||||
# :committer - Optional Gollum::Committer instance. If provided,
|
# :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.
|
# 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.
|
# Gollum::Committer instance if this is part of a batch update.
|
||||||
def update_page(page, name, format, data, commit = {})
|
def update_page(page, name, format, data, commit = {})
|
||||||
name ||= page.name
|
name ||= page.name
|
||||||
format ||= page.format
|
format ||= page.format
|
||||||
dir = ::File.dirname(page.path)
|
dir = ::File.dirname(page.path)
|
||||||
dir = '' if dir == '.'
|
dir = '' if dir == '.'
|
||||||
filename = (rename = page.name != name) ?
|
filename = (rename = page.name != name) ?
|
||||||
Gollum::Page.cname(name) : page.filename_stripped
|
Gollum::Page.cname(name) : page.filename_stripped
|
||||||
|
|
||||||
multi_commit = false
|
multi_commit = false
|
||||||
|
|
||||||
committer = if obj = commit[:committer]
|
committer = if obj = commit[:committer]
|
||||||
@@ -290,14 +290,14 @@ module Gollum
|
|||||||
else
|
else
|
||||||
Committer.new(self, commit)
|
Committer.new(self, commit)
|
||||||
end
|
end
|
||||||
|
|
||||||
if !rename && page.format == format
|
if !rename && page.format == format
|
||||||
committer.add(page.path, normalize(data))
|
committer.add(page.path, normalize(data))
|
||||||
else
|
else
|
||||||
committer.delete(page.path)
|
committer.delete(page.path)
|
||||||
committer.add_to_index(dir, filename, format, data, :allow_same_ext)
|
committer.add_to_index(dir, filename, format, data, :allow_same_ext)
|
||||||
end
|
end
|
||||||
|
|
||||||
committer.after_commit do |index, sha|
|
committer.after_commit do |index, sha|
|
||||||
@access.refresh
|
@access.refresh
|
||||||
index.update_working_dir(dir, page.filename_stripped, page.format)
|
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
|
# :tree - Optional String SHA of the tree to create the
|
||||||
# index from.
|
# index from.
|
||||||
# :committer - Optional Gollum::Committer instance. If provided,
|
# :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.
|
# 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.
|
# Gollum::Committer instance if this is part of a batch update.
|
||||||
def delete_page(page, commit)
|
def delete_page(page, commit)
|
||||||
multi_commit = false
|
multi_commit = false
|
||||||
@@ -628,7 +628,7 @@ module Gollum
|
|||||||
rescue Grit::GitRuby::Repository::NoSuchShaFound
|
rescue Grit::GitRuby::Repository::NoSuchShaFound
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
%(#<#{self.class.name}:#{object_id} #{@repo.path}>)
|
%(#<#{self.class.name}:#{object_id} #{@repo.path}>)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ context "Wiki" do
|
|||||||
assert_equal committer, index
|
assert_equal committer, index
|
||||||
end
|
end
|
||||||
|
|
||||||
res = wiki.write_page("Gollum", :markdown, "# Gollum",
|
res = wiki.write_page("Gollum", :markdown, "# Gollum",
|
||||||
:committer => committer)
|
:committer => committer)
|
||||||
|
|
||||||
assert_equal committer, res
|
assert_equal committer, res
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ~*~ encoding: utf-8 ~*~
|
# ~*~ encoding: utf-8 ~*~
|
||||||
path = File.join(File.dirname(__FILE__), "helper")
|
path = File.join(File.dirname(__FILE__), "helper")
|
||||||
require File.expand_path(path)
|
require File.expand_path(path)
|
||||||
|
|
||||||
context "File" do
|
context "File" do
|
||||||
|
|||||||
+2
-2
@@ -478,11 +478,11 @@ np.array([[2,2],[1,3]],np.float)
|
|||||||
test "sequence diagram blocks" do
|
test "sequence diagram blocks" do
|
||||||
content = "a\n\n{{{default\nalice->bob: Test\n}}}\n\nb"
|
content = "a\n\n{{{default\nalice->bob: Test\n}}}\n\nb"
|
||||||
output = /.*<img src="http:\/\/www\.websequencediagrams\.com\/\?img=\w{9}" \/>.*/
|
output = /.*<img src="http:\/\/www\.websequencediagrams\.com\/\?img=\w{9}" \/>.*/
|
||||||
|
|
||||||
index = @wiki.repo.index
|
index = @wiki.repo.index
|
||||||
index.add("Bilbo-Baggins.md", content)
|
index.add("Bilbo-Baggins.md", content)
|
||||||
index.commit("Add sequence diagram")
|
index.commit("Add sequence diagram")
|
||||||
|
|
||||||
page = @wiki.page("Bilbo Baggins")
|
page = @wiki.page("Bilbo Baggins")
|
||||||
rendered = Gollum::Markup.new(page).render
|
rendered = Gollum::Markup.new(page).render
|
||||||
assert_not_nil rendered.match(output)
|
assert_not_nil rendered.match(output)
|
||||||
|
|||||||
+5
-5
@@ -25,7 +25,7 @@ context "Page" do
|
|||||||
test "get existing page case insensitive" do
|
test "get existing page case insensitive" do
|
||||||
assert_equal @wiki.page('Bilbo Baggins').path, @wiki.page('bilbo baggins').path
|
assert_equal @wiki.page('Bilbo Baggins').path, @wiki.page('bilbo baggins').path
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get existing page with hyphen" do
|
test "get existing page with hyphen" do
|
||||||
assert_equal @wiki.page('Bilbo Baggins').path, @wiki.page('Bilbo-Baggins').path
|
assert_equal @wiki.page('Bilbo Baggins').path, @wiki.page('Bilbo-Baggins').path
|
||||||
end
|
end
|
||||||
@@ -33,19 +33,19 @@ context "Page" do
|
|||||||
test "get existing page with underscore" do
|
test "get existing page with underscore" do
|
||||||
assert_nil @wiki.page('Bilbo_Baggins')
|
assert_nil @wiki.page('Bilbo_Baggins')
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get existing page where filename contains whitespace, with hypen" do
|
test "get existing page where filename contains whitespace, with hypen" do
|
||||||
assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise-Gamgee').path
|
assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise-Gamgee').path
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get existing page where filename contains whitespace, with underscore" do
|
test "get existing page where filename contains whitespace, with underscore" do
|
||||||
assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise_Gamgee').path
|
assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise_Gamgee').path
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get existing page where filename contains whitespace, with whitespace" do
|
test "get existing page where filename contains whitespace, with whitespace" do
|
||||||
assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise Gamgee').path
|
assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise Gamgee').path
|
||||||
end
|
end
|
||||||
|
|
||||||
test "get nested page" do
|
test "get nested page" do
|
||||||
page = @wiki.page('Eye Of Sauron')
|
page = @wiki.page('Eye Of Sauron')
|
||||||
assert_equal 'Mordor/Eye-Of-Sauron.md', page.path
|
assert_equal 'Mordor/Eye-Of-Sauron.md', page.path
|
||||||
|
|||||||
+9
-9
@@ -237,7 +237,7 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
|
|||||||
@path = cloned_testpath("examples/lotr.git")
|
@path = cloned_testpath("examples/lotr.git")
|
||||||
@wiki = Gollum::Wiki.new(@path)
|
@wiki = Gollum::Wiki.new(@path)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update_page" do
|
test "update_page" do
|
||||||
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
||||||
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
||||||
@@ -249,7 +249,7 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
|
|||||||
assert_equal "h1. Samwise Gamgee2", @wiki.page("Samwise Gamgee").raw_data
|
assert_equal "h1. Samwise Gamgee2", @wiki.page("Samwise Gamgee").raw_data
|
||||||
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update page with format change, verify non-canonicalization of filename, where filename contains Whitespace" do
|
test "update page with format change, verify non-canonicalization of filename, where filename contains Whitespace" do
|
||||||
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
||||||
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
||||||
@@ -261,7 +261,7 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
|
|||||||
assert_equal "h1. Samwise Gamgee", @wiki.page("Samwise Gamgee").raw_data
|
assert_equal "h1. Samwise Gamgee", @wiki.page("Samwise Gamgee").raw_data
|
||||||
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update page with name change, verify canonicalization of filename, where filename contains Whitespace" do
|
test "update page with name change, verify canonicalization of filename, where filename contains Whitespace" do
|
||||||
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
||||||
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
||||||
@@ -269,10 +269,10 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
|
|||||||
page = @wiki.page("Samwise Gamgee")
|
page = @wiki.page("Samwise Gamgee")
|
||||||
@wiki.update_page(page, 'Sam Gamgee', :textile, "h1. Samwise Gamgee", commit_details)
|
@wiki.update_page(page, 'Sam Gamgee', :textile, "h1. Samwise Gamgee", commit_details)
|
||||||
|
|
||||||
assert_equal "h1. Samwise Gamgee", @wiki.page("Sam Gamgee").raw_data
|
assert_equal "h1. Samwise Gamgee", @wiki.page("Sam Gamgee").raw_data
|
||||||
assert_equal "Sam-Gamgee.textile", @wiki.page("Sam Gamgee").filename
|
assert_equal "Sam-Gamgee.textile", @wiki.page("Sam Gamgee").filename
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update page with name and format change, verify canonicalization of filename, where filename contains Whitespace" do
|
test "update page with name and format change, verify canonicalization of filename, where filename contains Whitespace" do
|
||||||
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
|
||||||
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
|
||||||
@@ -283,8 +283,8 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
|
|||||||
assert_equal :textile, @wiki.page("Sam Gamgee").format
|
assert_equal :textile, @wiki.page("Sam Gamgee").format
|
||||||
assert_equal "h1. Samwise Gamgee", @wiki.page("Sam Gamgee").raw_data
|
assert_equal "h1. Samwise Gamgee", @wiki.page("Sam Gamgee").raw_data
|
||||||
assert_equal "Sam-Gamgee.textile", @wiki.page("Sam Gamgee").filename
|
assert_equal "Sam-Gamgee.textile", @wiki.page("Sam Gamgee").filename
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
FileUtils.rm_rf(@path)
|
FileUtils.rm_rf(@path)
|
||||||
end
|
end
|
||||||
@@ -382,7 +382,7 @@ context "Wiki sync with working directory (filename contains whitespace)" do
|
|||||||
@wiki.delete_page(page, commit_details)
|
@wiki.delete_page(page, commit_details)
|
||||||
assert !File.exist?(File.join(@path, "Samwise Gamgee.mediawiki"))
|
assert !File.exist?(File.join(@path, "Samwise Gamgee.mediawiki"))
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
FileUtils.rm_r(@path)
|
FileUtils.rm_r(@path)
|
||||||
end
|
end
|
||||||
@@ -401,7 +401,7 @@ context "page_file_dir option" do
|
|||||||
assert_equal "Hi", File.read(File.join(@path, @page_file_dir, "New-Page.md"))
|
assert_equal "Hi", File.read(File.join(@path, @page_file_dir, "New-Page.md"))
|
||||||
assert !File.exist?(File.join(@path, "New-Page.md"))
|
assert !File.exist?(File.join(@path, "New-Page.md"))
|
||||||
end
|
end
|
||||||
|
|
||||||
test "edit a page in a sub directory" do
|
test "edit a page in a sub directory" do
|
||||||
page = @wiki.page('foo')
|
page = @wiki.page('foo')
|
||||||
@wiki.update_page(page, page.name, page.format, 'new contents', commit_details)
|
@wiki.update_page(page, page.name, page.format, 'new contents', commit_details)
|
||||||
|
|||||||
Reference in New Issue
Block a user