gollum 2.3.1 → 2.3.2

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/README.md CHANGED
@@ -363,7 +363,17 @@ appropriately.
363
363
 
364
364
  ## MATHEMATICAL EQUATIONS
365
365
 
366
- Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the autoload-all extension.
366
+ Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.
367
+
368
+ Inline math:
369
+
370
+ - $2^2$
371
+ - `\\(2^2\\)`
372
+
373
+ Display math:
374
+
375
+ - $$2^2$$
376
+ - [2^2]
367
377
 
368
378
  ## SEQUENCE DIAGRAMS
369
379
 
data/Rakefile CHANGED
@@ -113,8 +113,8 @@ task :release => :build do
113
113
  puts "You must be on the master branch to release!"
114
114
  exit!
115
115
  end
116
- sh "git pull"
117
116
  sh "git commit --allow-empty -a -m 'Release #{version}'"
117
+ sh "git pull"
118
118
  sh "git tag v#{version}"
119
119
  sh "git push origin master"
120
120
  sh "git push origin v#{version}"
data/bin/gollum CHANGED
@@ -68,6 +68,10 @@ opts = OptionParser.new do |opts|
68
68
  opts.on("--mathjax", "Enables mathjax.") do
69
69
  wiki_options[:mathjax] = true
70
70
  end
71
+
72
+ opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
73
+ wiki_options[:show_all] = true
74
+ end
71
75
  end
72
76
 
73
77
  # Read command line options into `options` hash
data/gollum.gemspec CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.required_ruby_version = ">= 1.8.7"
6
6
 
7
7
  s.name = 'gollum'
8
- s.version = '2.3.1'
9
- s.date = '2012-10-21'
8
+ s.version = '2.3.2'
9
+ s.date = '2012-10-22'
10
10
  s.rubyforge_project = 'gollum'
11
11
 
12
12
  s.summary = "A simple, Git-powered wiki."
data/lib/gollum.rb CHANGED
@@ -22,7 +22,7 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
22
22
  require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
23
23
 
24
24
  module Gollum
25
- VERSION = '2.3.1'
25
+ VERSION = '2.3.2'
26
26
 
27
27
  def self.assets_path
28
28
  ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
data/lib/gollum/file.rb CHANGED
@@ -13,6 +13,26 @@ module Gollum
13
13
  @path = nil
14
14
  end
15
15
 
16
+ # Public: The url path required to reach this page within the repo.
17
+ #
18
+ # Returns the String url_path
19
+ def url_path
20
+ path = if self.path.include?('/')
21
+ self.path.sub(/\/[^\/]+$/, '/')
22
+ else
23
+ ''
24
+ end
25
+
26
+ path
27
+ end
28
+
29
+ # Public: The url_path, but CGI escaped.
30
+ #
31
+ # Returns the String url_path
32
+ def escaped_url_path
33
+ CGI.escape(self.url_path).gsub('%2F','/')
34
+ end
35
+
16
36
  # Public: The on-disk filename of the file.
17
37
  #
18
38
  # Returns the String name.
@@ -5,8 +5,12 @@ module Gollum
5
5
  - Then all the folders are sorted and processed
6
6
  =end
7
7
  class FileView
8
- def initialize pages
8
+ # common use cases:
9
+ # set pages to wiki.pages and show_all to false
10
+ # set pages to wiki.pages + wiki.files and show_all to true
11
+ def initialize pages, show_all = false
9
12
  @pages = pages
13
+ @show_all = show_all
10
14
  end
11
15
 
12
16
  def enclose_tree string
@@ -39,7 +43,16 @@ module Gollum
39
43
  end
40
44
 
41
45
  def url_for_page page
42
- url = ::File.join(::File.dirname(page.path), page.filename_stripped)
46
+ url = ''
47
+ if @show_all
48
+ # Remove ext for valid pages.
49
+ filename = page.filename
50
+ filename = Page::valid_page_name?(filename) ? filename.chomp(::File.extname(filename)) : filename
51
+
52
+ url = ::File.join(::File.dirname(page.path), filename)
53
+ else
54
+ url = ::File.join(::File.dirname(page.path), page.filename_stripped)
55
+ end
43
56
  url = url[2..-1] if url[0,2] == './'
44
57
  url
45
58
  end
@@ -323,13 +323,17 @@ module Precious
323
323
  wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
324
324
  wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
325
325
  @results = wiki.pages
326
+ @results += wiki.files if settings.wiki_options[:show_all]
326
327
  @ref = wiki.ref
327
328
  mustache :pages
328
329
  end
329
330
 
330
331
  get '/fileview' do
331
332
  wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
332
- @results = Gollum::FileView.new(wiki.pages).render_files
333
+ show_all = settings.wiki_options[:show_all]
334
+ # if showing all files include wiki.files
335
+ @results = show_all ? Gollum::FileView.new(wiki.pages + wiki.files, show_all).render_files :
336
+ Gollum::FileView.new(wiki.pages).render_files
333
337
  @ref = wiki.ref
334
338
  mustache :file_view, { :layout => false }
335
339
  end
data/lib/gollum/wiki.rb CHANGED
@@ -180,6 +180,7 @@ module Gollum
180
180
  @live_preview = options.fetch(:live_preview, true)
181
181
  @universal_toc = options.fetch(:universal_toc, false)
182
182
  @mathjax = options[:mathjax] || false
183
+ @show_all = options[:show_all] || false
183
184
  end
184
185
 
185
186
  # Public: check whether the wiki's git repo exists on the filesystem.
@@ -588,6 +589,10 @@ module Gollum
588
589
  # Toggles mathjax.
589
590
  attr_reader :mathjax
590
591
 
592
+ # Toggles showing all files in files view. Default is false.
593
+ # When false, only valid pages in the git repo are displayed.
594
+ attr_reader :show_all
595
+
591
596
  # Normalize the data.
592
597
  #
593
598
  # data - The String data to be normalized.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-21 00:00:00.000000000 Z
13
+ date: 2012-10-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: grit