gollum-bibanon 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -7,6 +7,15 @@
7
7
  * Include the language of the code snippet when making a uniquely
8
8
  identifiable sha of a code snippet while rendering a page.
9
9
 
10
+ # 1.4.1 (Bibanon mod) / 2012-02-05
11
+
12
+ * Major Enhancements
13
+ * reversing mediawiki_compat
14
+ * Minor Enhancements
15
+ * Fixed incorrect redirect in new versions of sinatra
16
+ * Bug Fixes
17
+ * fixed sanitization bug
18
+
10
19
  # 1.4.0 (Bibanon mod) / 2012-02-04
11
20
 
12
21
  * Major Enhancements
data/README.md CHANGED
@@ -22,9 +22,9 @@ This is a fork of Gollum used by the Bibliotheca Anonoma. It adds some extra fun
22
22
 
23
23
  * [OmniAuth integration](https://github.com/github/gollum/pull/181) - Adds support for OmniGollum.
24
24
  * [OmniAuth User Commit Message](https://github.com/treeofsephiroth/gollum/commit/8400ad0749288f658f735625b7c39550134f7586) Adds the username from OmniAuth to a commit message.
25
- * [Underscore support in filenames](https://github.com/treeofsephiroth/gollum/commit/9710718b287ee79861f196d01094ee0c9c361730) - Adds underscore support in filenames, essential for importing Mediawiki pages
26
25
  * [Gollum Pull Request](https://github.com/github/gollum/pull/166)
27
26
  * [Fix `undefined method 'new' for Redcarpet:Module`](https://github.com/github/gollum/pull/271) - Forces the gem to use a working copy of redcarpet, rather than the new one.
27
+ * [Fix spaces in filenames breaking redirect](https://github.com/github/gollum/pull/249) - New edition of Sinatra uses + signs instead of dashes, breaking redirects.
28
28
  * Magnet links - Now allowed.
29
29
 
30
30
  ### Wishlist
@@ -4,12 +4,12 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'gollum-bibanon'
7
- s.version = '1.4.0'
7
+ s.version = '1.4.1'
8
8
  s.date = '2012-02-04'
9
9
  s.rubyforge_project = 'gollum'
10
10
 
11
11
  s.summary = "A simple, Git-powered wiki, with Bibanon mods."
12
- s.description = "A simple, Git-powered wiki with a sweet API and local frontend, modded for the Bibliotheca Anonoma. Uses the latest edition of Gollum, adds OmniGollum support, underscores in page names, and other cool stuff."
12
+ s.description = "A simple, Git-powered wiki with a sweet API and local frontend, modded for the Bibliotheca Anonoma. Uses the latest edition of Gollum, adds OmniGollum support, and other cool stuff."
13
13
 
14
14
  s.authors = ["Tom Preston-Werner", "Rick Olson", "Tenshi Hinanawi"]
15
15
  s.email = 'cockmomgler@gmail.com'
@@ -101,6 +101,7 @@ Gem::Specification.new do |s|
101
101
  lib/gollum/page.rb
102
102
  lib/gollum/pagination.rb
103
103
  lib/gollum/sanitization.rb
104
+ lib/gollum/tex.rb
104
105
  lib/gollum/wiki.rb
105
106
  templates/formatting.html
106
107
  test/examples/lotr.git/COMMIT_EDITMSG
@@ -20,7 +20,7 @@ require File.expand_path('../gollum/sanitization', __FILE__)
20
20
  require File.expand_path('../gollum/tex', __FILE__)
21
21
 
22
22
  module Gollum
23
- VERSION = '1.3.1'
23
+ VERSION = '1.4.1'
24
24
 
25
25
  class Error < StandardError; end
26
26
 
@@ -73,7 +73,7 @@ module Gollum
73
73
  #
74
74
  # dir - The String subdirectory of the Gollum::Page without any
75
75
  # prefix or suffix slashes (e.g. "foo/bar").
76
- # name - The String Gollum::Page filename_stripped.
76
+ # name - The String Gollum::Page name.
77
77
  # format - The Symbol Gollum::Page format.
78
78
  # data - The String wiki data to store in the tree map.
79
79
  # allow_same_ext - A Boolean determining if the tree map allows the same
@@ -111,8 +111,7 @@ module Gollum
111
111
  # is a working directory present.
112
112
  #
113
113
  # dir - The String directory in which the file lives.
114
- # name - The String name of the page or the stripped filename
115
- # (should be pre-canonicalized if required).
114
+ # name - The String name of the page (may be in human format).
116
115
  # format - The Symbol format of the page.
117
116
  #
118
117
  # Returns nothing.
@@ -87,7 +87,7 @@ module Precious
87
87
 
88
88
  begin
89
89
  wiki.write_page(name, format, params[:content], commit_message)
90
- redirect "/#{CGI.escape(name)}"
90
+ redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
91
91
  rescue Gollum::DuplicatePageError => e
92
92
  @message = "Duplicate page: #{e.message}"
93
93
  mustache :error
@@ -76,20 +76,11 @@ module Gollum
76
76
  end
77
77
 
78
78
  # Reusable filter to turn a filename (without path) into a canonical name.
79
- # Strips extension, converts dashes to spaces.
79
+ # Strips extension, converts spaces to dashes.
80
80
  #
81
81
  # Returns the filtered String.
82
82
  def self.canonicalize_filename(filename)
83
- strip_filename(filename).gsub('-', ' ')
84
- end
85
-
86
- # Reusable filter to strip extension and path from filename
87
- #
88
- # filename - The string path or filename to strip
89
- #
90
- # Returns the stripped String.
91
- def self.strip_filename(filename)
92
- ::File.basename(filename, ::File.extname(filename))
83
+ filename.split('.')[0..-2].join('.').gsub('-', ' ')
93
84
  end
94
85
 
95
86
  # Public: Initialize a page.
@@ -109,13 +100,6 @@ module Gollum
109
100
  @blob && @blob.name
110
101
  end
111
102
 
112
- # Public: The on-disk filename of the page with extension stripped.
113
- #
114
- # Returns the String name.
115
- def filename_stripped
116
- self.class.strip_filename(filename)
117
- end
118
-
119
103
  # Public: The canonical page name without extension, and dashes converted
120
104
  # to spaces.
121
105
  #
@@ -260,22 +244,17 @@ module Gollum
260
244
 
261
245
  # Convert a human page name into a canonical page name.
262
246
  #
263
- # name - The String human page name.
264
- # char_white_sub - Substitution for whitespace
265
- # char_other_sub - Substitution for other special chars
247
+ # name - The String human page name.
266
248
  #
267
249
  # Examples
268
250
  #
269
251
  # Page.cname("Bilbo Baggins")
270
252
  # # => 'Bilbo-Baggins'
271
253
  #
272
- # Page.cname("Bilbo Baggins",'_')
273
- # # => 'Bilbo_Baggins'
274
- #
275
254
  # Returns the String canonical name.
276
- def self.cname(name, char_white_sub = '-', char_other_sub = '-')
277
- name.respond_to?(:gsub) ?
278
- name.gsub(%r{\s},char_white_sub).gsub(%r{[/<>+]}, char_other_sub) :
255
+ def self.cname(name)
256
+ name.respond_to?(:gsub) ?
257
+ name.gsub(%r{[ /<>]}, '-') :
279
258
  ''
280
259
  end
281
260
 
@@ -389,11 +368,10 @@ module Gollum
389
368
  # Returns a Boolean.
390
369
  def page_match(name, filename)
391
370
  if match = self.class.valid_filename?(filename)
392
- @wiki.ws_subs.each do |sub|
393
- return true if Page.cname(name).downcase == Page.cname(match, sub).downcase
394
- end
371
+ Page.cname(name).downcase == Page.cname(match).downcase
372
+ else
373
+ false
395
374
  end
396
- false
397
375
  end
398
376
 
399
377
  # Loads a sub page. Sub page nanes (footers) are prefixed with
@@ -43,7 +43,7 @@ module Gollum
43
43
 
44
44
  # Default whitelisted protocols for URLs.
45
45
  PROTOCOLS = {
46
- 'a' => {'href' => ['http', 'https', 'mailto', 'ftp', 'irc', 'magnet' :relative]},
46
+ 'a' => {'href' => ['http', 'https', 'mailto', 'ftp', 'irc', 'magnet', :relative]},
47
47
  'img' => {'src' => ['http', 'https', :relative]}
48
48
  }.freeze
49
49
 
@@ -0,0 +1,89 @@
1
+ require 'fileutils'
2
+ require 'shellwords'
3
+ require 'tmpdir'
4
+ require 'posix/spawn'
5
+
6
+ module Gollum
7
+ module Tex
8
+ class Error < StandardError; end
9
+
10
+ extend POSIX::Spawn
11
+
12
+ Template = <<-EOS
13
+ \\documentclass[12pt]{article}
14
+ \\usepackage{color}
15
+ \\usepackage[dvips]{graphicx}
16
+ \\pagestyle{empty}
17
+ \\pagecolor{white}
18
+ \\begin{document}
19
+ {\\color{black}
20
+ \\begin{eqnarray*}
21
+ %s
22
+ \\end{eqnarray*}}
23
+ \\end{document}
24
+ EOS
25
+
26
+ class << self
27
+ attr_accessor :latex_path, :dvips_path, :convert_path
28
+ end
29
+
30
+ self.latex_path = 'latex'
31
+ self.dvips_path = 'dvips'
32
+ self.convert_path = 'convert'
33
+
34
+ def self.check_dependencies!
35
+ return if @dependencies_available
36
+
37
+ if `which latex` == ""
38
+ raise Error, "`latex` command not found"
39
+ end
40
+
41
+ if `which dvips` == ""
42
+ raise Error, "`dvips` command not found"
43
+ end
44
+
45
+ if `which convert` == ""
46
+ raise Error, "`convert` command not found"
47
+ end
48
+
49
+ if `which gs` == ""
50
+ raise Error, "`gs` command not found"
51
+ end
52
+
53
+ @dependencies_available = true
54
+ end
55
+
56
+ def self.render_formula(formula)
57
+ check_dependencies!
58
+
59
+ Dir.mktmpdir('tex') do |path|
60
+ tex_path = ::File.join(path, 'formula.tex')
61
+ dvi_path = ::File.join(path, 'formula.dvi')
62
+ eps_path = ::File.join(path, 'formula.eps')
63
+ png_path = ::File.join(path, 'formula.png')
64
+
65
+ ::File.open(tex_path, 'w') { |f| f.write(Template % formula) }
66
+
67
+ result = sh latex_path, '-interaction=batchmode', 'formula.tex', :chdir => path
68
+ raise Error, "`latex` command failed: #{result}" unless ::File.exist?(dvi_path)
69
+
70
+ result = sh dvips_path, '-o', eps_path, '-E', dvi_path
71
+ raise Error, "`dvips` command failed: #{result}" unless ::File.exist?(eps_path)
72
+ result = sh convert_path, '+adjoin',
73
+ '-antialias',
74
+ '-transparent', 'white',
75
+ '-density', '150x150',
76
+ eps_path, png_path
77
+ raise Error, "`convert` command failed: #{result}" unless ::File.exist?(png_path)
78
+
79
+ ::File.read(png_path)
80
+ end
81
+ end
82
+
83
+ private
84
+ def self.sh(*args)
85
+ pid = spawn *args
86
+ Process::waitpid(pid)
87
+ end
88
+ end
89
+ end
@@ -20,10 +20,7 @@ module Gollum
20
20
 
21
21
  # Sets the default email for commits.
22
22
  attr_accessor :default_committer_email
23
-
24
- # Array of chars to substitute whitespace for when trying to locate file in git repo.
25
- attr_accessor :default_ws_subs
26
-
23
+
27
24
  # Sets sanitization options. Set to false to deactivate
28
25
  # sanitization altogether.
29
26
  attr_writer :sanitization
@@ -105,8 +102,6 @@ module Gollum
105
102
  self.default_ref = 'master'
106
103
  self.default_committer_name = 'Anonymous'
107
104
  self.default_committer_email = 'anon@anon.com'
108
-
109
- self.default_ws_subs = ['_','-']
110
105
 
111
106
  # The String base path to prefix to internal links. For example, when set
112
107
  # to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
@@ -124,9 +119,6 @@ module Gollum
124
119
 
125
120
  # Gets the String directory in which all page files reside.
126
121
  attr_reader :page_file_dir
127
-
128
- # Gets the Array of chars to sub for ws in filenames.
129
- attr_reader :ws_subs
130
122
 
131
123
  # Public: Initialize a new Gollum Repo.
132
124
  #
@@ -142,7 +134,6 @@ module Gollum
142
134
  # :sanitization - An instance of Sanitization.
143
135
  # :page_file_dir - String the directory in which all page files reside
144
136
  # :ref - String the repository ref to retrieve pages from
145
- # :ws_subs - Array of chars to sub for ws in filenames.
146
137
  #
147
138
  # Returns a fresh Gollum::Repo.
148
139
  def initialize(path, options = {})
@@ -160,8 +151,6 @@ module Gollum
160
151
  @repo = @access.repo
161
152
  @ref = options[:ref] || self.class.default_ref
162
153
  @sanitization = options[:sanitization] || self.class.sanitization
163
- @ws_subs = options[:ws_subs] ||
164
- self.class.default_ws_subs
165
154
  @history_sanitization = options[:history_sanitization] ||
166
155
  self.class.history_sanitization
167
156
  end
@@ -239,14 +228,12 @@ module Gollum
239
228
  else
240
229
  Committer.new(self, commit)
241
230
  end
242
-
243
- filename = Gollum::Page.cname(name)
244
-
245
- committer.add_to_index('', filename, format, data)
231
+
232
+ committer.add_to_index('', name, format, data)
246
233
 
247
234
  committer.after_commit do |index, sha|
248
235
  @access.refresh
249
- index.update_working_dir('', filename, format)
236
+ index.update_working_dir('', name, format)
250
237
  end
251
238
 
252
239
  multi_commit ? committer : committer.commit
@@ -278,10 +265,7 @@ module Gollum
278
265
  name ||= page.name
279
266
  format ||= page.format
280
267
  dir = ::File.dirname(page.path)
281
- dir = '' if dir == '.'
282
- filename = (rename = page.name != name) ?
283
- Gollum::Page.cname(name) : page.filename_stripped
284
-
268
+ dir = '' if dir == '.'
285
269
  multi_commit = false
286
270
 
287
271
  committer = if obj = commit[:committer]
@@ -290,18 +274,18 @@ module Gollum
290
274
  else
291
275
  Committer.new(self, commit)
292
276
  end
293
-
294
- if !rename && page.format == format
277
+
278
+ if page.name == name && page.format == format
295
279
  committer.add(page.path, normalize(data))
296
280
  else
297
281
  committer.delete(page.path)
298
- committer.add_to_index(dir, filename, format, data, :allow_same_ext)
282
+ committer.add_to_index(dir, name, format, data, :allow_same_ext)
299
283
  end
300
-
284
+
301
285
  committer.after_commit do |index, sha|
302
286
  @access.refresh
303
- index.update_working_dir(dir, page.filename_stripped, page.format)
304
- index.update_working_dir(dir, filename, format)
287
+ index.update_working_dir(dir, page.name, page.format)
288
+ index.update_working_dir(dir, name, format)
305
289
  end
306
290
 
307
291
  multi_commit ? committer : committer.commit
@@ -340,7 +324,7 @@ module Gollum
340
324
  dir = '' if dir == '.'
341
325
 
342
326
  @access.refresh
343
- index.update_working_dir(dir, page.filename_stripped, page.format)
327
+ index.update_working_dir(dir, page.name, page.format)
344
328
  end
345
329
 
346
330
  multi_commit ? committer : committer.commit
@@ -378,7 +362,7 @@ module Gollum
378
362
 
379
363
  files = []
380
364
  if page
381
- files << [page.path, page.filename_stripped, page.format]
365
+ files << [page.path, page.name, page.format]
382
366
  else
383
367
  # Grit::Diff can't parse reverse diffs.... yet
384
368
  patch.each_line do |line|
@@ -538,12 +522,13 @@ module Gollum
538
522
 
539
523
  # Assemble a Page's filename from its name and format.
540
524
  #
541
- # name - The String name of the page (should be pre-canonicalized).
525
+ # name - The String name of the page (may be in human format).
542
526
  # format - The Symbol format of the page.
543
527
  #
544
528
  # Returns the String filename.
545
529
  def page_file_name(name, format)
546
- name + '.' + @page_class.format_to_ext(format)
530
+ ext = @page_class.format_to_ext(format)
531
+ @page_class.cname(name) + '.' + ext
547
532
  end
548
533
 
549
534
  # Fill an array with a list of pages.
@@ -1 +1 @@
1
- Test out whitespace with Sam
1
+ add sidebars
Binary file
@@ -1,3 +1,2 @@
1
1
  0000000000000000000000000000000000000000 60f12f4254f58801b9ee7db7bca5fa8aeefaa56b rick <technoweenie@gmail.com> 1291341857 -0800 clone: from /Users/rick/p/gollum/test/examples/lotr.git
2
2
  60f12f4254f58801b9ee7db7bca5fa8aeefaa56b a8ad3c09dd842a3517085bfadd37718856dee813 rick <technoweenie@gmail.com> 1291341922 -0800 commit: add sidebars
3
- a8ad3c09dd842a3517085bfadd37718856dee813 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 Arran Cudbard-Bell <a.cudbardb@freeradius.org> 1309107565 +0200 commit: Test out whitespace with Sam
@@ -1,3 +1,2 @@
1
1
  0000000000000000000000000000000000000000 60f12f4254f58801b9ee7db7bca5fa8aeefaa56b rick <technoweenie@gmail.com> 1291341857 -0800 clone: from /Users/rick/p/gollum/test/examples/lotr.git
2
2
  60f12f4254f58801b9ee7db7bca5fa8aeefaa56b a8ad3c09dd842a3517085bfadd37718856dee813 rick <technoweenie@gmail.com> 1291341922 -0800 commit: add sidebars
3
- a8ad3c09dd842a3517085bfadd37718856dee813 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3 Arran Cudbard-Bell <a.cudbardb@freeradius.org> 1309107565 +0200 commit: Test out whitespace with Sam
@@ -1 +1 @@
1
- 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3
1
+ a8ad3c09dd842a3517085bfadd37718856dee813
@@ -108,7 +108,21 @@ context "Frontend" do
108
108
  assert_equal "/#{name}", last_request.fullpath
109
109
  assert last_response.ok?
110
110
  end
111
-
111
+
112
+ test "creates pages with escaped characters in title" do
113
+ post "/create", :content => 'abc', :page => 'Title with spaces',
114
+ :format => 'markdown', :message => 'foo'
115
+ assert_equal 'http://example.org/Title-with-spaces', last_response.headers['Location']
116
+ get "/Title-with-spaces"
117
+ assert_match /abc/, last_response.body
118
+
119
+ post "/create", :content => 'ghi', :page => 'Title/with/slashes',
120
+ :format => 'markdown', :message => 'bar'
121
+ assert_equal 'http://example.org/Title-with-slashes', last_response.headers['Location']
122
+ get "/Title-with-slashes"
123
+ assert_match /ghi/, last_response.body
124
+ end
125
+
112
126
  test "guards against creation of existing page" do
113
127
  name = "A"
114
128
  post "/create", :content => 'abc', :page => name,
@@ -50,7 +50,7 @@ context "Wiki" do
50
50
  end
51
51
 
52
52
  test "parents with default master ref" do
53
- ref = '1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3'
53
+ ref = 'a8ad3c09dd842a3517085bfadd37718856dee813'
54
54
  committer = Gollum::Committer.new(@wiki)
55
55
  assert_equal ref, committer.parents.first.sha
56
56
  end
@@ -18,9 +18,9 @@ context "GitAccess" do
18
18
  assert @access.ref_map.empty?
19
19
  assert @access.tree_map.empty?
20
20
  @access.tree 'master'
21
- assert_equal({"master"=>"1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3"}, @access.ref_map)
21
+ assert_equal({"master"=>"a8ad3c09dd842a3517085bfadd37718856dee813"}, @access.ref_map)
22
22
 
23
- map = @access.tree_map['1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3']
23
+ map = @access.tree_map['a8ad3c09dd842a3517085bfadd37718856dee813']
24
24
  assert_equal 'Bilbo-Baggins.md', map[0].path
25
25
  assert_equal '', map[0].dir
26
26
  assert_equal map[0].path, map[0].name
@@ -25,27 +25,7 @@ context "Page" do
25
25
  test "get existing page case insensitive" do
26
26
  assert_equal @wiki.page('Bilbo Baggins').path, @wiki.page('bilbo baggins').path
27
27
  end
28
-
29
- test "get existing page with hyphen" do
30
- assert_equal @wiki.page('Bilbo Baggins').path, @wiki.page('Bilbo-Baggins').path
31
- end
32
28
 
33
- test "get existing page with underscore" do
34
- assert_nil @wiki.page('Bilbo_Baggins')
35
- end
36
-
37
- test "get existing page where filename contains whitespace, with hypen" do
38
- assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise-Gamgee').path
39
- end
40
-
41
- test "get existing page where filename contains whitespace, with underscore" do
42
- assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise_Gamgee').path
43
- end
44
-
45
- test "get existing page where filename contains whitespace, with whitespace" do
46
- assert_equal @wiki.page('Samwise Gamgee').path, @wiki.page('Samwise Gamgee').path
47
- end
48
-
49
29
  test "get nested page" do
50
30
  page = @wiki.page('Eye Of Sauron')
51
31
  assert_equal 'Mordor/Eye-Of-Sauron.md', page.path
@@ -54,12 +54,12 @@ context "Wiki" do
54
54
  test "list pages" do
55
55
  pages = @wiki.pages
56
56
  assert_equal \
57
- ['Bilbo-Baggins.md', 'Eye-Of-Sauron.md', 'Home.textile', 'My-Precious.md', 'Samwise Gamgee.mediawiki'],
57
+ %w(Bilbo-Baggins.md Eye-Of-Sauron.md Home.textile My-Precious.md),
58
58
  pages.map { |p| p.filename }.sort
59
59
  end
60
60
 
61
61
  test "counts pages" do
62
- assert_equal 5, @wiki.size
62
+ assert_equal 4, @wiki.size
63
63
  end
64
64
 
65
65
  test "text_data" do
@@ -232,64 +232,6 @@ context "Wiki page writing" do
232
232
  end
233
233
  end
234
234
 
235
- context "Wiki page writing with whitespace (filename contains whitespace)" do
236
- setup do
237
- @path = cloned_testpath("examples/lotr.git")
238
- @wiki = Gollum::Wiki.new(@path)
239
- end
240
-
241
- test "update_page" do
242
- assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
243
- assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
244
-
245
- page = @wiki.page("Samwise Gamgee")
246
- @wiki.update_page(page, page.name, :textile, "h1. Samwise Gamgee2", commit_details)
247
-
248
- assert_equal :textile, @wiki.page("Samwise Gamgee").format
249
- assert_equal "h1. Samwise Gamgee2", @wiki.page("Samwise Gamgee").raw_data
250
- assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
251
- end
252
-
253
- test "update page with format change, verify non-canonicalization of filename, where filename contains Whitespace" do
254
- assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
255
- assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
256
-
257
- page = @wiki.page("Samwise Gamgee")
258
- @wiki.update_page(page, page.name, :textile, "h1. Samwise Gamgee", commit_details)
259
-
260
- assert_equal :textile, @wiki.page("Samwise Gamgee").format
261
- assert_equal "h1. Samwise Gamgee", @wiki.page("Samwise Gamgee").raw_data
262
- assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
263
- end
264
-
265
- test "update page with name change, verify canonicalization of filename, where filename contains Whitespace" do
266
- assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
267
- assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
268
-
269
- page = @wiki.page("Samwise Gamgee")
270
- @wiki.update_page(page, 'Sam Gamgee', :textile, "h1. Samwise Gamgee", commit_details)
271
-
272
- assert_equal "h1. Samwise Gamgee", @wiki.page("Sam Gamgee").raw_data
273
- assert_equal "Sam-Gamgee.textile", @wiki.page("Sam Gamgee").filename
274
- end
275
-
276
- test "update page with name and format change, verify canonicalization of filename, where filename contains Whitespace" do
277
- assert_equal :mediawiki, @wiki.page("Samwise Gamgee").format
278
- assert_equal "Samwise Gamgee.mediawiki", @wiki.page("Samwise Gamgee").filename
279
-
280
- page = @wiki.page("Samwise Gamgee")
281
- @wiki.update_page(page, 'Sam Gamgee', :textile, "h1. Samwise Gamgee", commit_details)
282
-
283
- assert_equal :textile, @wiki.page("Sam Gamgee").format
284
- assert_equal "h1. Samwise Gamgee", @wiki.page("Sam Gamgee").raw_data
285
- assert_equal "Sam-Gamgee.textile", @wiki.page("Sam Gamgee").filename
286
- end
287
-
288
- teardown do
289
- FileUtils.rm_rf(@path)
290
- end
291
- end
292
-
293
235
  context "Wiki sync with working directory" do
294
236
  setup do
295
237
  @path = testpath('examples/wdtest')
@@ -345,49 +287,6 @@ context "Wiki sync with working directory" do
345
287
  end
346
288
  end
347
289
 
348
- context "Wiki sync with working directory (filename contains whitespace)" do
349
- setup do
350
- @path = cloned_testpath("examples/lotr.git")
351
- @wiki = Gollum::Wiki.new(@path)
352
- end
353
- test "update a page with same name and format" do
354
- page = @wiki.page("Samwise Gamgee")
355
- @wiki.update_page(page, page.name, page.format, "What we need is a few good taters.", commit_details)
356
- assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Samwise Gamgee.mediawiki"))
357
- end
358
-
359
- test "update a page with different name and same format" do
360
- page = @wiki.page("Samwise Gamgee")
361
- @wiki.update_page(page, "Sam Gamgee", page.format, "What we need is a few good taters.", commit_details)
362
- assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Sam-Gamgee.mediawiki"))
363
- assert !File.exist?(File.join(@path, "Samwise Gamgee"))
364
- end
365
-
366
- test "update a page with same name and different format" do
367
- page = @wiki.page("Samwise Gamgee")
368
- @wiki.update_page(page, page.name, :textile, "What we need is a few good taters.", commit_details)
369
- assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Samwise Gamgee.textile"))
370
- assert !File.exist?(File.join(@path, "Samwise Gamgee.mediawiki"))
371
- end
372
-
373
- test "update a page with different name and different format" do
374
- page = @wiki.page("Samwise Gamgee")
375
- @wiki.update_page(page, "Sam Gamgee", :textile, "What we need is a few good taters.", commit_details)
376
- assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Sam-Gamgee.textile"))
377
- assert !File.exist?(File.join(@path, "Samwise Gamgee.mediawiki"))
378
- end
379
-
380
- test "delete a page" do
381
- page = @wiki.page("Samwise Gamgee")
382
- @wiki.delete_page(page, commit_details)
383
- assert !File.exist?(File.join(@path, "Samwise Gamgee.mediawiki"))
384
- end
385
-
386
- teardown do
387
- FileUtils.rm_r(@path)
388
- end
389
- end
390
-
391
290
  context "page_file_dir option" do
392
291
  setup do
393
292
  @path = cloned_testpath('examples/page_file_dir')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-bibanon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 0
10
- version: 1.4.0
9
+ - 1
10
+ version: 1.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Preston-Werner
@@ -279,7 +279,7 @@ dependencies:
279
279
  version: 0.9.2
280
280
  type: :development
281
281
  version_requirements: *id016
282
- description: A simple, Git-powered wiki with a sweet API and local frontend, modded for the Bibliotheca Anonoma. Uses the latest edition of Gollum, adds OmniGollum support, underscores in page names, and other cool stuff.
282
+ description: A simple, Git-powered wiki with a sweet API and local frontend, modded for the Bibliotheca Anonoma. Uses the latest edition of Gollum, adds OmniGollum support, and other cool stuff.
283
283
  email: cockmomgler@gmail.com
284
284
  executables:
285
285
  - gollum
@@ -348,6 +348,7 @@ files:
348
348
  - lib/gollum/page.rb
349
349
  - lib/gollum/pagination.rb
350
350
  - lib/gollum/sanitization.rb
351
+ - lib/gollum/tex.rb
351
352
  - lib/gollum/wiki.rb
352
353
  - templates/formatting.html
353
354
  - test/examples/lotr.git/COMMIT_EDITMSG