gollum-lib 5.1.3-java → 5.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30bf4e344e069297b87fad5950fc22d5cf148179bc789b6829be3ff8cb840e75
4
- data.tar.gz: 8293a92e93665911a928eae7aaadceb42db44128dd704e35f534ffced06278df
3
+ metadata.gz: 90304790b813ff264f9bbdcb865913290b3e53d3c234a9bb66deaa48a9a79e06
4
+ data.tar.gz: b911ed6044d4488a87afbcd50f83e68e980c0941a8e8410141ecdbf835b87053
5
5
  SHA512:
6
- metadata.gz: 43b5344bf05f97539ade8fe0102ef8b17e405c2b362e38673d7e07752169852170a4be3c1611006e73121b7a43d54c469b229c0a173b91773228e50ebba3a66c
7
- data.tar.gz: f1b7c53f8c628b38bdda9d0a834f10b3ffd703b157da597d068645cdc5daa6412c98b5681f942c8060b86c82eff811e3a1837bf8496e766471082d8cffe5c44f
6
+ metadata.gz: 6c54a7337aad59a03103e6c95c7b5822eac8912c69e552298d1773b8e5f64dc4a26c1445b108f80fd50bb163918349ca394c3cdc9c8b3a48a60e58c3d737d021
7
+ data.tar.gz: 2731cd5fef0f1f3f3e7b937db617c3cbe390b6c79d645dee2a374ba51e3d1059446520c1b5486f558d6662d31878dc19866a6126c38313642854ace36a727b38
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ # ~*~ encoding: utf-8 ~*~
2
+ guard 'minitest' do
3
+ # with Minitest::Unit
4
+ watch(%r|^test/(.*)\/?test_(.*)\.rb|)
5
+ watch(%r|^lib/(.*/)?([^/]+)\.rb|) { |m| "test/test_#{m[2]}.rb" }
6
+ watch(%r|^test/helper\.rb|) { "test" }
7
+ end
data/HISTORY.md CHANGED
@@ -27,11 +27,11 @@ For a detailed overview of changes in 5.0 and a guide to migrating your wiki, se
27
27
  ** New Macro for listing contents of (sub)directories: `Navigation()`
28
28
  ** Table of Contents now supports setting max heading level
29
29
 
30
- # v4.0.2 /2015-0119
30
+ # v4.0.2 / 2015-01-19
31
31
 
32
32
  * Bugfixes
33
33
 
34
- # v4.0.1 /2014-12-04
34
+ # v4.0.1 / 2014-12-04
35
35
 
