gollum-lib 5.0.1 → 5.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a39ec11de1f3cda57ce83f2ee9280e4eda1d0f4e4a5cb61e8a4c63c57c06639c
4
- data.tar.gz: ebd42559e9569648fd8d43afdccd2cc48f937f7a7f70029e8b47219f4eeb171c
3
+ metadata.gz: 694f921b2852f541dadb62d440d8b9dccdf3a387c8017980e9aad575a89b598c
4
+ data.tar.gz: 6819382931ebd534d6b698bb733f251b4b7df7c1bc6475dd8130aadf75402971
5
5
  SHA512:
6
- metadata.gz: fa86da1e0ad83ddf4aa4e02f308947eeece40a1b9e3e1a638643e7f8d6dab231c0fa8d309ebfdf5c481df34e7fc7fa1cfe965a93ef8857d2975c9385d1681afd
7
- data.tar.gz: 7bed95172bf1640b3026b45e5919720974f70baae2796918281d6a346e615ed1d5066fe1e007a3a2b93c2a195283012e4c35e05a7de5af31dd29f0cdd8dbbbf9
6
+ metadata.gz: 3f6e4e928067b7044f2f415911d2ddace84d352dc5e18d17f5dd096bc98daf40acae64de86934ffd9ae20dca4a5a486bd58c74613b66fe7299bfec8a4c8bd236
7
+ data.tar.gz: 2a82c3024a8c0365089e588be77e0efcc73a8406d9882095788e8937f3e281249007b6c7f4dee9c754ae244d19d2394243b856536c4abf63d5af535911fd83b8
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v5.0.1
2
+
3
+ Bugfix release: fix emoji when using base path. Thanks to @heavywatal.
4
+
1
5
  # v5.0
2
6
 
3
7
  For a detailed overview of changes in 5.0 and a guide to migrating your wiki, see https://github.com/gollum/gollum/wiki/5.0-release-notes
data/Rakefile CHANGED
@@ -51,11 +51,11 @@ def gemspec_file
51
51
  end
52
52
 
53
53
  def gemspecs
54
- [RUBY_PLATFORM == 'java' ? "#{name}_java.gemspec" : "#{name}.gemspec"]
54
+ ["#{name}.gemspec", "#{name}_java.gemspec"]
55
55
  end
56
56
 
57
57
  def gem_files
58
- [RUBY_PLATFORM == 'java' ? "#{name}-#{version}-java.gem" : "#{name}-#{version}.gem"]
58
+ ["#{name}-#{version}.gem", "#{name}-#{version}-java.gem"]
59
59
  end
60
60
 
61
61
  def replace_header(head, header_name)
@@ -75,6 +75,7 @@ Rake::TestTask.new(:test) do |test|
75
75
  test.libs << 'lib' << 'test' << '.'
76
76
  test.pattern = 'test/**/test_*.rb'
77
77
  test.verbose = true
78
+ test.warning = false
78
79
  end
79
80
 
80
81
  desc "Generate RCov test coverage and open in your browser"
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 = '2020-03-29'
11
+ s.date = '2020-09-23'
12
12
  s.date = '2017-04-13'
13
13
  s.rubyforge_project = 'gollum-lib'
14
14
  s.license = 'MIT'
@@ -66,7 +66,6 @@ def specification(version, default_adapter, platform = nil)
66
66
  LICENSE
67
67
  README.md
68
68
  Rakefile
69
- adapter_dependencies.rb
70
69
  docs/sanitization.md
71
70
  gemspec.rb
72
71
  gollum-lib.gemspec
@@ -1,4 +1,10 @@
1
1
  require File.join(File.dirname(__FILE__), 'gemspec.rb')
2
- require File.join(File.dirname(__FILE__), 'adapter_dependencies.rb')
3
2
  require File.join(File.dirname(__FILE__), 'lib', 'gollum-lib', 'version.rb')
4
- Gem::Specification.new &specification(Gollum::Lib::VERSION, DEFAULT_ADAPTER_REQ)
3
+ # This file needs to conditionally define the default adapter for MRI and Java, because this is the file that is included from the Gemfile.
4
+ # In addition, the default Java adapter needs to be defined in gollum-lib_java.gemspec beause that file is used to *build* the Java gem.
5
+ if RUBY_PLATFORM == 'java' then
6
+ default_adapter = ['gollum-rjgit_adapter', '~> 0.6']
7
+ else
8
+ default_adapter = ['gollum-rugged_adapter', '~> 1.0']
9
+ end
10
+ Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter)
@@ -1,4 +1,4 @@
1
1
  require File.join(File.dirname(__FILE__), 'gemspec.rb')
2
- require File.join(File.dirname(__FILE__), 'adapter_dependencies.rb')
3
2
  require File.join(File.dirname(__FILE__), 'lib', 'gollum-lib', 'version.rb')
