gollum 3.0.0 → 3.1.0

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 (35) hide show
  1. checksums.yaml +13 -5
  2. data/HISTORY.md +14 -0
  3. data/README.md +15 -11
  4. data/bin/gollum +17 -4
  5. data/{openrc → contrib/openrc}/conf.d/gollum +0 -0
  6. data/{openrc → contrib/openrc}/init.d/gollum +0 -0
  7. data/contrib/systemd/gollum@.service +12 -0
  8. data/gollum.gemspec +9 -5
  9. data/lib/gollum.rb +1 -1
  10. data/lib/gollum/app.rb +44 -12
  11. data/lib/gollum/editing_auth.rb +34 -0
  12. data/lib/gollum/helpers.rb +12 -0
  13. data/lib/gollum/public/gollum/css/dialog.css +117 -15
  14. data/lib/gollum/public/gollum/css/editor.css +220 -62
  15. data/lib/gollum/public/gollum/css/gollum.css +139 -22
  16. data/lib/gollum/public/gollum/css/ie7.css +6 -0
  17. data/lib/gollum/public/gollum/css/template.css +56 -2
  18. data/lib/gollum/public/gollum/javascript/editor/gollum.editor.js +60 -0
  19. data/lib/gollum/public/gollum/javascript/editor/langs/asciidoc.js +26 -11
  20. data/lib/gollum/public/gollum/javascript/gollum.dialog.js +26 -4
  21. data/lib/gollum/templates/compare.mustache +16 -10
  22. data/lib/gollum/templates/editor.mustache +6 -2
  23. data/lib/gollum/templates/history.mustache +4 -2
  24. data/lib/gollum/templates/latest_changes.mustache +39 -0
  25. data/lib/gollum/templates/layout.mustache +14 -5
  26. data/lib/gollum/templates/page.mustache +30 -15
  27. data/lib/gollum/templates/pages.mustache +4 -3
  28. data/lib/gollum/views/compare.rb +1 -1
  29. data/lib/gollum/views/create.rb +8 -0
  30. data/lib/gollum/views/edit.rb +8 -0
  31. data/lib/gollum/views/history.rb +1 -1
  32. data/lib/gollum/views/latest_changes.rb +90 -0
  33. data/lib/gollum/views/page.rb +33 -11
  34. data/lib/gollum/views/pages.rb +6 -2
  35. metadata +38 -34
@@ -3,7 +3,7 @@ module Precious
3
3
  class History < Layout
4
4
  include HasPage
5
5
 
6
- attr_reader :page, :page_num
6
+ attr_reader :page, :page_num, :allow_editing
7
7
 
8
8
  def title
9
9
  @page.title
