ocd whitespace. currently seeking professional help
This commit is contained in:
+2
-2
@@ -48,8 +48,8 @@ module Gollum
|
|||||||
def find(name, version)
|
def find(name, version)
|
||||||
commit = @wiki.repo.commit(version)
|
commit = @wiki.repo.commit(version)
|
||||||
if blob = commit.tree / name
|
if blob = commit.tree / name
|
||||||
@blob = blob
|
@blob = blob
|
||||||
@path = name
|
@path = name
|
||||||
@version = commit
|
@version = commit
|
||||||
self
|
self
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ module Precious
|
|||||||
module Editable
|
module Editable
|
||||||
def formats(selected = @page.format)
|
def formats(selected = @page.format)
|
||||||
Gollum::Page::FORMAT_NAMES.map do |key, val|
|
Gollum::Page::FORMAT_NAMES.map do |key, val|
|
||||||
{ :name => val,
|
{ :name => val,
|
||||||
:id => key.to_s,
|
:id => key.to_s,
|
||||||
:selected => selected == key}
|
:selected => selected == key}
|
||||||
end.sort do |a, b|
|
end.sort do |a, b|
|
||||||
a[:name].downcase <=> b[:name].downcase
|
a[:name].downcase <=> b[:name].downcase
|
||||||
|
|||||||
+10
-10
@@ -8,12 +8,12 @@ module Gollum
|
|||||||
#
|
#
|
||||||
# Returns a new Gollum::Markup object, ready for rendering.
|
# Returns a new Gollum::Markup object, ready for rendering.
|
||||||
def initialize(page)
|
def initialize(page)
|
||||||
@wiki = page.wiki
|
@wiki = page.wiki
|
||||||
@name = page.name
|
@name = page.name
|
||||||
@data = page.raw_data
|
@data = page.raw_data
|
||||||
@version = page.version.id
|
@version = page.version.id
|
||||||
@dir = ::File.dirname(page.path)
|
@dir = ::File.dirname(page.path)
|
||||||
@tagmap = {}
|
@tagmap = {}
|
||||||
@codemap = {}
|
@codemap = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -93,8 +93,8 @@ module Gollum
|
|||||||
# if it is not.
|
# if it is not.
|
||||||
def process_image_tag(tag)
|
def process_image_tag(tag)
|
||||||
parts = tag.split('|')
|
parts = tag.split('|')
|
||||||
name = parts[0].strip
|
name = parts[0].strip
|
||||||
path = nil
|
path = nil
|
||||||
|
|
||||||
if file = find_file(name)
|
if file = find_file(name)
|
||||||
path = "/#{file.path}"
|
path = "/#{file.path}"
|
||||||
@@ -108,7 +108,7 @@ module Gollum
|
|||||||
containered = false
|
containered = false
|
||||||
|
|
||||||
classes = [] # applied to whatever the outermost container is
|
classes = [] # applied to whatever the outermost container is
|
||||||
attrs = [] # applied to the image
|
attrs = [] # applied to the image
|
||||||
|
|
||||||
align = opts['align']
|
align = opts['align']
|
||||||
if opts['float']
|
if opts['float']
|
||||||
@@ -200,9 +200,9 @@ module Gollum
|
|||||||
# if it is not.
|
# if it is not.
|
||||||
def process_page_link_tag(tag)
|
def process_page_link_tag(tag)
|
||||||
parts = tag.split('|')
|
parts = tag.split('|')
|
||||||
name = parts[0].strip
|
name = parts[0].strip
|
||||||
cname = Page.cname((parts[1] || parts[0]).strip)
|
cname = Page.cname((parts[1] || parts[0]).strip)
|
||||||
link = ::File.join(@wiki.base_path, cname)
|
link = ::File.join(@wiki.base_path, cname)
|
||||||
presence = @wiki.page(cname) ? "present" : "absent"
|
presence = @wiki.page(cname) ? "present" : "absent"
|
||||||
%{<a class="internal #{presence}" href="#{link}">#{name}</a>}
|
%{<a class="internal #{presence}" href="#{link}">#{name}</a>}
|
||||||
end
|
end
|
||||||
|
|||||||
+13
-13
@@ -6,14 +6,14 @@ module Gollum
|
|||||||
|
|
||||||
VALID_PAGE_RE = /^(.+)\.(md|mkdn?|mdown|markdown|textile|rdoc|org|creole|re?st(\.txt)?|asciidoc|pod|\d)$/i
|
VALID_PAGE_RE = /^(.+)\.(md|mkdn?|mdown|markdown|textile|rdoc|org|creole|re?st(\.txt)?|asciidoc|pod|\d)$/i
|
||||||
FORMAT_NAMES = { :markdown => "Markdown",
|
FORMAT_NAMES = { :markdown => "Markdown",
|
||||||
:textile => "Textile",
|
:textile => "Textile",
|
||||||
:rdoc => "RDoc",
|
:rdoc => "RDoc",
|
||||||
:org => "Org-mode",
|
:org => "Org-mode",
|
||||||
:creole => "Creole",
|
:creole => "Creole",
|
||||||
:rest => "reStructuredText",
|
:rest => "reStructuredText",
|
||||||
:asciidoc => "AsciiDoc",
|
:asciidoc => "AsciiDoc",
|
||||||
:pod => "Pod",
|
:pod => "Pod",
|
||||||
:roff => "roff" }
|
:roff => "roff" }
|
||||||
|
|
||||||
# Public: Initialize a page.
|
# Public: Initialize a page.
|
||||||
#
|
#
|
||||||
@@ -125,13 +125,13 @@ module Gollum
|
|||||||
def self.format_to_ext(format)
|
def self.format_to_ext(format)
|
||||||
case format
|
case format
|
||||||
when :markdown then 'md'
|
when :markdown then 'md'
|
||||||
when :textile then 'textile'
|
when :textile then 'textile'
|
||||||
when :rdoc then 'rdoc'
|
when :rdoc then 'rdoc'
|
||||||
when :org then 'org'
|
when :org then 'org'
|
||||||
when :creole then 'creole'
|
when :creole then 'creole'
|
||||||
when :rest then 'rest'
|
when :rest then 'rest'
|
||||||
when :asciidoc then 'asciidoc'
|
when :asciidoc then 'asciidoc'
|
||||||
when :pod then 'pod'
|
when :pod then 'pod'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -50,7 +50,7 @@ module Gollum
|
|||||||
def initialize(path, options = {})
|
def initialize(path, options = {})
|
||||||
@path = path
|
@path = path
|
||||||
@repo = Grit::Repo.new(path)
|
@repo = Grit::Repo.new(path)
|
||||||
@base_path = options[:base_path] || "/"
|
@base_path = options[:base_path] || "/"
|
||||||
@page_class = options[:page_class] || self.class.page_class
|
@page_class = options[:page_class] || self.class.page_class
|
||||||
@file_class = options[:file_class] || self.class.file_class
|
@file_class = options[:file_class] || self.class.file_class
|
||||||
end
|
end
|
||||||
@@ -99,11 +99,11 @@ module Gollum
|
|||||||
map = tree_map(pcommit.tree)
|
map = tree_map(pcommit.tree)
|
||||||
end
|
end
|
||||||
|
|
||||||
map = add_to_tree_map(map, '', name, format, data)
|
map = add_to_tree_map(map, '', name, format, data)
|
||||||
index = tree_map_to_index(map)
|
index = tree_map_to_index(map)
|
||||||
|
|
||||||
parents = pcommit ? [pcommit] : []
|
parents = pcommit ? [pcommit] : []
|
||||||
actor = Grit::Actor.new(commit[:name], commit[:email])
|
actor = Grit::Actor.new(commit[:name], commit[:email])
|
||||||
index.commit(commit[:message], parents, actor)
|
index.commit(commit[:message], parents, actor)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ module Gollum
|
|||||||
# Returns the String SHA1 of the newly written version.
|
# Returns the String SHA1 of the newly written version.
|
||||||
def update_page(page, format, data, commit = {})
|
def update_page(page, format, data, commit = {})
|
||||||
pcommit = @repo.commit('master')
|
pcommit = @repo.commit('master')
|
||||||
map = tree_map(pcommit.tree)
|
map = tree_map(pcommit.tree)
|
||||||
|
|
||||||
index = nil
|
index = nil
|
||||||
|
|
||||||
@@ -131,10 +131,10 @@ module Gollum
|
|||||||
index = tree_map_to_index(map)
|
index = tree_map_to_index(map)
|
||||||
index.add(page.path, normalize(data))
|
index.add(page.path, normalize(data))
|
||||||
else
|
else
|
||||||
map = delete_from_tree_map(map, page.path)
|
map = delete_from_tree_map(map, page.path)
|
||||||
dir = ::File.dirname(page.path)
|
dir = ::File.dirname(page.path)
|
||||||
name = page.name.split('.')[0..-2].join('.')
|
name = page.name.split('.')[0..-2].join('.')
|
||||||
map = add_to_tree_map(map, dir, name, format, data)
|
map = add_to_tree_map(map, dir, name, format, data)
|
||||||
index = tree_map_to_index(map)
|
index = tree_map_to_index(map)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -153,9 +153,9 @@ module Gollum
|
|||||||
# Returns the String SHA1 of the newly written version.
|
# Returns the String SHA1 of the newly written version.
|
||||||
def delete_page(page, commit)
|
def delete_page(page, commit)
|
||||||
pcommit = @repo.commit('master')
|
pcommit = @repo.commit('master')
|
||||||
map = tree_map(pcommit.tree)
|
map = tree_map(pcommit.tree)
|
||||||
|
|
||||||
map = delete_from_tree_map(map, page.path)
|
map = delete_from_tree_map(map, page.path)
|
||||||
index = tree_map_to_index(map)
|
index = tree_map_to_index(map)
|
||||||
|
|
||||||
actor = Grit::Actor.new(commit[:name], commit[:email])
|
actor = Grit::Actor.new(commit[:name], commit[:email])
|
||||||
@@ -292,7 +292,7 @@ module Gollum
|
|||||||
# Returns the modified Hash tree map.
|
# Returns the modified Hash tree map.
|
||||||
def delete_from_tree_map(map, path)
|
def delete_from_tree_map(map, path)
|
||||||
parts = path.split('/')
|
parts = path.split('/')
|
||||||
name = parts.pop
|
name = parts.pop
|
||||||
container = nil
|
container = nil
|
||||||
parts.each do |part|
|
parts.each do |part|
|
||||||
container = map[part]
|
container = map[part]
|
||||||
|
|||||||
Reference in New Issue
Block a user