36
36
  * Security fix for [remote code execution issue](https://github.com/gollum/gollum/issues/913). Please update!
37
37
 
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
  require 'date'
4
+ require 'tempfile'
4
5
 
5
6
  #############################################################################
6
7
  #
@@ -12,11 +13,23 @@ def name
12
13
  "gollum-lib"
13
14
  end
14
15
 
16
+ def date
17
+ Time.now.strftime("%Y-%m-%d")
18
+ end
19
+
15
20
  def version
16
21
  line = File.read("lib/gollum-lib/version.rb")[/^\s*VERSION\s*=\s*.*/]
17
22
  line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
23
  end
19
24
 
25
+ def latest_changes_file
26
+ 'LATEST_CHANGES.md'
27
+ end
28
+
29
+ def history_file
30
+ 'HISTORY.md'
31
+ end
32
+
20
33
  # assumes x.y.z all digit version
21
34
  def next_version
22
35
  # x.y.z
@@ -38,24 +51,16 @@ def bump_version
38
51
  new_version
39
52
  end
40
53
 
41
- def date
42
- Date.today.to_s
43
- end
44
-
45
- def rubyforge_project
46
- name
47
- end
48
-
49
54
  def gemspec_file
50
55
  "gemspec.rb"
51
56
  end
52
57
 
53
58
  def gemspecs
54
- ["#{name}.gemspec", "#{name}_java.gemspec"]
59
+ ["#{name}.gemspec", "#{name}_java.gemspec"]
55
60
  end
56
61
 
57
62
  def gem_files
58
- ["#{name}-#{version}.gem", "#{name}-#{version}-java.gem"]
63
+ ["#{name}-#{version}.gem", "#{name}-#{version}-java.gem"]
59
64
  end
60
65
 
61
66
  def replace_header(head, header_name)
@@ -106,23 +111,19 @@ task :bump do
106
111
  Rake::Task[:validate].execute
107
112
  end
108
113
 
109
- desc "Build and install"
110
- task :install => :build do
111
- sh "gem install --local --no-document pkg/#{name}-#{version}.gem"
112
- end
113
-
114
114
  #############################################################################
115
115
  #
116
116
  # Packaging tasks
117
117
  #
118
118
  #############################################################################
119
119
 
120
- desc 'Create a release build'
120
+ desc 'Create a release build and push to rubygems'
121
121
  task :release => :build do
122
122
  unless `git branch` =~ /master/
123
123
  puts "You must be on the master branch to release!"
124
124
  exit!
125
125
  end
126
+ Rake::Task[:changelog].execute
126
127
  sh "git commit --allow-empty -a -m 'Release #{version}'"
127
128
  sh "git pull --rebase origin master"
128
129
  sh "git tag v#{version}"
@@ -150,25 +151,23 @@ desc 'Update gemspec'
150
151
  task :gemspec => :validate do
151
152
  # read spec file and split out manifest section
152
153
  spec = File.read(gemspec_file)
153
- head, _manifest, tail = spec.split(" # = MANIFEST =\n")
154
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
154
155
 
155
- # replace name version and date
156
+ # replace name and version
156
157
  replace_header(head, :name)
157
- replace_header(head, :date)
158
- #comment this out if your rubyforge_project has a different name
159
- replace_header(head, :rubyforge_project)
158
+ replace_header(head, :version)
160
159
 
161
160
  # determine file list from git ls-files
162
161
  files = `git ls-files`.
163
162
  split("\n").
164
163
  sort.
165
164
  reject { |file| file =~ /^\./ }.
166
- reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes|Guardfile)/ }.
165
+ reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
167
166
  map { |file| " #{file}" }.
168
167
  join("\n")
169
168
 
170
169
  # piece file back together and write
171
- manifest = " s.files = %w(\n#{files}\n )\n"
170
+ manifest = " s.files = %w[\n#{files}\n ]\n"
172
171
  spec = [head, manifest, tail].join(" # = MANIFEST =\n")
173
172
  File.open(gemspec_file, 'w') { |io| io.write(spec) }
174
173
  puts "Updated #{gemspec_file}"
@@ -186,3 +185,61 @@ task :validate do
186
185
  exit!
187
186
  end
188
187
  end
