gollum 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gollum might be problematic. Click here for more details.
- data/Gemfile +1 -0
- data/HISTORY.md +13 -0
- data/README.md +1 -1
- data/gollum.gemspec +4 -3
- data/lib/gollum.rb +11 -11
- data/lib/gollum/committer.rb +1 -1
- data/lib/gollum/frontend/app.rb +7 -4
- data/lib/gollum/frontend/public/javascript/editor/gollum.editor.js +1 -1
- data/lib/gollum/frontend/templates/page.mustache +3 -1
- data/lib/gollum/frontend/views/page.rb +4 -0
- data/lib/gollum/git_access.rb +11 -7
- data/lib/gollum/markup.rb +46 -0
- data/lib/gollum/page.rb +5 -1
- data/lib/gollum/sanitization.rb +33 -1
- data/lib/gollum/wiki.rb +40 -14
- data/test/helper.rb +6 -0
- data/test/test_markup.rb +17 -3
- data/test/test_wiki.rb +19 -0
- metadata +45 -15
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
# 1.3.1 / 2011-07-21
|
2
|
+
|
3
|
+
* Major Enhancements
|
4
|
+
* Allow prefixed ID attributes in headers to support internal linking
|
5
|
+
(#146).
|
6
|
+
* Markdown pages are rendered through Redcarpet by default (#176).
|
7
|
+
* Minor Enhancements
|
8
|
+
* Remove Edit button on Preview pages (#164).
|
9
|
+
* Simplify Wiki#inspect and Page#inspect.
|
10
|
+
* Bug Fixes
|
11
|
+
* Fixed broken preview functionality (#157).
|
12
|
+
* Fixed sidebar/footer rendering problems related to whitespace (#145).
|
13
|
+
|
1
14
|
# 1.3.0 / 2011-04-25
|
2
15
|
|
3
16
|
* Major Enhancements
|
data/README.md
CHANGED
@@ -318,7 +318,7 @@ and `\]`. For example:
|
|
318
318
|
Inline equations are delimited by `\(` and `\)`. These equations will appear
|
319
319
|
inline with regular text. For example:
|
320
320
|
|
321
|
-
The Pythagorean
|
321
|
+
The Pythagorean theorem is \( a^2 + b^2 = c^2 \).
|
322
322
|
|
323
323
|
Gollum uses [MathJax](http://www.mathjax.org/) to convert the TeX syntax into
|
324
324
|
output suitable for display in web browsers.
|
data/gollum.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
|
6
6
|
s.name = 'gollum'
|
7
|
-
s.version = '1.3.
|
8
|
-
s.date = '2011-
|
7
|
+
s.version = '1.3.1'
|
8
|
+
s.date = '2011-07-21'
|
9
9
|
s.rubyforge_project = 'gollum'
|
10
10
|
|
11
11
|
s.summary = "A simple, Git-powered wiki."
|
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.require_paths = %w[lib]
|
19
19
|
|
20
20
|
s.executables = ["gollum"]
|
21
|
-
s.default_executable = 'gollum'
|
22
21
|
|
23
22
|
s.rdoc_options = ["--charset=UTF-8"]
|
24
23
|
s.extra_rdoc_files = %w[README.md LICENSE]
|
@@ -30,6 +29,7 @@ Gem::Specification.new do |s|
|
|
30
29
|
s.add_dependency('mustache', [">= 0.11.2", "< 1.0.0"])
|
31
30
|
s.add_dependency('sanitize', "~> 2.0.0")
|
32
31
|
s.add_dependency('nokogiri', "~> 1.4")
|
32
|
+
s.add_dependency('redcarpet')
|
33
33
|
|
34
34
|
s.add_development_dependency('RedCloth')
|
35
35
|
s.add_development_dependency('mocha')
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.add_development_dependency('shoulda')
|
39
39
|
s.add_development_dependency('rack-test')
|
40
40
|
s.add_development_dependency('wikicloth')
|
41
|
+
s.add_development_dependency('rake', '~> 0.9.2')
|
41
42
|
|
42
43
|
# = MANIFEST =
|
43
44
|
s.files = %w[
|
data/lib/gollum.rb
CHANGED
@@ -8,19 +8,19 @@ require 'github/markup'
|
|
8
8
|
require 'sanitize'
|
9
9
|
|
10
10
|
# internal
|
11
|
-
require 'gollum/git_access'
|
12
|
-
require 'gollum/committer'
|
13
|
-
require 'gollum/pagination'
|
14
|
-
require 'gollum/blob_entry'
|
15
|
-
require 'gollum/wiki'
|
16
|
-
require 'gollum/page'
|
17
|
-
require 'gollum/file'
|
18
|
-
require 'gollum/markup'
|
19
|
-
require 'gollum/albino'
|
20
|
-
require 'gollum/sanitization'
|
11
|
+
require File.expand_path('../gollum/git_access', __FILE__)
|
12
|
+
require File.expand_path('../gollum/committer', __FILE__)
|
13
|
+
require File.expand_path('../gollum/pagination', __FILE__)
|
14
|
+
require File.expand_path('../gollum/blob_entry', __FILE__)
|
15
|
+
require File.expand_path('../gollum/wiki', __FILE__)
|
16
|
+
require File.expand_path('../gollum/page', __FILE__)
|
17
|
+
require File.expand_path('../gollum/file', __FILE__)
|
18
|
+
require File.expand_path('../gollum/markup', __FILE__)
|
19
|
+
require File.expand_path('../gollum/albino', __FILE__)
|
20
|
+
require File.expand_path('../gollum/sanitization', __FILE__)
|
21
21
|
|
22
22
|
module Gollum
|
23
|
-
VERSION = '1.3.
|
23
|
+
VERSION = '1.3.1'
|
24
24
|
|
25
25
|
class Error < StandardError; end
|
26
26
|
|
data/lib/gollum/committer.rb
CHANGED
@@ -118,7 +118,7 @@ module Gollum
|
|
118
118
|
def update_working_dir(dir, name, format)
|
119
119
|
unless @wiki.repo.bare
|
120
120
|
if @wiki.page_file_dir
|
121
|
-
dir = dir.size.zero? ? @wiki.page_file_dir : File.join(dir, @wiki.page_file_dir)
|
121
|
+
dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(dir, @wiki.page_file_dir)
|
122
122
|
end
|
123
123
|
|
124
124
|
path =
|
data/lib/gollum/frontend/app.rb
CHANGED
@@ -106,10 +106,11 @@ module Precious
|
|
106
106
|
end
|
107
107
|
|
108
108
|
post '/preview' do
|
109
|
-
wiki
|
110
|
-
@name
|
111
|
-
@page
|
112
|
-
@content
|
109
|
+
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
110
|
+
@name = "Preview"
|
111
|
+
@page = wiki.preview_page(@name, params[:content], params[:format])
|
112
|
+
@content = @page.formatted_data
|
113
|
+
@editable = false
|
113
114
|
mustache :page
|
114
115
|
end
|
115
116
|
|
@@ -155,6 +156,7 @@ module Precious
|
|
155
156
|
@page = page
|
156
157
|
@name = name
|
157
158
|
@content = page.formatted_data
|
159
|
+
@editable = true
|
158
160
|
mustache :page
|
159
161
|
else
|
160
162
|
halt 404
|
@@ -186,6 +188,7 @@ module Precious
|
|
186
188
|
@page = page
|
187
189
|
@name = name
|
188
190
|
@content = page.formatted_data
|
191
|
+
@editable = true
|
189
192
|
mustache :page
|
190
193
|
elsif file = wiki.file(name)
|
191
194
|
content_type file.mime_type
|
@@ -62,7 +62,7 @@
|
|
62
62
|
// get form fields
|
63
63
|
var oldAction = $('#gollum-editor form').attr('action');
|
64
64
|
var $form = $($('#gollum-editor form').get(0));
|
65
|
-
$form.attr('action',
|
65
|
+
$form.attr('action', '/preview');
|
66
66
|
$form.attr('target', '_blank');
|
67
67
|
$form.submit();
|
68
68
|
|
@@ -6,15 +6,17 @@
|
|
6
6
|
class="action-all-pages">All Pages</a></li>
|
7
7
|
<li class="minibutton" class="jaws">
|
8
8
|
<a href="#" id="minibutton-new-page">New Page</a></li>
|
9
|
+
{{#editable}}
|
9
10
|
<li class="minibutton"><a href="/edit/{{escaped_name}}"
|
10
11
|
class="action-edit-page">Edit Page</a></li>
|
12
|
+
{{/editable}}
|
11
13
|
<li class="minibutton"><a href="/history/{{escaped_name}}"
|
12
14
|
class="action-page-history">Page History</a></li>
|
13
15
|
</ul>
|
14
16
|
{{>searchbar}}
|
15
17
|
</div>
|
16
18
|
<div id="wiki-content">
|
17
|
-
|
19
|
+
<div class="wrap {{#has_footer}} has-footer {{/has_footer}} {{#has_sidebar}} has-rightbar{{/has_sidebar}}">
|
18
20
|
<div id="wiki-body" class="gollum-{{format}}-content">
|
19
21
|
<div id="template">
|
20
22
|
{{{content}}}
|
data/lib/gollum/git_access.rb
CHANGED
@@ -28,13 +28,17 @@ module Gollum
|
|
28
28
|
#
|
29
29
|
# ref - a String Git reference (ex: "master")
|
30
30
|
#
|
31
|
-
# Returns a String.
|
31
|
+
# Returns a String, or nil if the ref isn't found.
|
32
32
|
def ref_to_sha(ref)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
ref = ref.to_s
|
34
|
+
return if ref.empty?
|
35
|
+
sha =
|
36
|
+
if sha?(ref)
|
37
|
+
ref
|
38
|
+
else
|
39
|
+
get_cache(:ref, ref) { ref_to_sha!(ref) }
|
40
|
+
end.to_s
|
41
|
+
sha.empty? ? nil : sha
|
38
42
|
end
|
39
43
|
|
40
44
|
# Public: Gets a recursive list of Git blobs for the whole tree at the
|
@@ -238,4 +242,4 @@ module Gollum
|
|
238
242
|
path
|
239
243
|
end
|
240
244
|
end
|
241
|
-
end
|
245
|
+
end
|
data/lib/gollum/markup.rb
CHANGED
@@ -2,6 +2,7 @@ require 'digest/sha1'
|
|
2
2
|
require 'cgi'
|
3
3
|
|
4
4
|
module Gollum
|
5
|
+
|
5
6
|
class Markup
|
6
7
|
# Initialize a new Markup object.
|
7
8
|
#
|
@@ -437,4 +438,49 @@ module Gollum
|
|
437
438
|
def update_cache(type, id, data)
|
438
439
|
end
|
439
440
|
end
|
441
|
+
|
442
|
+
begin
|
443
|
+
require 'redcarpet'
|
444
|
+
|
445
|
+
class MarkupGFM < Markup
|
446
|
+
def render(no_follow = false)
|
447
|
+
sanitize = no_follow ?
|
448
|
+
@wiki.history_sanitizer :
|
449
|
+
@wiki.sanitizer
|
450
|
+
|
451
|
+
data = extract_tex(@data.dup)
|
452
|
+
data = extract_tags(data)
|
453
|
+
|
454
|
+
flags = [
|
455
|
+
:autolink,
|
456
|
+
:fenced_code,
|
457
|
+
:tables,
|
458
|
+
:strikethrough,
|
459
|
+
:lax_htmlblock,
|
460
|
+
:gh_blockcode,
|
461
|
+
:no_intraemphasis
|
462
|
+
]
|
463
|
+
data = Redcarpet.new(data, *flags).to_html
|
464
|
+
data = process_tags(data)
|
465
|
+
|
466
|
+
doc = Nokogiri::HTML::DocumentFragment.parse(data)
|
467
|
+
|
468
|
+
doc.search('pre').each do |node|
|
469
|
+
next unless lang = node['lang']
|
470
|
+
text = node.inner_text
|
471
|
+
html = Gollum::Albino.colorize(text, lang)
|
472
|
+
node.replace(html)
|
473
|
+
end
|
474
|
+
|
475
|
+
doc = sanitize.clean_node!(doc) if sanitize
|
476
|
+
yield doc if block_given?
|
477
|
+
|
478
|
+
data = doc_to_html(doc)
|
479
|
+
data = process_tex(data)
|
480
|
+
data
|
481
|
+
end
|
482
|
+
end
|
483
|
+
rescue LoadError
|
484
|
+
MarkupGFM = Markup
|
485
|
+
end
|
440
486
|
end
|
data/lib/gollum/page.rb
CHANGED
@@ -168,7 +168,7 @@ module Gollum
|
|
168
168
|
#
|
169
169
|
# Returns the String data.
|
170
170
|
def formatted_data(&block)
|
171
|
-
@blob && @wiki.
|
171
|
+
@blob && @wiki.markup_classes[format].new(self).render(historical?, &block)
|
172
172
|
end
|
173
173
|
|
174
174
|
# Public: The format of the page.
|
@@ -390,5 +390,9 @@ module Gollum
|
|
390
390
|
|
391
391
|
find_page_in_tree(map, name, '')
|
392
392
|
end
|
393
|
+
|
394
|
+
def inspect
|
395
|
+
%(#<#{self.class.name}:#{object_id} #{name} (#{format}) @wiki=#{@wiki.repo.path.inspect}>)
|
396
|
+
end
|
393
397
|
end
|
394
398
|
end
|
data/lib/gollum/sanitization.rb
CHANGED
@@ -47,6 +47,27 @@ module Gollum
|
|
47
47
|
'img' => {'src' => ['http', 'https', :relative]}
|
48
48
|
}.freeze
|
49
49
|
|
50
|
+
# Default transformers to force @id attributes with 'wiki-' prefix
|
51
|
+
|
52
|
+
TRANSFORMERS = [
|
53
|
+
lambda do |env|
|
54
|
+
node = env[:node]
|
55
|
+
return if env[:is_whitelisted] || !node.element? || !node['id']
|
56
|
+
prefix = env[:config][:id_prefix]
|
57
|
+
node['id'] = node['id'].gsub(/\A(#{prefix})?/, prefix)
|
58
|
+
|
59
|
+
{:node_whitelist => [node]}
|
60
|
+
end,
|
61
|
+
lambda do |env|
|
62
|
+
node = env[:node]
|
63
|
+
return unless node['href']
|
64
|
+
prefix = env[:config][:id_prefix]
|
65
|
+
node['href'] = node['href'].gsub(/\A\#(#{prefix})?/, '#'+prefix)
|
66
|
+
|
67
|
+
{:node_whitelist => [node]}
|
68
|
+
end
|
69
|
+
].freeze
|
70
|
+
|
50
71
|
# Gets an Array of whitelisted HTML elements. Default: ELEMENTS.
|
51
72
|
attr_reader :elements
|
52
73
|
|
@@ -58,6 +79,13 @@ module Gollum
|
|
58
79
|
# attributes. Default: PROTOCOLS
|
59
80
|
attr_reader :protocols
|
60
81
|
|
82
|
+
# Gets a Hash describing which URI protocols are allowed in HTML
|
83
|
+
# attributes. Default: TRANSFORMERS
|
84
|
+
attr_reader :transformers
|
85
|
+
|
86
|
+
# Gets a String prefix which is added to ID attributes. Default: 'wiki-'
|
87
|
+
attr_reader :id_prefix
|
88
|
+
|
61
89
|
# Gets a Hash describing HTML attributes that Sanitize should add.
|
62
90
|
# Default: {}
|
63
91
|
attr_reader :add_attributes
|
@@ -70,8 +98,10 @@ module Gollum
|
|
70
98
|
@elements = ELEMENTS
|
71
99
|
@attributes = ATTRIBUTES
|
72
100
|
@protocols = PROTOCOLS
|
101
|
+
@transformers = TRANSFORMERS
|
73
102
|
@add_attributes = {}
|
74
103
|
@allow_comments = false
|
104
|
+
@id_prefix = 'wiki-'
|
75
105
|
yield self if block_given?
|
76
106
|
end
|
77
107
|
|
@@ -100,7 +130,9 @@ module Gollum
|
|
100
130
|
:attributes => attributes,
|
101
131
|
:protocols => protocols,
|
102
132
|
:add_attributes => add_attributes,
|
103
|
-
:allow_comments => allow_comments
|
133
|
+
:allow_comments => allow_comments?,
|
134
|
+
:transformers => transformers,
|
135
|
+
:id_prefix => id_prefix
|
104
136
|
}
|
105
137
|
end
|
106
138
|
|
data/lib/gollum/wiki.rb
CHANGED
@@ -10,7 +10,7 @@ module Gollum
|
|
10
10
|
attr_writer :file_class
|
11
11
|
|
12
12
|
# Sets the markup class used by all instances of this Wiki.
|
13
|
-
attr_writer :
|
13
|
+
attr_writer :markup_classes
|
14
14
|
|
15
15
|
# Sets the default ref for the wiki.
|
16
16
|
attr_accessor :default_ref
|
@@ -53,15 +53,33 @@ module Gollum
|
|
53
53
|
|
54
54
|
# Gets the markup class used by all instances of this Wiki.
|
55
55
|
# Default: Gollum::Markup
|
56
|
-
def
|
57
|
-
@
|
58
|
-
if superclass.respond_to?(:
|
59
|
-
superclass.
|
56
|
+
def markup_classes
|
57
|
+
@markup_classes ||
|
58
|
+
if superclass.respond_to?(:markup_classes)
|
59
|
+
superclass.markup_classes
|
60
60
|
else
|
61
|
-
::Gollum::Markup
|
61
|
+
classes = Hash.new(::Gollum::Markup)
|
62
|
+
|
63
|
+
# Add custom markup classes for different languages
|
64
|
+
classes[:markdown] = ::Gollum::MarkupGFM
|
65
|
+
classes
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
69
|
+
# Gets the default markup class used by all instances of this Wiki.
|
70
|
+
# Kept for backwards compatibility until Gollum v2.x
|
71
|
+
def markup_class
|
72
|
+
markup_classes[:default]
|
73
|
+
end
|
74
|
+
|
75
|
+
# Sets the default markup class used by all instances of this Wiki.
|
76
|
+
# Kept for backwards compatibility until Gollum v2.x
|
77
|
+
def markup_class=(default)
|
78
|
+
new_classes = Hash.new default
|
79
|
+
@markup_classes = Hash.new(default).update(markup_classes)
|
80
|
+
default
|
81
|
+
end
|
82
|
+
|
65
83
|
# Gets the default sanitization options for current pages used by
|
66
84
|
# instances of this Wiki.
|
67
85
|
def sanitization
|
@@ -113,7 +131,8 @@ module Gollum
|
|
113
131
|
# Default: "/"
|
114
132
|
# :page_class - The page Class. Default: Gollum::Page
|
115
133
|
# :file_class - The file Class. Default: Gollum::File
|
116
|
-
# :
|
134
|
+
# :markup_classes - A hash containing the markup Classes for each
|
135
|
+
# document type. Default: { Gollum::Markup }
|
117
136
|
# :sanitization - An instance of Sanitization.
|
118
137
|
# :page_file_dir - String the directory in which all page files reside
|
119
138
|
# :ref - String the repository ref to retrieve pages from
|
@@ -130,7 +149,7 @@ module Gollum
|
|
130
149
|
@base_path = options[:base_path] || "/"
|
131
150
|
@page_class = options[:page_class] || self.class.page_class
|
132
151
|
@file_class = options[:file_class] || self.class.file_class
|
133
|
-
@
|
152
|
+
@markup_classes = options[:markup_classes] || self.class.markup_classes
|
134
153
|
@repo = @access.repo
|
135
154
|
@ref = options[:ref] || self.class.default_ref
|
136
155
|
@sanitization = options[:sanitization] || self.class.sanitization
|
@@ -492,7 +511,7 @@ module Gollum
|
|
492
511
|
attr_reader :file_class
|
493
512
|
|
494
513
|
# Gets the markup class used by all instances of this Wiki.
|
495
|
-
attr_reader :
|
514
|
+
attr_reader :markup_classes
|
496
515
|
|
497
516
|
# Normalize the data.
|
498
517
|
#
|
@@ -520,11 +539,14 @@ module Gollum
|
|
520
539
|
#
|
521
540
|
# Returns a flat Array of Gollum::Page instances.
|
522
541
|
def tree_list(ref)
|
523
|
-
sha
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
542
|
+
if sha = @access.ref_to_sha(ref)
|
543
|
+
commit = @access.commit(sha)
|
544
|
+
tree_map_for(sha).inject([]) do |list, entry|
|
545
|
+
next list unless @page_class.valid_page_name?(entry.name)
|
546
|
+
list << entry.page(self, commit)
|
547
|
+
end
|
548
|
+
else
|
549
|
+
[]
|
528
550
|
end
|
529
551
|
end
|
530
552
|
|
@@ -593,5 +615,9 @@ module Gollum
|
|
593
615
|
rescue Grit::GitRuby::Repository::NoSuchShaFound
|
594
616
|
[]
|
595
617
|
end
|
618
|
+
|
619
|
+
def inspect
|
620
|
+
%(#<#{self.class.name}:#{object_id} #{@repo.path}>)
|
621
|
+
end
|
596
622
|
end
|
597
623
|
end
|
data/test/helper.rb
CHANGED
data/test/test_markup.rb
CHANGED
@@ -173,7 +173,7 @@ context "Markup" do
|
|
173
173
|
@wiki.write_page("Potato", :mediawiki, "a [[Potato|Potato Heaad]] ", commit_details)
|
174
174
|
page = @wiki.page("Potato")
|
175
175
|
output = page.formatted_data
|
176
|
-
assert_equal "<p>\na <a class=\"internal present\" href=\"/Potato\">Potato Heaad</a> </p>", output
|
176
|
+
assert_equal normal("<p>\na <a class=\"internal present\" href=\"/Potato\">Potato Heaad</a> </p>"), normal(output)
|
177
177
|
end
|
178
178
|
|
179
179
|
#########################################################################
|
@@ -467,6 +467,20 @@ context "Markup" do
|
|
467
467
|
compare(content, output, 'org')
|
468
468
|
end
|
469
469
|
|
470
|
+
test "id with prefix ok" do
|
471
|
+
content = "h2(example#wiki-foo). xxxx"
|
472
|
+
output = %(<h2 class="example" id="wiki-foo">xxxx</h2>)
|
473
|
+
compare(content, output, :textile)
|
474
|
+
end
|
475
|
+
|
476
|
+
test "id prefix added" do
|
477
|
+
content = "h2(#foo). xxxx[1]\n\nfn1.footnote"
|
478
|
+
output = "<h2 id=\"wiki-foo\">xxxx" +
|
479
|
+
"<sup class=\"footnote\" id=\"wiki-fnr1\"><a href=\"#wiki-fn1\">1</a></sup></h2>" +
|
480
|
+
"\n<p class=\"footnote\" id=\"wiki-fn1\"><a href=\"#wiki-fnr1\"><sup>1</sup></a> footnote</p>"
|
481
|
+
compare(content, output, :textile)
|
482
|
+
end
|
483
|
+
|
470
484
|
#########################################################################
|
471
485
|
#
|
472
486
|
# TeX
|
@@ -499,7 +513,7 @@ context "Markup" do
|
|
499
513
|
page = @wiki.page("Bilbo Baggins")
|
500
514
|
rendered = Gollum::Markup.new(page).render
|
501
515
|
if regexes.empty?
|
502
|
-
assert_equal output, rendered
|
516
|
+
assert_equal normal(output), normal(rendered)
|
503
517
|
else
|
504
518
|
regexes.each { |r| assert_match r, output }
|
505
519
|
end
|
@@ -514,6 +528,6 @@ context "Markup" do
|
|
514
528
|
@wiki.clear_cache
|
515
529
|
page = @wiki.page("Bilbo Baggins")
|
516
530
|
rendered = Gollum::Markup.new(page).render
|
517
|
-
assert_equal output, rendered
|
531
|
+
assert_equal normal(output), normal(rendered)
|
518
532
|
end
|
519
533
|
end
|
data/test/test_wiki.rb
CHANGED
@@ -4,6 +4,20 @@ require File.expand_path(File.join(File.dirname(__FILE__), "helper"))
|
|
4
4
|
context "Wiki" do
|
5
5
|
setup do
|
6
6
|
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"))
|
7
|
+
Gollum::Wiki.markup_classes = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
test "#markup_class gets default markup" do
|
11
|
+
assert_equal Gollum::Markup, Gollum::Wiki.markup_class
|
12
|
+
end
|
13
|
+
|
14
|
+
test "#markup_class= doesn't clobber alternate markups" do
|
15
|
+
custom = Class.new(Gollum::Markup)
|
16
|
+
Gollum::Wiki.markup_class = custom
|
17
|
+
|
18
|
+
assert_equal custom, Gollum::Wiki.markup_class
|
19
|
+
assert_equal custom, Gollum::Wiki.markup_classes[:orgmode]
|
20
|
+
assert_equal Gollum::MarkupGFM, Gollum::Wiki.markup_classes[:markdown]
|
7
21
|
end
|
8
22
|
|
9
23
|
test "repo path" do
|
@@ -282,6 +296,11 @@ context "page_file_dir option" do
|
|
282
296
|
assert_equal "Hi", File.read(File.join(@path, @page_file_dir, "New-Page.md"))
|
283
297
|
assert !File.exist?(File.join(@path, "New-Page.md"))
|
284
298
|
end
|
299
|
+
|
300
|
+
test "edit a page in a sub directory" do
|
301
|
+
page = @wiki.page('foo')
|
302
|
+
@wiki.update_page(page, page.name, page.format, 'new contents', commit_details)
|
303
|
+
end
|
285
304
|
|
286
305
|
test "a file in page file dir should be found" do
|
287
306
|
assert @wiki.page("foo")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 1
|
10
|
+
version: 1.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Preston-Werner
|
@@ -16,8 +16,8 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
20
|
-
default_executable:
|
19
|
+
date: 2011-07-21 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: grit
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
type: :runtime
|
147
147
|
version_requirements: *id007
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
|
-
name:
|
149
|
+
name: redcarpet
|
150
150
|
prerelease: false
|
151
151
|
requirement: &id008 !ruby/object:Gem::Requirement
|
152
152
|
none: false
|
@@ -157,10 +157,10 @@ dependencies:
|
|
157
157
|
segments:
|
158
158
|
- 0
|
159
159
|
version: "0"
|
160
|
-
type: :
|
160
|
+
type: :runtime
|
161
161
|
version_requirements: *id008
|
162
162
|
- !ruby/object:Gem::Dependency
|
163
|
-
name:
|
163
|
+
name: RedCloth
|
164
164
|
prerelease: false
|
165
165
|
requirement: &id009 !ruby/object:Gem::Requirement
|
166
166
|
none: false
|
@@ -174,7 +174,7 @@ dependencies:
|
|
174
174
|
type: :development
|
175
175
|
version_requirements: *id009
|
176
176
|
- !ruby/object:Gem::Dependency
|
177
|
-
name:
|
177
|
+
name: mocha
|
178
178
|
prerelease: false
|
179
179
|
requirement: &id010 !ruby/object:Gem::Requirement
|
180
180
|
none: false
|
@@ -188,7 +188,7 @@ dependencies:
|
|
188
188
|
type: :development
|
189
189
|
version_requirements: *id010
|
190
190
|
- !ruby/object:Gem::Dependency
|
191
|
-
name:
|
191
|
+
name: org-ruby
|
192
192
|
prerelease: false
|
193
193
|
requirement: &id011 !ruby/object:Gem::Requirement
|
194
194
|
none: false
|
@@ -202,7 +202,7 @@ dependencies:
|
|
202
202
|
type: :development
|
203
203
|
version_requirements: *id011
|
204
204
|
- !ruby/object:Gem::Dependency
|
205
|
-
name:
|
205
|
+
name: rdiscount
|
206
206
|
prerelease: false
|
207
207
|
requirement: &id012 !ruby/object:Gem::Requirement
|
208
208
|
none: false
|
@@ -216,7 +216,7 @@ dependencies:
|
|
216
216
|
type: :development
|
217
217
|
version_requirements: *id012
|
218
218
|
- !ruby/object:Gem::Dependency
|
219
|
-
name:
|
219
|
+
name: shoulda
|
220
220
|
prerelease: false
|
221
221
|
requirement: &id013 !ruby/object:Gem::Requirement
|
222
222
|
none: false
|
@@ -230,7 +230,7 @@ dependencies:
|
|
230
230
|
type: :development
|
231
231
|
version_requirements: *id013
|
232
232
|
- !ruby/object:Gem::Dependency
|
233
|
-
name:
|
233
|
+
name: rack-test
|
234
234
|
prerelease: false
|
235
235
|
requirement: &id014 !ruby/object:Gem::Requirement
|
236
236
|
none: false
|
@@ -243,6 +243,36 @@ dependencies:
|
|
243
243
|
version: "0"
|
244
244
|
type: :development
|
245
245
|
version_requirements: *id014
|
246
|
+
- !ruby/object:Gem::Dependency
|
247
|
+
name: wikicloth
|
248
|
+
prerelease: false
|
249
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
250
|
+
none: false
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
hash: 3
|
255
|
+
segments:
|
256
|
+
- 0
|
257
|
+
version: "0"
|
258
|
+
type: :development
|
259
|
+
version_requirements: *id015
|
260
|
+
- !ruby/object:Gem::Dependency
|
261
|
+
name: rake
|
262
|
+
prerelease: false
|
263
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
264
|
+
none: false
|
265
|
+
requirements:
|
266
|
+
- - ~>
|
267
|
+
- !ruby/object:Gem::Version
|
268
|
+
hash: 63
|
269
|
+
segments:
|
270
|
+
- 0
|
271
|
+
- 9
|
272
|
+
- 2
|
273
|
+
version: 0.9.2
|
274
|
+
type: :development
|
275
|
+
version_requirements: *id016
|
246
276
|
description: A simple, Git-powered wiki with a sweet API and local frontend.
|
247
277
|
email: tom@github.com
|
248
278
|
executables:
|
@@ -1047,7 +1077,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1047
1077
|
requirements: []
|
1048
1078
|
|
1049
1079
|
rubyforge_project: gollum
|
1050
|
-
rubygems_version: 1.
|
1080
|
+
rubygems_version: 1.6.2
|
1051
1081
|
signing_key:
|
1052
1082
|
specification_version: 2
|
1053
1083
|
summary: A simple, Git-powered wiki.
|