@@ -0,0 +1,90 @@
1
+ module Precious
2
+ module Views
3
+ class LatestChanges < Layout
4
+
5
+ attr_reader :wiki
6
+
7
+ def title
8
+ "Latest Changes (Globally)"
9
+ end
10
+
11
+ def versions
12
+ i = @versions.size + 1
13
+ @versions.map do |v|
14
+ i -= 1
15
+ { :id => v.id,
16
+ :id7 => v.id[0..6],
17
+ :num => i,
18
+ :author => v.author.name.respond_to?(:force_encoding) ? v.author.name.force_encoding('UTF-8') : v.author.name,
19
+ :message => v.message.respond_to?(:force_encoding) ? v.message.force_encoding('UTF-8') : v.message,
20
+ :date => v.authored_date.strftime("%B %d, %Y"),
21
+ :gravatar => Digest::MD5.hexdigest(v.author.email.strip.downcase),
22
+ :identicon => self._identicon_code(v.author.email),
23
+ :date_full => v.authored_date,
24
+ :files => v.stats.files.map { |f,*rest|
25
+ page_path = extract_renamed_path_destination(f)
26
+ page_path = remove_page_extentions(page_path)
27
+ { :file => f,
28
+ :link => "#{page_path}/#{v.id}"
29
+ }
30
+ }
31
+ }
32
+ end
33
+ end
34
+
35
+ def remove_page_extentions(page_path)
36
+ Gollum::Markup.formats.values.each do |format|
37
+ page_path = page_path.gsub(/\.#{format[:regexp]}$/, '')
38
+ end
39
+ return page_path
40
+ end
41
+
42
+ def extract_renamed_path_destination(file)
43
+ return file.gsub(/{.* => (.*)}/, '\1').gsub(/.* => (.*)/, '\1')
44
+ end
45
+
46
+ # http://stackoverflow.com/questions/9445760/bit-shifting-in-ruby
47
+ def left_shift(int, shift)
48
+ r = ((int & 0xFF) << (shift & 0x1F)) & 0xFFFFFFFF
49
+ # 1>>31, 2**32
50
+ (r & 2147483648) == 0 ? r : r - 4294967296
51
+ end
52
+
53
+ def string_to_code(string)
54
+ # sha bytes
55
+ b = [Digest::SHA1.hexdigest(string)[0, 20]].pack('H*').bytes.to_a
56
+ # Thanks donpark's IdenticonUtil.java for this.
57
+ # Match the following Java code
58
+ # ((b[0] & 0xFF) << 24) | ((b[1] & 0xFF) << 16) |
59
+ # ((b[2] & 0xFF) << 8) | (b[3] & 0xFF)
60
+
61
+ return left_shift(b[0], 24) |
62
+ left_shift(b[1], 16) |
63
+ left_shift(b[2], 8) |
64
+ b[3] & 0xFF
65
+ end
66
+
67
+ def _identicon_code(blob)
68
+ string_to_code blob + @request.host
69
+ end
70
+
71
+ def use_identicon
72
+ @wiki.user_icons == 'identicon'
73
+ end
74
+
75
+ def partial(name)
76
+ if name == :author_template
77
+ self.class.partial("history_authors/#{@wiki.user_icons}")
78
+ else
79
+ super
80
+ end
81
+ end
82
+
83
+ def previous_link
84
+ end
85
+
86
+ def next_link
87
+ end
88
+ end
89
+ end
90
+ end
@@ -14,7 +14,7 @@ module Precious
14
14
  end
15
15
 
16
16
  def page_header
17
- page_header_from_content(@content) || title
17
+ title
18
18
  end
19
19
 
20
20
  def content
@@ -47,6 +47,10 @@ module Precious
47
47
  @page_exists
48
48
  end
49
49
 
50
+ def allow_editing
51
+ @allow_editing
52
+ end
53
+
50
54
  def allow_uploads
51
55
  @allow_uploads
52
56
  end
@@ -56,8 +60,12 @@ module Precious
56
60
  end
57
61
 
58
62
  def has_header
59
- @header = (@page.header || false) if @header.nil?
60
- !!@header
63
+ if @header
64
+ @header.formatted_data.strip.empty? ? false : true
65
+ else
66
+ @header = (@page.header || false)
67
+ !!@header
68
+ end
61
69
  end
62
70
 
63
71
  def header_content
@@ -69,8 +77,12 @@ module Precious
69
77
  end
70
78
 
71
79
  def has_footer
72
- @footer = (@page.footer || false) if @footer.nil?
73
- !!@footer
80
+ if @footer
81
+ @footer.formatted_data.strip.empty? ? false : true
82
+ else
83
+ @footer = (@page.footer || false)
84
+ !!@footer
85
+ end
74
86
  end
75
87
 
76
88
  def footer_content
@@ -86,8 +98,12 @@ module Precious
86
98
  end
87
99
 
88
100
  def has_sidebar
89
- @sidebar = (@page.sidebar || false) if @sidebar.nil?
90
- !!@sidebar
101
+ if @sidebar
102
+ @sidebar.formatted_data.strip.empty? ? false : true
103
+ else
104
+ @sidebar = (@page.sidebar || false)
105
+ !!@sidebar
106
+ end
91
107
  end
92
108
 
93
109
  def sidebar_content
@@ -110,6 +126,10 @@ module Precious
110
126
  @mathjax
111
127
  end
112
128
 
129
+ def mathjax_config
130
+ @mathjax_config
131
+ end
132
+
113
133
  def use_identicon
114
134
  @page.wiki.user_icons == 'identicon'
115
135
  end
@@ -138,7 +158,7 @@ module Precious
138
158
  def find_header_node(doc)
139
159
  case @page.format
140
160
  when :asciidoc
141
- doc.css("div#gollum-root > div#header > h1:first-child")
161
+ doc.css("div#gollum-root > h1:first-child")
142
162
  when :org
143
163
  doc.css("div#gollum-root > p.title:first-child")
144
164
  when :pod
@@ -162,9 +182,11 @@ module Precious
162
182
  # Returns page content without title if it was extracted.
163
183
  #
164
184
  def content_without_page_header(content)
165
- doc = build_document(content)
166
- title = find_header_node(doc)
167
- title.remove unless title.empty?
185
+ doc = build_document(content)
186
+ if @h1_title
187
+ title = find_header_node(doc)
188
+ title.remove unless title.empty?
189
+ end
168
190
  # .inner_html will cause href escaping on UTF-8
169
191
  doc.css("div#gollum-root").children.to_xml(@@to_xml)
170
192
  end
@@ -3,7 +3,7 @@ require "pathname"
3
3
  module Precious
4
4
  module Views
5
5
  class Pages < Layout
6
- attr_reader :results, :ref
6
+ attr_reader :results, :ref, :allow_editing
7
7
 
8
8
  def title
9
9
  "All pages in #{@ref}"
@@ -47,7 +47,11 @@ module Precious
47
47
  folder_link
48
48
  end
49
49
  elsif page_path != ".gitkeep"
50
- %{<li><a href="#{@base_url}/#{page.escaped_url_path}" class="file">#{page.name}</a></li>}
50
+ if defined? page.format
51
+ %{<li><a href="#{@base_url}/#{page.escaped_url_path}" class="file">#{page.name}</a></li>}
52
+ else
53
+ %{<li><a href="#{@base_url}/#{page.escaped_url_path}#{page.name}" class="file">#{page.name}</a></li>}
54
+ end
51
55
  end
52
56
  }.compact.join("\n")
53
57
  else
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: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,158 +9,158 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-05 00:00:00.000000000 Z
12
+ date: 2014-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gollum-lib
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: '3.0'
20
+ version: '4.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: '3.0'
27
+ version: '4.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: github-markdown
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.6.5
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.6.5
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: sinatra
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.4'
49
- - - ">="
49
+ - - ! '>='
50
50
  - !ruby/object:Gem::Version
51
51
  version: 1.4.4
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - "~>"
56
+ - - ~>
57
57
  - !ruby/object:Gem::Version
58
58
  version: '1.4'
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.4.4
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: mustache
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.99.5
69
- - - "<"
69
+ - - <
70
70
  - !ruby/object:Gem::Version
71
71
  version: 1.0.0
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ">="
76
+ - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: 0.99.5
79
- - - "<"
79
+ - - <
80
80
  - !ruby/object:Gem::Version
81
81
  version: 1.0.0
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: useragent
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - ~>
87
87
  - !ruby/object:Gem::Version
88
88
  version: 0.10.0
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - "~>"
93
+ - - ~>
94
94
  - !ruby/object:Gem::Version
95
95
  version: 0.10.0
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: rack-test
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - "~>"
100
+ - - ~>
101
101
  - !ruby/object:Gem::Version
102
102
  version: 0.6.2
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - "~>"
107
+ - - ~>
108
108
  - !ruby/object:Gem::Version
109
109
  version: 0.6.2
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: shoulda
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - "~>"
114
+ - - ~>
115
115
  - !ruby/object:Gem::Version
116
116
  version: 3.5.0
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - "~>"
121
+ - - ~>
122
122
  - !ruby/object:Gem::Version
123
123
  version: 3.5.0
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: minitest-reporters
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - ~>
129
129
  - !ruby/object:Gem::Version
130
130
  version: 0.14.16
131
131
  type: :development
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - "~>"
135
+ - - ~>
136
136
  - !ruby/object:Gem::Version
137
137
  version: 0.14.16
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: twitter_cldr
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - "~>"
142
+ - - ~>
143
143
  - !ruby/object:Gem::Version
144
144
  version: 2.4.2
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - "~>"
149
+ - - ~>
150
150
  - !ruby/object:Gem::Version
151
151
  version: 2.4.2
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: mocha
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - "~>"
156
+ - - ~>
157
157
  - !ruby/object:Gem::Version
158
158
  version: 1.0.0
159
159
  type: :development
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - "~>"
163
+ - - ~>
164
164
  - !ruby/object:Gem::Version
165
165
  version: 1.0.0
166
166
  description: A simple, Git-powered wiki with a sweet API and local frontend.
@@ -179,10 +179,14 @@ files:
179
179
  - Rakefile
180
180
  - bin/gollum
181
181
  - config.rb
182
+ - contrib/openrc/conf.d/gollum
183
+ - contrib/openrc/init.d/gollum
184
+ - contrib/systemd/gollum@.service
182
185
  - docs/sanitization.md
183
186
  - gollum.gemspec
184
187
  - lib/gollum.rb
185
188
  - lib/gollum/app.rb
189
+ - lib/gollum/editing_auth.rb
186
190
  - lib/gollum/helpers.rb
187
191
  - lib/gollum/public/gollum/css/_styles.css
188
192
  - lib/gollum/public/gollum/css/dialog.css
@@ -651,6 +655,7 @@ files:
651
655
  - lib/gollum/templates/history_authors/gravatar.mustache
652
656
  - lib/gollum/templates/history_authors/identicon.mustache
653
657
  - lib/gollum/templates/history_authors/none.mustache
658
+ - lib/gollum/templates/latest_changes.mustache
654
659
  - lib/gollum/templates/layout.mustache
655
660
  - lib/gollum/templates/page.mustache
656
661
  - lib/gollum/templates/pages.mustache
@@ -665,6 +670,7 @@ files:
665
670
  - lib/gollum/views/file_view.rb
666
671
  - lib/gollum/views/has_page.rb
667
672
  - lib/gollum/views/history.rb
673
+ - lib/gollum/views/latest_changes.rb
668
674
  - lib/gollum/views/layout.rb
669
675
  - lib/gollum/views/page.rb
670
676
  - lib/gollum/views/pages.rb
@@ -672,30 +678,28 @@ files:
672
678
  - licenses/css_tree_menu_thecssninja/license.txt
673
679
  - licenses/licenses.txt
674
680
  - licenses/unity_asset_pool/COPYRIGHT
675
- - openrc/conf.d/gollum
676
- - openrc/init.d/gollum
677
681
  homepage: http://github.com/gollum/gollum
678
682
  licenses:
679
683
  - MIT
680
684
  metadata: {}
681
685
  post_install_message:
682
686
  rdoc_options:
683
- - "--charset=UTF-8"
687
+ - --charset=UTF-8
684
688
  require_paths:
685
689
  - lib
686
690
  required_ruby_version: !ruby/object:Gem::Requirement
687
691
  requirements:
688
- - - ">="
692
+ - - ! '>='
689
693
  - !ruby/object:Gem::Version
690
694
  version: '1.9'
691
695
  required_rubygems_version: !ruby/object:Gem::Requirement
692
696
  requirements:
693
- - - ">="
697
+ - - ! '>='
694
698
  - !ruby/object:Gem::Version
695
699
  version: '0'
696
700
  requirements: []
697
701
  rubyforge_project: gollum
698
- rubygems_version: 2.2.2
702
+ rubygems_version: 2.4.1
699
703
  signing_key:
700
704
  specification_version: 2
701
705
  summary: A simple, Git-powered wiki.