gollum-lib 5.0.4-java → 5.1.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +5 -1
- data/README.md +17 -2
- data/Rakefile +1 -0
- data/gemspec.rb +14 -17
- data/lib/gollum-lib/blob_entry.rb +16 -6
- data/lib/gollum-lib/file.rb +1 -1
- data/lib/gollum-lib/filter/macro.rb +1 -1
- data/lib/gollum-lib/filter/pandoc_bib.rb +6 -5
- data/lib/gollum-lib/filter/tags.rb +1 -0
- data/lib/gollum-lib/filter/toc.rb +42 -3
- data/lib/gollum-lib/filter/yaml.rb +1 -1
- data/lib/gollum-lib/helpers.rb +1 -1
- data/lib/gollum-lib/macro.rb +4 -0
- data/lib/gollum-lib/macro/all_pages.rb +1 -1
- data/lib/gollum-lib/macro/audio.rb +1 -1
- data/lib/gollum-lib/macro/global_toc.rb +2 -2
- data/lib/gollum-lib/macro/navigation.rb +2 -2
- data/lib/gollum-lib/macro/note.rb +1 -1
- data/lib/gollum-lib/macro/series.rb +6 -6
- data/lib/gollum-lib/macro/video.rb +1 -1
- data/lib/gollum-lib/macro/warn.rb +1 -1
- data/lib/gollum-lib/markups.rb +4 -3
- data/lib/gollum-lib/page.rb +3 -2
- data/lib/gollum-lib/redirects.rb +4 -3
- data/lib/gollum-lib/version.rb +1 -1
- data/lib/gollum-lib/wiki.rb +6 -4
- metadata +28 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91549ba42cbf448b02f7d79cfb4257c02b549fe7ed4c32ce12910009f817bd2c
|
4
|
+
data.tar.gz: 4e9c0079c2298d216cc9c4022bea79ed395f7704b33630bf319299dd14b4a96c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb855c6b2e316a76060460b406aa4118350034fbdbf41d6afe4bdb7a12e25367c9a6d88d64cf0fac03230090868b1063f01b98102a71430c5e2c0cb09a347361
|
7
|
+
data.tar.gz: 4fb53f05829c6e4d4b889bb1d61573b0ec47a1d8119ee3621244386a12d570251184349c38ebc43c8683e02107c62993c89ea0363c94be08d66162c453130e28
|
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@ gollum lib -- A wiki built on top of Git
|
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/gollum-lib.svg)](http://badge.fury.io/rb/gollum-lib)
|
5
5
|
[![Build Status](https://travis-ci.org/gollum/gollum-lib.svg?branch=master)](https://travis-ci.org/gollum/gollum-lib)
|
6
|
-
[![Dependency Status](https://
|
6
|
+
[![Cutting Edge Dependency Status](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum-lib/svg 'Cutting Edge Dependency Status')](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum-lib/info)
|
7
7
|
|
8
8
|
## DESCRIPTION
|
9
9
|
|
@@ -91,7 +91,7 @@ Note that `base_path` just modifies the links.
|
|
91
91
|
Get the latest version of the given human or canonical page name:
|
92
92
|
|
93
93
|
```ruby
|
94
|
-
page = wiki.page('/page name') # Finds pages in the root directory of the wiki that are named 'page name' with a valid extension.
|
94
|
+
page = wiki.page('/page name') # Finds pages in the root directory of the wiki that are named 'page name' with a valid extension.
|
95
95
|
# => <Gollum::Page>
|
96
96
|
|
97
97
|
page = wiki.page('page name') # For convenience, you can leave out the '/' in front. Paths are assumed to be relative to '/'.
|
@@ -217,6 +217,21 @@ end
|
|
217
217
|
Gollum::Hook.unregister(:post_commit, :hook_id)
|
218
218
|
```
|
219
219
|
|
220
|
+
Register or unregister a hook to be called after the wiki is initialized:
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
Gollum::Hook.register(:post_wiki_initialize, :hook_id) do |wiki|
|
224
|
+
# Your code here
|
225
|
+
end
|
226
|
+
|
227
|
+
Gollum::Hook.unregister(:post_wiki_initialize, :hook_id)
|
228
|
+
```
|
229
|
+
|
230
|
+
A combination of both hooks can be used to pull from a remote after
|
231
|
+
`:post_wiki_initialize` and push to a remote after `:post_commit` which in
|
232
|
+
effect keeps the remote in sync both ways. Keep in mind that it may not be
|
233
|
+
possible to resolve all conflicts automatically.
|
234
|
+
|
220
235
|
## WINDOWS FILENAME VALIDATION
|
221
236
|
|
222
237
|
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
|
data/Rakefile
CHANGED
data/gemspec.rb
CHANGED
@@ -8,7 +8,7 @@ def specification(version, default_adapter, platform = nil)
|
|
8
8
|
s.name = 'gollum-lib'
|
9
9
|
s.version = version
|
10
10
|
s.platform = platform if platform
|
11
|
-
s.date = '
|
11
|
+
s.date = '2021-07-10'
|
12
12
|
s.date = '2017-04-13'
|
13
13
|
s.rubyforge_project = 'gollum-lib'
|
14
14
|
s.license = 'MIT'
|
@@ -29,36 +29,33 @@ def specification(version, default_adapter, platform = nil)
|
|
29
29
|
s.add_dependency 'rouge', '~> 3.1'
|
30
30
|
s.add_dependency 'nokogiri', '~> 1.8'
|
31
31
|
s.add_dependency 'loofah', '~> 2.3'
|
32
|
-
s.add_dependency 'github-markup', '~>
|
32
|
+
s.add_dependency 'github-markup', '~> 4.0'
|
33
33
|
s.add_dependency 'gemojione', '~> 4.1'
|
34
|
-
s.add_dependency 'octicons', '~>
|
34
|
+
s.add_dependency 'octicons', '~> 12.0'
|
35
35
|
s.add_dependency 'twitter-text', '1.14.7'
|
36
36
|
|
37
37
|
s.add_development_dependency 'org-ruby', '~> 0.9.9'
|
38
|
-
s.add_development_dependency 'kramdown', '~> 2.
|
38
|
+
s.add_development_dependency 'kramdown', '~> 2.3.0'
|
39
39
|
s.add_development_dependency 'kramdown-parser-gfm', '~> 1.1.0'
|
40
40
|
s.add_development_dependency 'RedCloth', '~> 4.2.9'
|
41
|
-
s.add_development_dependency 'mocha', '~> 1.
|
42
|
-
s.add_development_dependency 'shoulda', '~>
|
41
|
+
s.add_development_dependency 'mocha', '~> 1.11'
|
42
|
+
s.add_development_dependency 'shoulda', '~> 4.0'
|
43
43
|
s.add_development_dependency 'wikicloth', '~> 0.8.3'
|
44
|
-
s.add_development_dependency 'bibtex-ruby', '~>
|
44
|
+
s.add_development_dependency 'bibtex-ruby', '~> 6.0'
|
45
45
|
s.add_development_dependency 'citeproc-ruby', '~> 1.1'
|
46
46
|
s.add_development_dependency 'unicode_utils', '~> 1.4.0' # required by citeproc-ruby on ruby < 2.4
|
47
|
-
s.add_development_dependency 'rake', '~>
|
48
|
-
s.add_development_dependency 'pry', '~> 0.
|
47
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
48
|
+
s.add_development_dependency 'pry', '~> 0.13'
|
49
49
|
# required by pry
|
50
50
|
s.add_development_dependency 'rb-readline', '~> 0.5.1'
|
51
51
|
# updating minitest-reporters requires a new minitest which fails with gollum's tests.
|
52
|
-
s.add_development_dependency 'test-unit', '~> 3.
|
52
|
+
s.add_development_dependency 'test-unit', '~> 3.3'
|
53
53
|
s.add_development_dependency 'minitest-reporters', '~> 1.4'
|
54
54
|
s.add_development_dependency 'nokogiri-diff', '~> 0.2.0'
|
55
|
-
|
56
|
-
s.add_development_dependency 'guard', '~> 2.
|
57
|
-
s.add_development_dependency '
|
58
|
-
|
59
|
-
s.add_development_dependency 'rb-fsevent', '~> 0.9.4'
|
60
|
-
s.add_development_dependency 'rb-fchange', '~> 0.0.6'
|
61
|
-
s.add_development_dependency 'twitter_cldr', '~> 3.1.0'
|
55
|
+
s.add_development_dependency 'guard', '~> 2.16'
|
56
|
+
s.add_development_dependency 'guard-minitest', '~> 2.4'
|
57
|
+
s.add_development_dependency 'twitter_cldr', '~> 6.4'
|
58
|
+
|
62
59
|
# = MANIFEST =
|
63
60
|
s.files = %w(
|
64
61
|
Gemfile
|
@@ -78,12 +78,22 @@ module Gollum
|
|
78
78
|
# Returns a normalized String directory name, or nil if no directory
|
79
79
|
# is given.
|
80
80
|
def self.normalize_dir(dir)
|
81
|
-
return
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
return unless dir
|
82
|
+
|
83
|
+
dir = dir.dup
|
84
|
+
|
85
|
+
# Remove '.' and '..' path segments
|
86
|
+
dir.gsub!(%r{(\A|/)\.{1,2}(/|\z)}, '/')
|
87
|
+
|
88
|
+
# Remove repeated slashes
|
89
|
+
dir.gsub!(%r{//+}, '/')
|
90
|
+
|
91
|
+
# Remove Windows drive letters, trailing slashes, and keep one leading slash
|
92
|
+
dir.sub!(%r{\A([a-z]:)?/*(.*?)/*\z}i, '/\2')
|
93
|
+
|
94
|
+
# Return empty string for paths that point to the toplevel
|
95
|
+
return '' if dir == '/'
|
96
|
+
|
87
97
|
dir
|
88
98
|
end
|
89
99
|
end
|
data/lib/gollum-lib/file.rb
CHANGED
@@ -171,7 +171,7 @@ module Gollum
|
|
171
171
|
return false if @blob.is_symlink && !FS_SUPPORT_SYMLINKS
|
172
172
|
|
173
173
|
# This will try to resolve symbolic links, as well
|
174
|
-
pathname = Pathname.new(::File.
|
174
|
+
pathname = Pathname.new(::File.join(@wiki.repo.path, '..', BlobEntry.normalize_dir(@path)))
|
175
175
|
if pathname.symlink?
|
176
176
|
source = ::File.readlink(pathname.to_path)
|
177
177
|
realpath = ::File.join(::File.dirname(pathname.to_path), source)
|
@@ -14,16 +14,15 @@ class Gollum::Filter::PandocBib < Gollum::Filter
|
|
14
14
|
|
15
15
|
def extract(data)
|
16
16
|
return data unless supported_format? && bibliography_metadata_present?
|
17
|
-
bib_metadata
|
18
|
-
bib_metadata.merge!(@markup.metadata.select {|key, _value| BIB_KEYS.include?(key)})
|
17
|
+
@bib_metadata.select! {|key, _value| BIB_KEYS.include?(key)}
|
19
18
|
|
20
19
|
BIB_PATH_KEYS.each do |bibliography_key|
|
21
20
|
if path = @markup.metadata[bibliography_key]
|
22
21
|
next unless file = @markup.wiki.file(path)
|
23
|
-
bib_metadata[bibliography_key] = path_for_bibfile(file)
|
22
|
+
@bib_metadata[bibliography_key] = path_for_bibfile(file)
|
24
23
|
end
|
25
24
|
end
|
26
|
-
bib_metadata.empty? ? data : "#{bib_metadata.to_yaml}---\n#{data}"
|
25
|
+
@bib_metadata.empty? ? data : "#{@bib_metadata.to_yaml}---\n#{data}"
|
27
26
|
end
|
28
27
|
|
29
28
|
private
|
@@ -47,6 +46,8 @@ class Gollum::Filter::PandocBib < Gollum::Filter
|
|
47
46
|
end
|
48
47
|
|
49
48
|
def bibliography_metadata_present?
|
50
|
-
|
49
|
+
return false unless @markup.metadata
|
50
|
+
@bib_metadata = @markup.wiki.metadata.merge(@markup.metadata)
|
51
|
+
@bib_metadata.keys.any? {|key| ALL_BIB_KEYS.include?(key)}
|
51
52
|
end
|
52
53
|
end
|
@@ -230,6 +230,7 @@ class Gollum::Filter::Tags < Gollum::Filter
|
|
230
230
|
else
|
231
231
|
name = page ? path_to_link_text(link) : link
|
232
232
|
end
|
233
|
+
|
233
234
|
link = page ? page.escaped_url_path : ERB::Util.url_encode(link).force_encoding('utf-8')
|
234
235
|
generate_link(link, name, extra, presence)
|
235
236
|
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# Inserts header anchors and creates TOC
|
2
2
|
class Gollum::Filter::TOC < Gollum::Filter
|
3
|
+
|
4
|
+
HEADERS = (1..6).to_a
|
5
|
+
|
3
6
|
def extract(data)
|
4
7
|
data
|
5
8
|
end
|
@@ -10,12 +13,15 @@ class Gollum::Filter::TOC < Gollum::Filter
|
|
10
13
|
@toc_doc = nil
|
11
14
|
@anchor_names = {}
|
12
15
|
@current_ancestors = []
|
13
|
-
|
16
|
+
@headers_levels = {}
|
14
17
|
toc_str = ''
|
15
18
|
if @markup.sub_page && @markup.parent_page
|
16
19
|
toc_str = @markup.parent_page.toc_data
|
17
20
|
else
|
18
|
-
@doc.css(
|
21
|
+
@headers = @doc.css(headers_selector)
|
22
|
+
get_toc_levels()
|
23
|
+
|
24
|
+
@headers.each_with_index do |header, i|
|
19
25
|
next if header.content.empty?
|
20
26
|
# omit the first H1 (the page title) from the TOC if so configured
|
21
27
|
next if (i == 0 && header.name =~ /[Hh]1/) && @markup.wiki && @markup.wiki.h1_title
|
@@ -59,6 +65,39 @@ class Gollum::Filter::TOC < Gollum::Filter
|
|
59
65
|
|
60
66
|
private
|
61
67
|
|
68
|
+
def headers_selector
|
69
|
+
HEADERS.map { |n| make_header_tag(n) } .join(',')
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_header_level(header)
|
73
|
+
header.name.match(/[Hh]([1-6])/)[1].to_i
|
74
|
+
end
|
75
|
+
|
76
|
+
# Find level as it should be viewed in TOC for each header
|
77
|
+
# and save hash to @header_levels
|
78
|
+
def get_toc_levels
|
79
|
+
stack = []
|
80
|
+
|
81
|
+
@headers.each do |header|
|
82
|
+
cur_level = get_header_level(header)
|
83
|
+
|
84
|
+
loop do
|
85
|
+
prev_level = stack[-1]
|
86
|
+
break if prev_level.nil? || prev_level < cur_level
|
87
|
+
stack.pop
|
88
|
+
end
|
89
|
+
|
90
|
+
stack.push cur_level
|
91
|
+
@headers_levels[header] = stack.size
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Generates header in format "h<level>"
|
96
|
+
def make_header_tag(level)
|
97
|
+
raise "Header should be from 1 to 6" unless level.between?(1, 6)
|
98
|
+
"h#{level}"
|
99
|
+
end
|
100
|
+
|
62
101
|
# Generates the anchor name from the given header element
|
63
102
|
# removing all non alphanumeric characters, replacing them
|
64
103
|
# with single dashes.
|
@@ -100,7 +139,7 @@ class Gollum::Filter::TOC < Gollum::Filter
|
|
100
139
|
@tail ||= @toc_doc.child
|
101
140
|
@tail_level ||= 0
|
102
141
|
|
103
|
-
level = header
|
142
|
+
level = @headers_levels[header]
|
104
143
|
|
105
144
|
if @tail_level < level
|
106
145
|
while @tail_level < level
|
@@ -14,7 +14,7 @@ class Gollum::Filter::YAML < Gollum::Filter
|
|
14
14
|
@markup.metadata.merge!(frontmatter) if frontmatter.respond_to?(:keys) && frontmatter.respond_to?(:values)
|
15
15
|
rescue ::Psych::SyntaxError, ::Psych::DisallowedClass, ::Psych::BadAlias => error
|
16
16
|
@markup.metadata['errors'] ||= []
|
17
|
-
@markup.metadata['errors'] << "Failed to load YAML
|
17
|
+
@markup.metadata['errors'] << "Failed to load YAML frontmatter: #{error.message}"
|
18
18
|
end
|
19
19
|
''
|
20
20
|
end
|
data/lib/gollum-lib/helpers.rb
CHANGED
data/lib/gollum-lib/macro.rb
CHANGED
@@ -25,6 +25,10 @@ module Gollum
|
|
25
25
|
"<p class=\"gollum-error\">#{s}</p>"
|
26
26
|
end
|
27
27
|
|
28
|
+
def active_page
|
29
|
+
return @page.parent_page || @page
|
30
|
+
end
|
31
|
+
|
28
32
|
# The special class we reserve for only the finest of screwups. The
|
29
33
|
# underscore is to make sure nobody can define a real, callable macro
|
30
34
|
# with the same name, because that would be... exciting.
|
@@ -3,7 +3,7 @@ module Gollum
|
|
3
3
|
class AllPages < Gollum::Macro
|
4
4
|
def render
|
5
5
|
if @wiki.pages.size > 0
|
6
|
-
'<ul id="pages">' + @wiki.pages.map { |p| "<li>#{p.name}</li>" }.join + '</ul>'
|
6
|
+
'<ul id="pages">' + @wiki.pages.map { |p| "<li>#{CGI::escapeHTML(p.name)}</li>" }.join + '</ul>'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -2,7 +2,7 @@ module Gollum
|
|
2
2
|
class Macro
|
3
3
|
class Audio < Gollum::Macro
|
4
4
|
def render (fname)
|
5
|
-
"<audio width=\"100%\" height=\"100%\" src=\"#{fname}\" controls=\"\"> HTML5 audio is not supported on this Browser.</audio>"
|
5
|
+
"<audio width=\"100%\" height=\"100%\" src=\"#{CGI::escapeHTML(fname)}\" controls=\"\"> HTML5 audio is not supported on this Browser.</audio>"
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -4,9 +4,9 @@ module Gollum
|
|
4
4
|
def render(title = "Global Table of Contents")
|
5
5
|
if @wiki.pages.size > 0
|
6
6
|
prepath = @wiki.base_path.sub(/\/$/, '')
|
7
|
-
result = '<ul>' + @wiki.pages.map { |p| "<li><a href=\"#{prepath
|
7
|
+
result = '<ul>' + @wiki.pages.map { |p| "<li><a href=\"#{CGI::escapeHTML(prepath + "/" + p.escaped_url_path)}\">#{CGI::escapeHTML(p.url_path)}</a></li>" }.join + '</ul>'
|
8
8
|
end
|
9
|
-
"<div class=\"toc\"><div class=\"toc-title\">#{title}</div>#{result}</div>"
|
9
|
+
"<div class=\"toc\"><div class=\"toc-title\">#{CGI::escapeHTML(title)}</div>#{result}</div>"
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -9,12 +9,12 @@ module Gollum
|
|
9
9
|
list_items = pages.map do |page|
|
10
10
|
if toc_root_path == '.' || page.url_path =~ /^#{toc_root_path}\//
|
11
11
|
path_display = (full_path || toc_root_path == '.') ? page.url_path : page.url_path.sub(/^#{toc_root_path}\//,"").sub(/^\//,'')
|
12
|
-
"<li><a href=\"#{prepath
|
12
|
+
"<li><a href=\"#{CGI::escapeHTML(prepath + "/" + page.escaped_url_path)}\">#{CGI::escapeHTML(path_display)}</a></li>"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
result = "<ul>#{list_items.join}</ul>"
|
16
16
|
end
|
17
|
-
"<div class=\"toc\"><div class=\"toc-title\">#{title}</div>#{result}</div>"
|
17
|
+
"<div class=\"toc\"><div class=\"toc-title\">#{CGI::escapeHTML(title)}</div>#{result}</div>"
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -3,13 +3,13 @@ module Gollum
|
|
3
3
|
|
4
4
|
class Series < Gollum::Macro
|
5
5
|
def render(series_prefix = "")
|
6
|
-
raise "This page's name does not match the prefix '#{series_prefix}'" unless
|
6
|
+
raise "This page's name does not match the prefix '#{series_prefix}'" unless active_page.name =~ /^#{series_prefix}/
|
7
7
|
render_links(*find_series(series_prefix))
|
8
8
|
end
|
9
9
|
|
10
10
|
def render_links(previous_page, next_page)
|
11
|
-
result = "Previous: <a href=\"#{::File.join(@wiki.base_path,previous_page.escaped_url_path)}\">#{previous_page.name}</a>" if previous_page
|
12
|
-
result = "#{result}#{result ? ' | ' : ''}Next: <a href=\"#{::File.join(@wiki.base_path,next_page.escaped_url_path)}\">#{next_page.name}</a>" if next_page
|
11
|
+
result = "Previous: <a href=\"#{CGI::escapeHTML(::File.join(@wiki.base_path,previous_page.escaped_url_path))}\">#{CGI::escapeHTML(previous_page.name)}</a>" if previous_page
|
12
|
+
result = "#{result}#{result ? ' | ' : ''}Next: <a href=\"#{CGI::escapeHTML(::File.join(@wiki.base_path,next_page.escaped_url_path))}\">#{CGI::escapeHTML(next_page.name)}</a>" if next_page
|
13
13
|
wrap_result(result)
|
14
14
|
end
|
15
15
|
|
@@ -21,7 +21,7 @@ module Gollum
|
|
21
21
|
dir = @wiki.pages.select {|page| ::File.dirname(page.path) == ::File.dirname(@page.path)}
|
22
22
|
dir.select! {|page| page.name =~ /\A#{series_prefix}/ } unless series_prefix.empty?
|
23
23
|
dir.sort_by! {|page| page.name}
|
24
|
-
self_index = dir.find_index {|page| page.name ==
|
24
|
+
self_index = dir.find_index {|page| page.name == active_page.name}
|
25
25
|
if self_index > 0
|
26
26
|
return dir[self_index-1], dir[self_index+1]
|
27
27
|
else
|
@@ -32,14 +32,14 @@ module Gollum
|
|
32
32
|
|
33
33
|
class SeriesStart < Gollum::Macro::Series
|
34
34
|
def render_links(previous_page, next_page)
|
35
|
-
result = "Next: <a href=\"#{::File.join(@wiki.base_path,next_page.escaped_url_path)}\">#{next_page.name}</a>" if next_page
|
35
|
+
result = "Next: <a href=\"#{CGI::escapeHTML(::File.join(@wiki.base_path,next_page.escaped_url_path))}\">#{CGI::escapeHTML(next_page.name)}</a>" if next_page
|
36
36
|
wrap_result(result)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
class SeriesEnd < Gollum::Macro::Series
|
41
41
|
def render_links(previous_page, next_page)
|
42
|
-
result = "Previous: <a href=\"#{::File.join(@wiki.base_path,previous_page.escaped_url_path)}\">#{previous_page.name}</a>" if previous_page
|
42
|
+
result = "Previous: <a href=\"#{CGI::escapeHTML(::File.join(@wiki.base_path,previous_page.escaped_url_path))}\">#{CGI::escapeHTML(previous_page.name)}</a>" if previous_page
|
43
43
|
wrap_result(result)
|
44
44
|
end
|
45
45
|
end
|
@@ -2,7 +2,7 @@ module Gollum
|
|
2
2
|
class Macro
|
3
3
|
class Video < Gollum::Macro
|
4
4
|
def render (fname)
|
5
|
-
"<video width=\"100%\" height=\"100%\" src=\"#{fname}\" controls=\"\"> HTML5 video is not supported on this Browser.</video>"
|
5
|
+
"<video width=\"100%\" height=\"100%\" src=\"#{CGI::escapeHTML(fname)}\" controls=\"\"> HTML5 video is not supported on this Browser.</video>"
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -4,7 +4,7 @@ module Gollum
|
|
4
4
|
def render(warning)
|
5
5
|
icon = Octicons::Octicon.new('alert', {width: 24, height: 24})
|
6
6
|
icon.options[:class] << ' mr-2'
|
7
|
-
"<div class='flash flash-warn'>#{icon.to_svg}#{warning}</div>"
|
7
|
+
"<div class='flash flash-warn'>#{icon.to_svg}#{CGI::escapeHTML(warning)}</div>"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/gollum-lib/markups.rb
CHANGED
@@ -56,9 +56,9 @@ end
|
|
56
56
|
module Gollum
|
57
57
|
class Markup
|
58
58
|
if gem_exists?('pandoc-ruby')
|
59
|
-
GitHub::Markup::Markdown::MARKDOWN_GEMS.
|
59
|
+
GitHub::Markup::Markdown::MARKDOWN_GEMS.clear
|
60
60
|
GitHub::Markup::Markdown::MARKDOWN_GEMS['pandoc-ruby'] = proc { |content|
|
61
|
-
PandocRuby.convert(content, :from =>
|
61
|
+
PandocRuby.convert(content, '--citeproc', :from => 'markdown-tex_math_dollars-raw_tex', :to => :html)
|
62
62
|
}
|
63
63
|
else
|
64
64
|
GitHub::Markup::Markdown::MARKDOWN_GEMS['kramdown'] = proc { |content|
|
@@ -85,7 +85,8 @@ module Gollum
|
|
85
85
|
:extensions => ['rest', 'rst'])
|
86
86
|
register(:asciidoc, "AsciiDoc",
|
87
87
|
:skip_filters => [:Tags],
|
88
|
-
:enabled => MarkupRegisterUtils::gem_exists?("asciidoctor")
|
88
|
+
:enabled => MarkupRegisterUtils::gem_exists?("asciidoctor"),
|
89
|
+
:extensions => ['adoc','asciidoc'])
|
89
90
|
register(:mediawiki, "MediaWiki",
|
90
91
|
:enabled => MarkupRegisterUtils::gem_exists?("wikicloth"),
|
91
92
|
:extensions => ['mediawiki','wiki'], :reverse_links => true)
|
data/lib/gollum-lib/page.rb
CHANGED
@@ -277,7 +277,7 @@ module Gollum
|
|
277
277
|
#
|
278
278
|
# Returns the String extension (no leading period).
|
279
279
|
def self.format_to_ext(format)
|
280
|
-
format
|
280
|
+
Gollum::Markup.formats[format] ? Gollum::Markup.formats[format][:extensions].first : nil
|
281
281
|
end
|
282
282
|
|
283
283
|
# The underlying wiki repo.
|
@@ -360,7 +360,7 @@ module Gollum
|
|
360
360
|
def initialize(wiki, name, data, version, parent_page = nil)
|
361
361
|
@wiki = wiki
|
362
362
|
@path = name
|
363
|
-
@blob = OpenStruct.new(:name => name, :data => data, :is_symlink => false)
|
363
|
+
@blob = OpenStruct.new(:name => name, :data => wiki.normalize(data), :is_symlink => false)
|
364
364
|
@version = version
|
365
365
|
@formatted_data = nil
|
366
366
|
@doc = nil
|
@@ -368,5 +368,6 @@ module Gollum
|
|
368
368
|
@historical = false
|
369
369
|
end
|
370
370
|
end
|
371
|
+
|
371
372
|
|
372
373
|
end
|
data/lib/gollum-lib/redirects.rb
CHANGED
@@ -28,9 +28,10 @@ module Gollum
|
|
28
28
|
self.clear
|
29
29
|
self.merge!(redirects)
|
30
30
|
end
|
31
|
-
|
32
|
-
def dump
|
33
|
-
|
31
|
+
|
32
|
+
def dump(commit=nil)
|
33
|
+
commit = {} if commit.nil?
|
34
|
+
@wiki.overwrite_file(REDIRECTS_FILE, self.to_yaml, commit)
|
34
35
|
end
|
35
36
|
|
36
37
|
def get_head_sha
|
data/lib/gollum-lib/version.rb
CHANGED
data/lib/gollum-lib/wiki.rb
CHANGED
@@ -150,6 +150,8 @@ module Gollum
|
|
150
150
|
@filter_chain.delete(:Emoji) unless options.fetch :emoji, false
|
151
151
|
@filter_chain.delete(:PandocBib) unless ::Gollum::MarkupRegisterUtils.using_pandoc?
|
152
152
|
@filter_chain.delete(:CriticMarkup) unless options.fetch :critic_markup, false
|
153
|
+
|
154
|
+
Hook.execute(:post_wiki_initialize, self)
|
153
155
|
end
|
154
156
|
|
155
157
|
# Public: check whether the wiki's git repo exists on the filesystem.
|
@@ -551,14 +553,14 @@ module Gollum
|
|
551
553
|
@redirects
|
552
554
|
end
|
553
555
|
|
554
|
-
def add_redirect(old_path, new_path)
|
556
|
+
def add_redirect(old_path, new_path, commit=nil)
|
555
557
|
redirects[old_path] = new_path
|
556
|
-
redirects.dump
|
558
|
+
redirects.dump(commit)
|
557
559
|
end
|
558
560
|
|
559
|
-
def remove_redirect(path)
|
561
|
+
def remove_redirect(path, commit=nil)
|
560
562
|
redirects.tap{|k| k.delete(path)}
|
561
|
-
redirects.dump
|
563
|
+
redirects.dump(commit)
|
562
564
|
end
|
563
565
|
|
564
566
|
#########################################################################
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
8
8
|
- Rick Olson
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2017-04-13 00:00:00.000000000 Z
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '4.0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '4.0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: gemojione
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,14 +101,14 @@ dependencies:
|
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
104
|
+
version: '12.0'
|
105
105
|
type: :runtime
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
111
|
+
version: '12.0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: twitter-text
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,14 +143,14 @@ dependencies:
|
|
143
143
|
requirements:
|
144
144
|
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 2.
|
146
|
+
version: 2.3.0
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
151
|
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: 2.
|
153
|
+
version: 2.3.0
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: kramdown-parser-gfm
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,28 +185,28 @@ dependencies:
|
|
185
185
|
requirements:
|
186
186
|
- - "~>"
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version: 1.
|
188
|
+
version: '1.11'
|
189
189
|
type: :development
|
190
190
|
prerelease: false
|
191
191
|
version_requirements: !ruby/object:Gem::Requirement
|
192
192
|
requirements:
|
193
193
|
- - "~>"
|
194
194
|
- !ruby/object:Gem::Version
|
195
|
-
version: 1.
|
195
|
+
version: '1.11'
|
196
196
|
- !ruby/object:Gem::Dependency
|
197
197
|
name: shoulda
|
198
198
|
requirement: !ruby/object:Gem::Requirement
|
199
199
|
requirements:
|
200
200
|
- - "~>"
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
202
|
+
version: '4.0'
|
203
203
|
type: :development
|
204
204
|
prerelease: false
|
205
205
|
version_requirements: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - "~>"
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
209
|
+
version: '4.0'
|
210
210
|
- !ruby/object:Gem::Dependency
|
211
211
|
name: wikicloth
|
212
212
|
requirement: !ruby/object:Gem::Requirement
|
@@ -227,14 +227,14 @@ dependencies:
|
|
227
227
|
requirements:
|
228
228
|
- - "~>"
|
229
229
|
- !ruby/object:Gem::Version
|
230
|
-
version: '
|
230
|
+
version: '6.0'
|
231
231
|
type: :development
|
232
232
|
prerelease: false
|
233
233
|
version_requirements: !ruby/object:Gem::Requirement
|
234
234
|
requirements:
|
235
235
|
- - "~>"
|
236
236
|
- !ruby/object:Gem::Version
|
237
|
-
version: '
|
237
|
+
version: '6.0'
|
238
238
|
- !ruby/object:Gem::Dependency
|
239
239
|
name: citeproc-ruby
|
240
240
|
requirement: !ruby/object:Gem::Requirement
|
@@ -269,34 +269,28 @@ dependencies:
|
|
269
269
|
requirements:
|
270
270
|
- - "~>"
|
271
271
|
- !ruby/object:Gem::Version
|
272
|
-
version: '
|
273
|
-
- - ">="
|
274
|
-
- !ruby/object:Gem::Version
|
275
|
-
version: 12.3.3
|
272
|
+
version: '13.0'
|
276
273
|
type: :development
|
277
274
|
prerelease: false
|
278
275
|
version_requirements: !ruby/object:Gem::Requirement
|
279
276
|
requirements:
|
280
277
|
- - "~>"
|
281
278
|
- !ruby/object:Gem::Version
|
282
|
-
version: '
|
283
|
-
- - ">="
|
284
|
-
- !ruby/object:Gem::Version
|
285
|
-
version: 12.3.3
|
279
|
+
version: '13.0'
|
286
280
|
- !ruby/object:Gem::Dependency
|
287
281
|
name: pry
|
288
282
|
requirement: !ruby/object:Gem::Requirement
|
289
283
|
requirements:
|
290
284
|
- - "~>"
|
291
285
|
- !ruby/object:Gem::Version
|
292
|
-
version: 0.
|
286
|
+
version: '0.13'
|
293
287
|
type: :development
|
294
288
|
prerelease: false
|
295
289
|
version_requirements: !ruby/object:Gem::Requirement
|
296
290
|
requirements:
|
297
291
|
- - "~>"
|
298
292
|
- !ruby/object:Gem::Version
|
299
|
-
version: 0.
|
293
|
+
version: '0.13'
|
300
294
|
- !ruby/object:Gem::Dependency
|
301
295
|
name: rb-readline
|
302
296
|
requirement: !ruby/object:Gem::Requirement
|
@@ -317,14 +311,14 @@ dependencies:
|
|
317
311
|
requirements:
|
318
312
|
- - "~>"
|
319
313
|
- !ruby/object:Gem::Version
|
320
|
-
version: 3.
|
314
|
+
version: '3.3'
|
321
315
|
type: :development
|
322
316
|
prerelease: false
|
323
317
|
version_requirements: !ruby/object:Gem::Requirement
|
324
318
|
requirements:
|
325
319
|
- - "~>"
|
326
320
|
- !ruby/object:Gem::Version
|
327
|
-
version: 3.
|
321
|
+
version: '3.3'
|
328
322
|
- !ruby/object:Gem::Dependency
|
329
323
|
name: minitest-reporters
|
330
324
|
requirement: !ruby/object:Gem::Requirement
|
@@ -359,84 +353,42 @@ dependencies:
|
|
359
353
|
requirements:
|
360
354
|
- - "~>"
|
361
355
|
- !ruby/object:Gem::Version
|
362
|
-
version: 2.
|
356
|
+
version: '2.16'
|
363
357
|
type: :development
|
364
358
|
prerelease: false
|
365
359
|
version_requirements: !ruby/object:Gem::Requirement
|
366
360
|
requirements:
|
367
361
|
- - "~>"
|
368
362
|
- !ruby/object:Gem::Version
|
369
|
-
version: 2.
|
363
|
+
version: '2.16'
|
370
364
|
- !ruby/object:Gem::Dependency
|
371
365
|
name: guard-minitest
|
372
366
|
requirement: !ruby/object:Gem::Requirement
|
373
367
|
requirements:
|
374
368
|
- - "~>"
|
375
369
|
- !ruby/object:Gem::Version
|
376
|
-
version: 2.
|
377
|
-
type: :development
|
378
|
-
prerelease: false
|
379
|
-
version_requirements: !ruby/object:Gem::Requirement
|
380
|
-
requirements:
|
381
|
-
- - "~>"
|
382
|
-
- !ruby/object:Gem::Version
|
383
|
-
version: 2.3.2
|
384
|
-
- !ruby/object:Gem::Dependency
|
385
|
-
name: rb-inotify
|
386
|
-
requirement: !ruby/object:Gem::Requirement
|
387
|
-
requirements:
|
388
|
-
- - "~>"
|
389
|
-
- !ruby/object:Gem::Version
|
390
|
-
version: 0.9.3
|
391
|
-
type: :development
|
392
|
-
prerelease: false
|
393
|
-
version_requirements: !ruby/object:Gem::Requirement
|
394
|
-
requirements:
|
395
|
-
- - "~>"
|
396
|
-
- !ruby/object:Gem::Version
|
397
|
-
version: 0.9.3
|
398
|
-
- !ruby/object:Gem::Dependency
|
399
|
-
name: rb-fsevent
|
400
|
-
requirement: !ruby/object:Gem::Requirement
|
401
|
-
requirements:
|
402
|
-
- - "~>"
|
403
|
-
- !ruby/object:Gem::Version
|
404
|
-
version: 0.9.4
|
405
|
-
type: :development
|
406
|
-
prerelease: false
|
407
|
-
version_requirements: !ruby/object:Gem::Requirement
|
408
|
-
requirements:
|
409
|
-
- - "~>"
|
410
|
-
- !ruby/object:Gem::Version
|
411
|
-
version: 0.9.4
|
412
|
-
- !ruby/object:Gem::Dependency
|
413
|
-
name: rb-fchange
|
414
|
-
requirement: !ruby/object:Gem::Requirement
|
415
|
-
requirements:
|
416
|
-
- - "~>"
|
417
|
-
- !ruby/object:Gem::Version
|
418
|
-
version: 0.0.6
|
370
|
+
version: '2.4'
|
419
371
|
type: :development
|
420
372
|
prerelease: false
|
421
373
|
version_requirements: !ruby/object:Gem::Requirement
|
422
374
|
requirements:
|
423
375
|
- - "~>"
|
424
376
|
- !ruby/object:Gem::Version
|
425
|
-
version:
|
377
|
+
version: '2.4'
|
426
378
|
- !ruby/object:Gem::Dependency
|
427
379
|
name: twitter_cldr
|
428
380
|
requirement: !ruby/object:Gem::Requirement
|
429
381
|
requirements:
|
430
382
|
- - "~>"
|
431
383
|
- !ruby/object:Gem::Version
|
432
|
-
version:
|
384
|
+
version: '6.4'
|
433
385
|
type: :development
|
434
386
|
prerelease: false
|
435
387
|
version_requirements: !ruby/object:Gem::Requirement
|
436
388
|
requirements:
|
437
389
|
- - "~>"
|
438
390
|
- !ruby/object:Gem::Version
|
439
|
-
version:
|
391
|
+
version: '6.4'
|
440
392
|
description: A simple, Git-powered wiki with a sweet API and local frontend.
|
441
393
|
email: tom@github.com
|
442
394
|
executables: []
|
@@ -500,7 +452,7 @@ homepage: http://github.com/gollum/gollum-lib
|
|
500
452
|
licenses:
|
501
453
|
- MIT
|
502
454
|
metadata: {}
|
503
|
-
post_install_message:
|
455
|
+
post_install_message:
|
504
456
|
rdoc_options:
|
505
457
|
- "--charset=UTF-8"
|
506
458
|
require_paths:
|
@@ -517,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
517
469
|
version: '0'
|
518
470
|
requirements: []
|
519
471
|
rubygems_version: 3.0.3
|
520
|
-
signing_key:
|
472
|
+
signing_key:
|
521
473
|
specification_version: 2
|
522
474
|
summary: A simple, Git-powered wiki.
|
523
475
|
test_files: []
|