gollum 2.3.2 → 2.3.3

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/bin/gollum CHANGED
@@ -72,6 +72,10 @@ opts = OptionParser.new do |opts|
72
72
  opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
73
73
  wiki_options[:show_all] = true
74
74
  end
75
+
76
+ opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
77
+ wiki_options[:collapse_tree] = true
78
+ end
75
79
  end
76
80
 
77
81
  # 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.2'
9
- s.date = '2012-10-22'
8
+ s.version = '2.3.3'
9
+ s.date = '2012-10-23'
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.2'
25
+ VERSION = '2.3.3'
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
@@ -17,12 +17,8 @@ module Gollum
17
17
  #
18
18
  # Returns the String url_path
19
19
  def url_path
20
- path = if self.path.include?('/')
21
- self.path.sub(/\/[^\/]+$/, '/')
22
- else
23
- ''
24
- end
25
-
20
+ path = self.path
21
+ path = path.sub(/\/[^\/]+$/, '/') if path.include?('/')
26
22
  path
27
23
  end
28
24
 
@@ -8,9 +8,10 @@ module Gollum
8
8
  # common use cases:
9
9
  # set pages to wiki.pages and show_all to false
10
10
  # set pages to wiki.pages + wiki.files and show_all to true
11
- def initialize pages, show_all = false
11
+ def initialize pages, options = {}
12
12
  @pages = pages
13
- @show_all = show_all
13
+ @show_all = options[:show_all] || false
14
+ @checked = options[:collapse_tree] ? '' : "checked"
14
15
  end
15
16
 
16
17
  def enclose_tree string
@@ -30,7 +31,7 @@ module Gollum
30
31
  def new_sub_folder path
31
32
  <<-HTML
32
33
  <li>
33
- <label>#{path}</label> <input type="checkbox" checked />
34
+ <label>#{path}</label> <input type="checkbox" #{@checked} />
34
35
  <ol>
35
36
  HTML
36
37
  end
@@ -87,7 +88,7 @@ module Gollum
87
88
  url = url_for_page page
88
89
  html += <<-HTML
89
90
  <li>
90
- <label>#{::File.dirname(page.path)}</label> <input type="checkbox" checked />
91
+ <label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
91
92
  <ol>
92
93
  <li class="file"><a href="#{url}">#{name}</a></li>
93
94
  </ol>
@@ -332,8 +332,10 @@ module Precious
332
332
  wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
333
333
  show_all = settings.wiki_options[:show_all]
334
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
335
+ # must pass wiki_options for both because
336
+ # --show-all and --collapse-tree can be set.
337
+ @results = show_all ? Gollum::FileView.new(wiki.pages + wiki.files, settings.wiki_options).render_files :
338
+ Gollum::FileView.new(wiki.pages, settings.wiki_options).render_files
337
339
  @ref = wiki.ref
338
340
  mustache :file_view, { :layout => false }
339
341
  end
data/lib/gollum/markup.rb CHANGED
@@ -543,7 +543,9 @@ module Gollum
543
543
  blocks.each do |lang, code|
544
544
  encoding ||= 'utf-8'
545
545
  begin
546
- hl_code = Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s})
546
+ # must set startinline to true for php to be highlighted without <?
547
+ # http://pygments.org/docs/lexers/
548
+ hl_code = Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s, :startinline => true})
547
549
  rescue
548
550
  hl_code = code
549
551
  end
data/lib/gollum/wiki.rb CHANGED
@@ -154,6 +154,9 @@ module Gollum
154
154
  # :ref - String the repository ref to retrieve pages from
155
155
  # :ws_subs - Array of chars to sub for ws in filenames.
156
156
  # :mathjax - Set to false to disable mathjax.
157
+ # :show_all - Show all files in file view, not just valid pages.
158
+ # Default: false
159
+ # :collapse_tree - Start with collapsed file view. Default: false
157
160
  #
158
161
  # Returns a fresh Gollum::Repo.
159
162
  def initialize(path, options = {})
@@ -181,6 +184,7 @@ module Gollum
181
184
  @universal_toc = options.fetch(:universal_toc, false)
182
185
  @mathjax = options[:mathjax] || false
183
186
  @show_all = options[:show_all] || false
187
+ @collapse_tree = options[:collapse_tree] || false
184
188
  end
185
189
 
186
190
  # Public: check whether the wiki's git repo exists on the filesystem.
@@ -593,6 +597,9 @@ module Gollum
593
597
  # When false, only valid pages in the git repo are displayed.
594
598
  attr_reader :show_all
595
599
 
600
+ # Start with collapsed file view. Default: false
601
+ attr_reader :collapse_tree
602
+
596
603
  # Normalize the data.
597
604
  #
598
605
  # 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.2
4
+ version: 2.3.3
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-22 00:00:00.000000000 Z
13
+ date: 2012-10-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: grit