4
- Gem::Specification.new &specification(Gollum::Lib::VERSION, DEFAULT_ADAPTER_REQ, "java")
3
+ default_adapter = ['gollum-rjgit_adapter', '~> 0.6']
4
+ Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter, "java")
@@ -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 '' if dir =~ /^.:\/$/
82
- if dir
83
- dir = ::File.expand_path(dir, '/')
84
- dir = dir[2..-1] if dir =~ /^[a-zA-Z]:\// # expand_path may add d:/ on windows
85
- dir = '' if dir == '/'
86
- end
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
@@ -54,7 +54,7 @@ module Gollum
54
54
  @actor ||= begin
55
55
  @options[:name] = @wiki.default_committer_name if @options[:name].nil?
56
56
  @options[:email] = @wiki.default_committer_email if @options[:email].nil?
57
- Gollum::Git::Actor.new(@options[:name], @options[:email])
57
+ Gollum::Git::Actor.new(@options[:name], @options[:email], @options[:time])
58
58
  end
59
59
  end
60
60
 
@@ -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.expand_path(::File.join(@wiki.repo.path, '..', @path)))
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)
@@ -26,7 +26,8 @@ class Gollum::Filter::Emoji < Gollum::Filter
26
26
  end
27
27
 
28
28
  def process(data)
29
- data.gsub! process_pattern, %q(<img src="/gollum/emoji/\k<name>" alt="\k<name>" class="emoji">)
29
+ src = ::File.join(@markup.wiki.base_path, '/gollum/emoji/\\k<name>')
30
+ data.gsub! process_pattern, %Q(<img src="#{src}" alt="\\k<name>" class="emoji">)
30
31
  data
31
32
  end
32
33
 
@@ -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
@@ -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 frontmater: #{error.message}"
17
+ @markup.metadata['errors'] << "Failed to load YAML frontmatter: #{error.message}"
18
18
  end
19
19
  ''
20
20
  end
@@ -16,7 +16,7 @@ module Gollum
16
16
  # '/opt/local/bin/ruby.ext' -> 'ruby'
17
17
  def path_to_link_text(str)
18
18
  return nil unless str
19
- ::File.basename(str, ::File.extname(str))
19
+ ::File.basename(str, Page.valid_extension?(str) ? ::File.extname(str) : '')
20
20
  end
21
21
 
22
22
  end
@@ -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
 
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 @page.name =~ /^#{series_prefix}/
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
 
@@ -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 == @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
@@ -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.delete('kramdown')
59
+ GitHub::Markup::Markdown::MARKDOWN_GEMS.clear
60
60
  GitHub::Markup::Markdown::MARKDOWN_GEMS['pandoc-ruby'] = proc { |content|
61
- PandocRuby.convert(content, :from => :markdown, :to => :html, :filter => 'pandoc-citeproc')
61
+ PandocRuby.convert(content, :from => 'markdown-tex_math_dollars-raw_tex', :to => :html, :filter => 'pandoc-citeproc')
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)
@@ -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 == :markdown ? "md" : format.to_s
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
@@ -7,12 +7,12 @@ module Gollum
7
7
  module Redirects
8
8
 
9
9
  def stale?
10
- @current_head != @wiki.repo.head.commit.sha
10
+ @current_head != get_head_sha
11
11
  end
12
12
 
13
13
  def init(wiki)
14
14
  @wiki = wiki
15
- @current_head = @wiki.repo.head.commit.sha
15
+ @current_head = get_head_sha
16
16
  end
17
17
 
18
18
  def load
@@ -33,6 +33,10 @@ module Gollum
33
33
  @wiki.overwrite_file(REDIRECTS_FILE, self.to_yaml, {})
34
34
  end
35
35
 
36
+ def get_head_sha
37
+ @wiki.repo.head ? @wiki.repo.head.commit.sha : nil
38
+ end
39
+
36
40
  end # Redirects Module
37
41
 
38
42
  end # Gollum Module
@@ -1,5 +1,5 @@
1
1
  module Gollum
2
2
  module Lib
3
- VERSION = '5.0.1'
3
+ VERSION = '5.0.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -15,22 +15,16 @@ dependencies:
15
15
  name: gollum-rugged_adapter
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 0.99.4
21
18
  - - "~>"
22
19
  - !ruby/object:Gem::Version
23
- version: 0.99.4
20
+ version: '1.0'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: 0.99.4
31
25
  - - "~>"
32
26
  - !ruby/object:Gem::Version
33
- version: 0.99.4
27
+ version: '1.0'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: rouge
36
30
  requirement: !ruby/object:Gem::Requirement
@@ -456,7 +450,6 @@ files:
456
450
  - LICENSE
457
451
  - README.md
458
452
  - Rakefile
459
- - adapter_dependencies.rb
460
453
  - docs/sanitization.md
461
454
  - gemspec.rb
462
455
  - gollum-lib.gemspec
@@ -1,7 +0,0 @@
1
- # Set the default git adapter for use in gollum-lib.gemspec and gollum-lib_java.gemspec
2
-
3
- if RUBY_PLATFORM == 'java' then
4
- DEFAULT_ADAPTER_REQ = ['gollum-rjgit_adapter', '>= 0.5.1', '~> 0.5.1']
5
- else
6
- DEFAULT_ADAPTER_REQ = ['gollum-rugged_adapter', '>= 0.99.4', '~> 0.99.4']
7
- end