188
+
189
+ desc 'Build changlog'
190
+ task :changelog do
191
+ [latest_changes_file, history_file].each do |f|
192
+ unless File.exists?(f)
193
+ puts "#{f} does not exist but is required to build a new release."
194
+ exit!
195
+ end
196
+ end
197
+
198
+ latest_changes = File.open(latest_changes_file)
199
+ version_pattern = "# #{version}"
200
+
201
+ if !`grep "#{version_pattern}" #{history_file}`.empty?
202
+ puts "#{version} is already described in #{history_file}"
203
+ exit!
204
+ end
205
+
206
+ begin
207
+ unless latest_changes.readline.chomp! =~ %r{#{version_pattern}}
208
+ puts "#{latest_changes_file} should begin with '#{version_pattern}'"
209
+ exit!
210
+ end
211
+ rescue EOFError
212
+ puts "#{latest_changes_file} is empty!"
213
+ exit!
214
+ end
215
+
216
+ body = latest_changes.read
217
+ body.scan(/\s*#\s+\d\.\d.*/) do |match|
218
+ puts "#{latest_changes_file} may not contain multiple markdown headers!"
219
+ exit!
220
+ end
221
+
222
+ temp = Tempfile.new
223
+ temp.puts("#{version_pattern} / #{date}\n#{body}\n\n")
224
+ temp.close
225
+ `cat #{history_file} >> #{temp.path}`
226
+ `cat #{temp.path} > #{history_file}`
227
+ end
228
+
229
+ desc 'Precompile assets'
230
+ task :precompile do
231
+ require './lib/gollum/app.rb'
232
+ Precious::App.set(:environment, :production)
233
+ env = Precious::Assets.sprockets
234
+ path = ENV.fetch('GOLLUM_ASSETS_PATH', ::File.join(File.dirname(__FILE__), 'lib/gollum/public/assets'))
235
+ manifest = Sprockets::Manifest.new(env, path)
236
+ Sprockets::Helpers.configure do |config|
237
+ config.environment = env
238
+ config.prefix = Precious::Assets::ASSET_URL
239
+ config.digest = true
240
+ config.public_path = path
241
+ config.manifest = manifest
242
+ end
243
+ puts "Precompiling assets to #{path}..."
244
+ manifest.compile(Precious::Assets::MANIFEST)
245
+ end
data/gemspec.rb CHANGED
@@ -1,16 +1,11 @@
1
1
  def specification(version, default_adapter, platform = nil)
2
2
  Proc.new do |s|
3
- s.specification_version = 2 if s.respond_to? :specification_version=
4
3
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
5
- s.rubygems_version = '0.0.1'
6
4
  s.required_ruby_version = '>= 2.4'
7
5
 
8
6
  s.name = 'gollum-lib'
9
7
  s.version = version
10
8
  s.platform = platform if platform
11
- s.date = '2021-09-06'
12
- s.date = '2017-04-13'
13
- s.rubyforge_project = 'gollum-lib'
14
9
  s.license = 'MIT'
15
10
 
16
11
  s.summary = 'A simple, Git-powered wiki.'
@@ -35,14 +30,14 @@ def specification(version, default_adapter, platform = nil)
35
30
  s.add_dependency 'twitter-text', '1.14.7'
36
31
 
37
32
  s.add_development_dependency 'org-ruby', '~> 0.9.9'
38
- s.add_development_dependency 'kramdown', '~> 2.3.0'
33
+ s.add_development_dependency 'kramdown', '~> 2.3'
39
34
  s.add_development_dependency 'kramdown-parser-gfm', '~> 1.1.0'
40
35
  s.add_development_dependency 'RedCloth', '~> 4.2.9'
41
36
  s.add_development_dependency 'mocha', '~> 1.11'
42
37
  s.add_development_dependency 'shoulda', '~> 4.0'
43
38
  s.add_development_dependency 'wikicloth', '~> 0.8.3'
44
39
  s.add_development_dependency 'bibtex-ruby', '~> 6.0'
45
- s.add_development_dependency 'citeproc-ruby', '~> 1.1'
40
+ s.add_development_dependency 'citeproc-ruby', '~> 2.0'
46
41
  s.add_development_dependency 'unicode_utils', '~> 1.4.0' # required by citeproc-ruby on ruby < 2.4
47
42
  s.add_development_dependency 'rake', '~> 13.0'
48
43
  s.add_development_dependency 'pry', '~> 0.13'
@@ -57,8 +52,9 @@ def specification(version, default_adapter, platform = nil)
57
52
  s.add_development_dependency 'twitter_cldr', '~> 6.4'
58
53
 
59
54
  # = MANIFEST =
60
- s.files = %w(
55
+ s.files = %w[
61
56
  Gemfile
57
+ Guardfile
62
58
  HISTORY.md
63
59
  LICENSE
64
60
  README.md
@@ -109,7 +105,7 @@ def specification(version, default_adapter, platform = nil)
109
105
  lib/gollum-lib/version.rb
110
106
  lib/gollum-lib/wiki.rb
111
107
  licenses/licenses.txt
112
- )
108
+ ]
113
109
  # = MANIFEST =
114
110
 
115
111
  s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
@@ -2,8 +2,21 @@
2
2
 
3
3
  # Code
4
4
  #
5
- # Render a block of code using the Rouge syntax-highlighter.
5
+ # Handle code blocks:
6
+ # - in the extractstep, extract them so they don't get rendered by the Render filter
7
+ # - in the process step, apply highlighting and wrapping and reinsert them into the document
8
+
6
9
  class Gollum::Filter::Code < Gollum::Filter
10
+
11
+ # The @language_handlers Hash can be filled with Regep keys and corresponding Proc values. The Procs will be executed to handle a codeblock whose language definition matches the key.
12
+ # See the Code Filter tests for an example
13
+ # Use the Gollum::Filter::Code.language_handlers method to access and modify this class instance variable
14
+ @language_handlers = {}
15
+
16
+ class << self
17
+ attr_accessor :language_handlers
18
+ end
19
+
7
20
  def extract(data)
8
21
  case @markup.format
9
22
  when :asciidoc
@@ -63,8 +76,14 @@ class Gollum::Filter::Code < Gollum::Filter
63
76
  blocks << [spec[:lang], code]
64
77
  end
65
78
 
66
- highlighted = []
79
+ wrapped_blocks = []
67
80
  blocks.each do |lang, code|
81
+
82
+ if (_pattern, proc = self.class.language_handlers.find { |pattern, _v| lang =~ pattern }) then
83
+ wrapped_blocks << proc.call(CGI.escape_html(lang), CGI.escape_html(code))
84
+ next
85
+ end
86
+
68
87
  encoding = @markup.encoding || 'utf-8'
69
88
 
70
89
  if defined? Pygments
@@ -95,12 +114,12 @@ class Gollum::Filter::Code < Gollum::Filter
95
114
  end
96
115
  end
97
116
 
98
- highlighted << hl_code
117
+ wrapped_blocks << hl_code
99
118
  end
100
119
 
101
120
  @map.each do |id, spec|
102
121
  body = spec[:output] || begin
103
- if (body = highlighted.shift.to_s).size > 0
122
+ if (body = wrapped_blocks.shift.to_s).size > 0
104
123
  @markup.update_cache(:code, id, body)
105
124
  body
106
125
  else
@@ -4,7 +4,7 @@ require 'octicons'
4
4
  # Replace specified tokens with dynamically generated content.
5
5
  class Gollum::Filter::Macro < Gollum::Filter
6
6
  def extract(data)
7
- quoted_arg = %r{".*?"}
7
+ quoted_arg = %r{".*?(?<!\\)"} # use a negative lookbehind to not terminate on a " preceeded by \
8
8
  unquoted_arg = %r{[^,)]+}
9
9
  named_arg = %r{[a-z0-9_]+=".*?"}
10
10
 
@@ -26,7 +26,7 @@ class Gollum::Filter::Macro < Gollum::Filter
26
26
  if argument =~ /^([a-z0-9_]+)="(.*?)"/
27
27
  opts[Regexp.last_match[1]] = Regexp.last_match[2]
28
28
  elsif argument =~ /^"(.*)"$/
29
- args << Regexp.last_match[1]
29
+ args << Regexp.last_match[1].gsub("\\\"", "\"")
30
30
  else
31
31
  args << argument
32
32
  end
@@ -69,7 +69,7 @@ class Gollum::Filter::PlantUML < Gollum::Filter
69
69
  # Extract all sequence diagram blocks into the map and replace with
70
70
  # placeholders.
71
71
  def extract(data)
72
- data.gsub(/(@startuml\r?\n.+?\r?\n@enduml\r?$)/m) do
72
+ data.gsub(/(@start(uml|json|yaml|salt|mindmap|wbs|math|latex)\r?\n.+?\r?\n@end\2\r?$)/m) do
73
73
  id = "#{open_pattern}#{Digest::SHA1.hexdigest($1)}#{close_pattern}"
74
74
  @map[id] = { :code => $1 }
75
75
  id
@@ -19,8 +19,11 @@ class Gollum::Filter::Render < Gollum::Filter
19
19
  end
20
20
 
21
21
  def process(data)
22
- data = add_editable_header_class(data)
23
- data
22
+ if @markup.wiki.allow_editing
23
+ add_editable_header_class(data)
24
+ else
25
+ data
26
+ end
24
27
  end
25
28
 
26
29
  private
@@ -125,7 +125,7 @@ class Gollum::Filter::TOC < Gollum::Filter
125
125
  # Creates an anchor element with the given name and adds it before
126
126
  # the given header element.
127
127
  def add_anchor_to_header(header, name)
128
- a = Nokogiri::XML::Node.new('a', @doc)
128
+ a = Nokogiri::XML::Node.new('a', @doc.document)
129
129
  a['class'] = 'anchor'
130
130
  a['id'] = name
131
131
  a['href'] = "##{name}"
@@ -143,9 +143,9 @@ class Gollum::Filter::TOC < Gollum::Filter
143
143
 
144
144
  if @tail_level < level
145
145
  while @tail_level < level
146
- list = Nokogiri::XML::Node.new('ul', @doc)
146
+ list = Nokogiri::XML::Node.new('ul', @doc.document)
147
147
  @tail.add_child(list)
148
- @tail = list.add_child(Nokogiri::XML::Node.new('li', @doc))
148
+ @tail = list.add_child(Nokogiri::XML::Node.new('li', @doc.document))
149
149
  @tail_level += 1
150
150
  end
151
151
  else
@@ -153,7 +153,7 @@ class Gollum::Filter::TOC < Gollum::Filter
153
153
  @tail = @tail.parent.parent
154
154
  @tail_level -= 1
155
155
  end
156
- @tail = @tail.parent.add_child(Nokogiri::XML::Node.new('li', @doc))
156
+ @tail = @tail.parent.add_child(Nokogiri::XML::Node.new('li', @doc.document))
157
157
  end
158
158
 
159
159
  # % -> %25 so anchors work on Firefox. See issue #475
@@ -1,5 +1,5 @@
1
1
  module Gollum
2
2
  module Lib
3
- VERSION = '5.1.3'
3
+ VERSION = '5.2'
4
4
  end
5
5
  end
@@ -57,6 +57,10 @@ module Gollum
57
57
  # Defaults to false
58
58
  attr_reader :css
59
59
 
60
+ # Whether or not content is editable.
61
+ # Defaults to true
62
+ attr_reader :allow_editing
63
+
60
64
  # Sets page title to value of first h1
61
65
  # Defaults to false
62
66
  attr_reader :h1_title
@@ -106,6 +110,7 @@ module Gollum
106
110
  # :bar_side - Where the sidebar should be displayed, may be:
107
111
  # - :left
108
112
  # - :right
113
+ # :allow_editing - Set whether wiki content can be edited. Default: true
109
114
  # :allow_uploads - Set to true to allow file uploads.
110
115
  # :per_page_uploads - Whether uploads should be stored in a central
111
116
  # 'uploads' directory, or in a directory named for
@@ -142,6 +147,7 @@ module Gollum
142
147
  @bar_side = options.fetch :sidebar, :right
143
148
  @user_icons = ['gravatar', 'identicon'].include?(options[:user_icons]) ?
144
149
  options[:user_icons] : 'none'
150
+ @allow_editing = options.fetch :allow_editing, true
145
151
  @allow_uploads = options.fetch :allow_uploads, false
146
152
  @per_page_uploads = options.fetch :per_page_uploads, false
147
153
  @metadata = options.fetch :metadata, {}
@@ -594,10 +600,10 @@ module Gollum
594
600
 
595
601
  # Enable 4.x compatibility behavior for links
596
602
  attr_reader :global_tag_lookup
597
-
603
+
598
604
  # Enable 4.x compatibility for case-case_insensitive links
599
605
  attr_reader :case_insensitive_tag_lookup
600
-
606
+
601
607
  # Spaces in tag paths are treated as dashes (-)
602
608
  attr_reader :hyphened_tag_lookup
603
609
 
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.1.3
4
+ version: '5.2'
5
5
  platform: java
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: 2017-04-13 00:00:00.000000000 Z
12
+ date: 2022-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gollum-rjgit_adapter
@@ -143,14 +143,14 @@ dependencies:
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 2.3.0
146
+ version: '2.3'
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.3.0
153
+ version: '2.3'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: kramdown-parser-gfm
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -241,14 +241,14 @@ dependencies:
241
241
  requirements:
242
242
  - - "~>"
243
243
  - !ruby/object:Gem::Version
244
- version: '1.1'
244
+ version: '2.0'
245
245
  type: :development
246
246
  prerelease: false
247
247
  version_requirements: !ruby/object:Gem::Requirement
248
248
  requirements:
249
249
  - - "~>"
250
250
  - !ruby/object:Gem::Version
251
- version: '1.1'
251
+ version: '2.0'
252
252
  - !ruby/object:Gem::Dependency
253
253
  name: unicode_utils
254
254
  requirement: !ruby/object:Gem::Requirement
@@ -398,6 +398,7 @@ extra_rdoc_files:
398
398
  - LICENSE
399
399
  files:
400
400
  - Gemfile
401
+ - Guardfile
401
402
  - HISTORY.md
402
403
  - LICENSE
403
404
  - README.md
@@ -470,6 +471,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
470
471
  requirements: []
471
472
  rubygems_version: 3.0.3
472
473
  signing_key:
473
- specification_version: 2
474
+ specification_version: 4
474
475
  summary: A simple, Git-powered wiki.
475
476
  test_files: []