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