gollum 5.0.1 → 5.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.

Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +6 -0
  3. data/Rakefile +2 -5
  4. data/gollum.gemspec +9 -7
  5. data/lib/gollum.rb +1 -1
  6. data/lib/gollum/app.rb +51 -21
  7. data/lib/gollum/assets.rb +3 -3
  8. data/lib/gollum/helpers.rb +1 -1
  9. data/lib/gollum/public/assets/{.sprockets-manifest-3edc7e21737459b21fbf150f5dccd15c.json → .sprockets-manifest-459226ba5fc211b78ba9a3aa6ebde96c.json} +1 -1
  10. data/lib/gollum/public/assets/{app-982c7fca1832732a24e92474ca2729aeb56f2d0c05bb7a8ff913e9f58a6500d5.js → app-6e925e38a12a40c4fa9e0400cc874e0f4f97b66fdeb90a144dea527dbb544fbd.js} +2 -2
  11. data/lib/gollum/public/assets/app-6e925e38a12a40c4fa9e0400cc874e0f4f97b66fdeb90a144dea527dbb544fbd.js.gz +0 -0
  12. data/lib/gollum/public/assets/{editor-0dbae28c53db5a73d666d30504946671eb09948ffdaf1fdd9d1c8d856d4c0ba1.js → editor-b2c10f22ef6ca1e120956a2d11ff4ca19ac44d7e7240f5cc43ec949184d8b708.js} +7 -7
  13. data/lib/gollum/public/assets/{editor-0dbae28c53db5a73d666d30504946671eb09948ffdaf1fdd9d1c8d856d4c0ba1.js.gz → editor-b2c10f22ef6ca1e120956a2d11ff4ca19ac44d7e7240f5cc43ec949184d8b708.js.gz} +0 -0
  14. data/lib/gollum/public/gollum/javascript/editor/gollum.editor.js +59 -0
  15. data/lib/gollum/public/gollum/javascript/editor/modes.js.erb +1 -1
  16. data/lib/gollum/public/gollum/javascript/gollum.js.erb +6 -5
  17. data/lib/gollum/templates/commit.mustache +26 -0
  18. data/lib/gollum/templates/editor.mustache +5 -0
  19. data/lib/gollum/templates/history.mustache +5 -2
  20. data/lib/gollum/templates/latest_changes.mustache +7 -5
  21. data/lib/gollum/templates/layout.mustache +4 -4
  22. data/lib/gollum/templates/navbar.mustache +4 -4
  23. data/lib/gollum/templates/overview.mustache +2 -2
  24. data/lib/gollum/templates/search.mustache +2 -3
  25. data/lib/gollum/templates/wiki_content.mustache +1 -1
  26. data/lib/gollum/views/commit.rb +38 -0
  27. data/lib/gollum/views/compare.rb +3 -3
  28. data/lib/gollum/views/has_page.rb +0 -4
  29. data/lib/gollum/views/helpers.rb +10 -3
  30. data/lib/gollum/views/history.rb +4 -1
  31. data/lib/gollum/views/latest_changes.rb +1 -0
  32. data/lib/gollum/views/layout.rb +17 -1
  33. data/lib/gollum/views/overview.rb +1 -1
  34. data/lib/gollum/views/page.rb +4 -0
  35. data/lib/gollum/views/search.rb +2 -1
  36. metadata +9 -7
  37. data/lib/gollum/public/assets/app-982c7fca1832732a24e92474ca2729aeb56f2d0c05bb7a8ff913e9f58a6500d5.js.gz +0 -0
@@ -7,7 +7,7 @@
7
7
 
8
8
  {{>pagination}}
9
9
 
10
- <form name="selection-form" id="selection-form" method="post" action="{{compare_path}}/{{escaped_url_path}}"></form>
10
+ <form name="selection-form" id="selection-form" method="get" action="{{compare_path}}/{{escaped_url_path}}"></form>
11
11
 
12
12
  <div id="page-history-list" class="Box Box--condensed flex-auto">
13
13
  <form id="version-form">
@@ -18,7 +18,10 @@
18
18
  <span class="float-left col-2" id="user-icons">{{>author_template}}</span>
19
19
  <span class="flex-auto col-1 text-gray-light">{{date}}</span>
20
20
  <span class="flex-auto col-5">{{message}}</span>
21
- <span class="pl-4 float-right">[<a href="{{base_url}}/{{filename}}/{{id}}" title="View commit">{{id7}}</a>]</span>
21
+ <span class="pl-4 float-right">
22
+ <a href="{{href}}" class="btn btn-outline text-mono">{{id7}}</a>
23
+ <a href="{{href_page}}" title="Browse the page at this point in the history" class="btn btn-outline">{{#octicon}}code{{/octicon}}</a>
24
+ </span>
22
25
  </li>
23
26
  {{/versions}}
24
27
  </ul>
@@ -8,9 +8,9 @@
8
8
 
9
9
  <div id="wiki-history">
10
10
 
11
- <div class="Box flex-auto">
11
+ <ul class="Box flex-auto">
12
12
  {{#versions}}
13
- <div class="Box-row Box-row--hover-gray border-top d-flex flex-items-center">
13
+ <li class="Box-row Box-row--hover-gray border-top d-flex flex-items-center">
14
14
  <span class="float-left col-2" id="user-icons">{{>author_template}}</span>
15
15
  <span class="flex-auto col-1 text-gray-light">{{date}}</span>
16
16
  <span class="flex-auto col-7">{{message}}<br/>
@@ -18,10 +18,12 @@
18
18
  <span class="flex-auto col-2">{{#renamed}}{{renamed}} -> {{/renamed}}<a href="{{link}}">{{file}}</a></span><br/>
19
19
  {{/files}}
20
20
  </span>
21
- <span class="pl-4 float-right">[{{id7}}]</span>
22
- </div>
21
+ <span class="pl-4 float-right">
22
+ <a href="{{href}}" class="btn btn-outline text-mono">{{id7}}</a>
23
+ </span>
24
+ </li>
23
25
  {{/versions}}
24
- </div>
26
+ </ul>
25
27
 
26
28
 
27
29
  </div>
@@ -8,7 +8,7 @@
8
8
  {{#sprockets_stylesheet_tag}}app{{/sprockets_stylesheet_tag}}
9
9
  {{#sprockets_stylesheet_tag}}print print{{/sprockets_stylesheet_tag}}
10
10
 
11
- {{#css}}<link rel="stylesheet" type="text/css" href="{{custom_path}}/custom.css" media="all">{{/css}}
11
+ {{#css}}<link rel="stylesheet" type="text/css" href="{{custom_css}}" media="all">{{/css}}
12
12
  {{#noindex}}<meta name="robots" content="noindex, nofollow" />{{/noindex}}
13
13
 
14
14
 
@@ -49,11 +49,11 @@
49
49
  };
50
50
  </script>
51
51
  {{#mathjax_config}}
52
- <script type="text/javascript" src="{{base_url}}/{{mathjax_config}}"></script>
52
+ <script type="text/javascript" src="{{mathjax_config_path}}"></script>
53
53
  {{/mathjax_config}}
54
- <script defer src="{{base_url}}/gollum/assets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
54
+ <script defer src="{{mathjax_js}}"></script>
55
55
  {{/mathjax}}
56
- {{#js}}<script type="text/javascript" src="{{custom_path}}/custom.js"></script>{{/js}}
56
+ {{#js}}<script type="text/javascript" src="{{custom_js}}"></script>{{/js}}
57
57
 
58
58
  <title>{{title}}</title>
59
59
  </head>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div class="TableObject">
4
4
  <div class="TableObject-item">
5
- <a class="btn" href="{{base_url}}/">Home</a>
5
+ <a class="btn" id="minibutton-home" href="{{page_route}}">Home</a>
6
6
  </div>
7
7
 
8
8
 
@@ -11,13 +11,13 @@
11
11
  </div>
12
12
 
13
13
  <div class="TableObject-item">
14
- {{#overview}}<a class="btn" href="{{overview_path}}">Overview</a>{{/overview}}
15
- {{#latest_changes}}<a class="btn" href="{{latest_changes_path}}">Latest Changes</a>{{/latest_changes}}
14
+ {{#overview}}<a class="btn" id="minibutton-overview" href="{{overview_path}}">Overview</a>{{/overview}}
15
+ {{#latest_changes}}<a class="btn" id="minibutton-latest-changes" href="{{latest_changes_path}}">Latest Changes</a>{{/latest_changes}}
16
16
  </div>
17
17
 
18
18
  {{#history}}
19
19
  <div class="TableObject-item pl-1">
20
- <a class="btn" href="{{history_path}}/{{escaped_url_path}}">Page History</a>
20
+ <a class="btn" id="minibutton-history" href="{{history_path}}/{{escaped_url_path}}">Page History</a>
21
21
  </div>
22
22
  {{/history}}
23
23
 
@@ -16,9 +16,9 @@
16
16
  {{#files_folders}}
17
17
  <li class="Box-row">
18
18
  <span class="pr-2">{{{icon}}}</span>
19
- <span><a href={{url}}>{{name}}</a></span>
19
+ <span><a href="{{url}}">{{name}}</a></span>
20
20
  {{#allow_editing}}
21
- {{#is_file}}<button class="btn btn-sm float-right delete-file" data-file-path={{name}} data-confirm="Are you sure you want to delete {{name}}?">{{#octicon}}trashcan{{/octicon}}</button>{{/is_file}}
21
+ {{#is_file}}<button class="btn btn-sm float-right delete-file" data-file-path="{{url}}" data-confirm="Are you sure you want to delete {{name}}?">{{#octicon}}trashcan{{/octicon}}</button>{{/is_file}}
22
22
  {{/allow_editing}}
23
23
  </li>
24
24
  {{/files_folders}}
@@ -13,9 +13,8 @@
13
13
  <div class="Box-header border-bottom p-0"></div>
14
14
  {{#results}}
15
15
  <li class="Box-row Box-row--gray">
16
- <span class="Counter Counter--gray tooltipped tooltipped-w" aria-label="{{filename_count}} hits in filename - {{count}} hits in content">{{filename_count}} - {{count}}</span>&nbsp;
17
-
18
- <span class="text-bold"><a href="{{base_url}}/{{name}}">{{name}}</a></span>
16
+ <span class="Counter Counter--gray tooltipped tooltipped-w" aria-label="{{filename_count}} hits in filename - {{count}} hits in content">{{filename_count}} - {{count}}</span>&nbsp;
17
+ <span class="text-bold"><a href="{{href}}">{{name}}</a></span>
19
18
  <button class="btn-link tooltipped tooltipped-w float-right toggle-context" aria-label="Show all {{count}} hits in this page">{{#octicon}}search{{/octicon}}</button>
20
19
  </li>
21
20
 
@@ -36,7 +36,7 @@
36
36
  </div>
37
37
  </div>
38
38
  {{/has_footer}}
39
- </div>
39
+
40
40
 
41
41
  </div>
42
42
 
@@ -0,0 +1,38 @@
1
+ require_relative 'compare.rb'
2
+
3
+ module Precious
4
+ module Views
5
+ class Commit < Compare
6
+
7
+ attr_reader :version
8
+
9
+ def title
10
+ "Changes in #{@version[0..6]}: #{message}"
11
+ end
12
+
13
+ def author
14
+ @commit.author.name
15
+ end
16
+
17
+ def authored_date
18
+ @commit.authored_date
19
+ end
20
+
21
+ def message
22
+ @commit.message
23
+ end
24
+
25
+ def files
26
+ files = @diff.split(%r{^diff --git a/.+ b/.+$}).reject(&:empty?)
27
+ files.map do |diff|
28
+ matched = diff.match(%r{(?<=^--- a/).+$})
29
+ matched = diff.match(%r{(?<=^\+\+\+ b/).+$}) if matched.nil?
30
+ {
31
+ path: matched[0],
32
+ lines: lines(diff)
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -17,9 +17,9 @@ module Precious
17
17
  @versions[1][0..6]
18
18
  end
19
19
 
20
- def lines
20
+ def lines(diff = @diff)
21
21
  lines = []
22
- lines_to_parse = @diff.split("\n")[4..-1]
22
+ lines_to_parse = diff.split("\n")[4..-1]
23
23
  # If the diff is of a rename, the diff header will be one line longer than normal because it will contain a line starting with '+++' to indicate the 'new' filename.
24
24
  # Make sure to skip that header line if it is present.
25
25
  lines_to_parse = lines_to_parse[1..-1] if lines_to_parse[0].start_with?('+++')
@@ -28,7 +28,7 @@ module Precious
28
28
  :class => line_class(line),
29
29
  :ldln => left_diff_line_number(line),
30
30
  :rdln => right_diff_line_number(line) }
31
- end if @diff
31
+ end if diff
32
32
  lines
33
33
  end
34
34
 
@@ -15,9 +15,5 @@ module Precious
15
15
  def id
16
16
  @page.sha
17
17
  end
18
-
19
- def full_url_path
20
- ::File.join(@base_url, escaped_url_path)
21
- end
22
18
  end
23
19
  end
@@ -39,7 +39,7 @@ module Precious
39
39
  route_path = "#{prefix}/#{path}"
40
40
  @@route_methods[name.to_s] = route_path
41
41
  define_method :"#{name.to_s}_path" do
42
- "#{base_url}/#{route_path}".gsub(/\/{2,}/, '/') # remove double slashes
42
+ page_route(route_path)
43
43
  end
44
44
  end
45
45
  end
@@ -53,8 +53,15 @@ module Precious
53
53
  end
54
54
  end
55
55
 
56
- def page_route(page)
57
- "#{base_url}/#{page}".gsub(/\/{2,}/, '/') # remove double slashes
56
+ def page_route(page = nil)
57
+ clean_url("/#{@base_url}", page)
58
+ end
59
+
60
+ def clean_url(*url)
61
+ url.compact!
62
+ return nil if url.empty?
63
+
64
+ ::File.join(*url).gsub(%r{/{2,}}, '/')
58
65
  end
59
66
  end
60
67
 
@@ -17,15 +17,18 @@ module Precious
17
17
  i = @versions.size + 1
18
18
  @versions.map do |v|
19
19
  i -= 1
20
+ filename = path_for_version(v.tracked_pathname)
20
21
  { :id => v.id,
21
22
  :id7 => v.id[0..6],
23
+ :href => page_route("gollum/commit/#{v.id}"),
24
+ :href_page => page_route("#{filename}/#{v.id}"),
22
25
  :num => i,
23
26
  :selected => @page.version.id == v.id,
24
27
  :author => v.author.name.respond_to?(:force_encoding) ? v.author.name.force_encoding('UTF-8') : v.author.name,
25
28
  :message => v.message.respond_to?(:force_encoding) ? v.message.force_encoding('UTF-8') : v.message,
26
29
  :date => v.authored_date.strftime("%B %d, %Y"),
27
30
  :user_icon => self.user_icon_code(v.author.email),
28
- :filename => path_for_version(v.tracked_pathname),
31
+ :filename => filename,
29
32
  :date_full => v.authored_date,
30
33
  }
31
34
  end
@@ -16,6 +16,7 @@ module Precious
16
16
  i -= 1
17
17
  { :id => v.id,
18
18
  :id7 => v.id[0..6],
19
+ :href => page_route("gollum/commit/#{v.id}"),
19
20
  :num => i,
20
21
  :author => v.author.name.respond_to?(:force_encoding) ? v.author.name.force_encoding('UTF-8') : v.author.name,
21
22
  :message => v.message.respond_to?(:force_encoding) ? v.message.force_encoding('UTF-8') : v.message,
@@ -31,7 +31,23 @@ module Precious
31
31
  end
32
32
 
33
33
  def custom_path
34
- "#{@base_url}"
34
+ @base_url
35
+ end
36
+
37
+ def custom_css
38
+ clean_url(custom_path, "custom.css")
39
+ end
40
+
41
+ def custom_js
42
+ clean_url(custom_path, "custom.js")
43
+ end
44
+
45
+ def mathjax_config_path
46
+ page_route(@mathjax_config)
47
+ end
48
+
49
+ def mathjax_js
50
+ page_route("gollum/assets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML")
35
51
  end
36
52
 
37
53
  def css # custom css
@@ -52,7 +52,7 @@ module Precious
52
52
  folder_url = "#{overview_path}/#{folder_path}/"
53
53
  files_and_folders << {name: folder_name, icon: rocticon('file-directory'), type: 'dir', url: folder_url, is_file: false}
54
54
  elsif result_path != '.gitkeep'
55
- file_url = "#{@base_url}/#{result.escaped_url_path}"
55
+ file_url = page_route(result.escaped_url_path)
56
56
  files_and_folders << {name: result.filename, icon: rocticon('file'), type: 'file', url: file_url, is_file: true}
57
57
  end
58
58
  end
@@ -169,6 +169,10 @@ module Precious
169
169
  @navbar
170
170
  end
171
171
 
172
+ def full_url_path
173
+ page_route(@page.escaped_url_path)
174
+ end
175
+
172
176
  # Access to embedded metadata.
173
177
  #
174
178
  # Returns Hash.
@@ -5,7 +5,7 @@ module Precious
5
5
  include Pagination
6
6
 
7
7
  def results
8
- @results.sort do |a, b|
8
+ sorted = @results.sort do |a, b|
9
9
  if b.nil?
10
10
  b_filename_count = 0
11
11
  b_count = 0
@@ -15,6 +15,7 @@ module Precious
15
15
  end
16
16
  [a[:filename_count], a[:count]] <=> [b_filename_count, b_count]
17
17
  end.reverse.slice((@page_num - 1) * @max_count, @max_count)
18
+ sorted.each {|x| x[:href] = page_route(x[:name])}
18
19
  end
19
20
 
20
21
  def query_string
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: 5.0.1
4
+ version: '5.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-04-04 00:00:00.000000000 Z
12
+ date: 2020-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gollum-lib
@@ -354,15 +354,15 @@ files:
354
354
  - lib/gollum/app.rb
355
355
  - lib/gollum/assets.rb
356
356
  - lib/gollum/helpers.rb
357
- - lib/gollum/public/assets/.sprockets-manifest-3edc7e21737459b21fbf150f5dccd15c.json
358
- - lib/gollum/public/assets/app-982c7fca1832732a24e92474ca2729aeb56f2d0c05bb7a8ff913e9f58a6500d5.js
359
- - lib/gollum/public/assets/app-982c7fca1832732a24e92474ca2729aeb56f2d0c05bb7a8ff913e9f58a6500d5.js.gz
357
+ - lib/gollum/public/assets/.sprockets-manifest-459226ba5fc211b78ba9a3aa6ebde96c.json
358
+ - lib/gollum/public/assets/app-6e925e38a12a40c4fa9e0400cc874e0f4f97b66fdeb90a144dea527dbb544fbd.js
359
+ - lib/gollum/public/assets/app-6e925e38a12a40c4fa9e0400cc874e0f4f97b66fdeb90a144dea527dbb544fbd.js.gz
360
360
  - lib/gollum/public/assets/app-b205e593a30f1cc0054e2e9ed9fc8af3658d8ef4a62b9708c20f204560deefb7.css
361
361
  - lib/gollum/public/assets/app-b205e593a30f1cc0054e2e9ed9fc8af3658d8ef4a62b9708c20f204560deefb7.css.gz
362
362
  - lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css
363
363
  - lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css.gz
364
- - lib/gollum/public/assets/editor-0dbae28c53db5a73d666d30504946671eb09948ffdaf1fdd9d1c8d856d4c0ba1.js
365
- - lib/gollum/public/assets/editor-0dbae28c53db5a73d666d30504946671eb09948ffdaf1fdd9d1c8d856d4c0ba1.js.gz
364
+ - lib/gollum/public/assets/editor-b2c10f22ef6ca1e120956a2d11ff4ca19ac44d7e7240f5cc43ec949184d8b708.js
365
+ - lib/gollum/public/assets/editor-b2c10f22ef6ca1e120956a2d11ff4ca19ac44d7e7240f5cc43ec949184d8b708.js.gz
366
366
  - lib/gollum/public/assets/print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css
367
367
  - lib/gollum/public/assets/print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css.gz
368
368
  - lib/gollum/public/gollum/javascript/HOWTO_UPDATE_ACE.md
@@ -1476,6 +1476,7 @@ files:
1476
1476
  - lib/gollum/public/gollum/stylesheets/spinner.scss
1477
1477
  - lib/gollum/public/gollum/stylesheets/tables.scss
1478
1478
  - lib/gollum/public/gollum/stylesheets/template.scss.erb
1479
+ - lib/gollum/templates/commit.mustache
1479
1480
  - lib/gollum/templates/compare.mustache
1480
1481
  - lib/gollum/templates/create.mustache
1481
1482
  - lib/gollum/templates/edit.mustache
@@ -1495,6 +1496,7 @@ files:
1495
1496
  - lib/gollum/templates/searchbar.mustache
1496
1497
  - lib/gollum/templates/wiki_content.mustache
1497
1498
  - lib/gollum/uri_encode_component.rb
1499
+ - lib/gollum/views/commit.rb
1498
1500
  - lib/gollum/views/compare.rb
1499
1501
  - lib/gollum/views/create.rb
1500
1502
  - lib/gollum/views/edit.rb