gitlab-gollum-lib 1.1.0 → 4.2.7
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 +4 -4
- data/Gemfile +1 -3
- data/HISTORY.md +25 -0
- data/LICENSE +1 -1
- data/README.md +24 -312
- data/Rakefile +32 -16
- data/gemspec.rb +110 -0
- data/gollum-lib.gemspec +8 -75
- data/gollum-lib_java.gemspec +4 -0
- data/lib/gollum-lib.rb +18 -6
- data/lib/gollum-lib/blob_entry.rb +10 -9
- data/lib/gollum-lib/committer.rb +37 -30
- data/lib/gollum-lib/file.rb +71 -15
- data/lib/gollum-lib/file_view.rb +53 -48
- data/lib/gollum-lib/filter.rb +78 -0
- data/lib/gollum-lib/filter/code.rb +145 -0
- data/lib/gollum-lib/filter/emoji.rb +39 -0
- data/lib/gollum-lib/filter/macro.rb +57 -0
- data/lib/gollum-lib/filter/metadata.rb +29 -0
- data/lib/gollum-lib/filter/plain_text.rb +16 -0
- data/lib/gollum-lib/filter/plantuml.rb +176 -0
- data/lib/gollum-lib/filter/remote_code.rb +63 -0
- data/lib/gollum-lib/filter/render.rb +20 -0
- data/lib/gollum-lib/filter/sanitize.rb +18 -0
- data/lib/gollum-lib/filter/tags.rb +327 -0
- data/lib/gollum-lib/filter/toc.rb +134 -0
- data/lib/gollum-lib/filter/wsd.rb +54 -0
- data/lib/gollum-lib/git_access.rb +30 -32
- data/lib/gollum-lib/gitcode.rb +16 -16
- data/lib/gollum-lib/helpers.rb +3 -3
- data/lib/gollum-lib/hook.rb +35 -0
- data/lib/gollum-lib/macro.rb +43 -0
- data/lib/gollum-lib/macro/all_pages.rb +11 -0
- data/lib/gollum-lib/macro/global_toc.rb +12 -0
- data/lib/gollum-lib/macro/navigation.rb +20 -0
- data/lib/gollum-lib/macro/series.rb +48 -0
- data/lib/gollum-lib/markup.rb +95 -572
- data/lib/gollum-lib/markups.rb +9 -3
- data/lib/gollum-lib/page.rb +109 -80
- data/lib/gollum-lib/pagination.rb +1 -1
- data/lib/gollum-lib/sanitization.rb +75 -75
- data/lib/gollum-lib/version.rb +5 -0
- data/lib/gollum-lib/wiki.rb +287 -129
- metadata +237 -92
- data/CHANGELOG +0 -2
- data/VERSION +0 -1
- data/lib/gollum-lib/grit_ext.rb +0 -20
- data/lib/gollum-lib/remote_code.rb +0 -39
- data/lib/gollum-lib/web_sequence_diagram.rb +0 -44
data/CHANGELOG
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.1.0
|
data/lib/gollum-lib/grit_ext.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# ~*~ encoding: utf-8 ~*~
|
2
|
-
|
3
|
-
module Grit
|
4
|
-
class Blob
|
5
|
-
def is_symlink
|
6
|
-
self.mode == 0120000
|
7
|
-
end
|
8
|
-
|
9
|
-
def symlink_target(base_path = nil)
|
10
|
-
target = self.data
|
11
|
-
new_path = File.expand_path(File.join('..', target), base_path)
|
12
|
-
|
13
|
-
if File.file? new_path
|
14
|
-
return new_path
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
nil
|
19
|
-
end
|
20
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# ~*~ encoding: utf-8 ~*~
|
2
|
-
require 'net/http'
|
3
|
-
require 'net/https' # ruby 1.8.7 fix, remove at upgrade
|
4
|
-
require 'uri'
|
5
|
-
require 'open-uri'
|
6
|
-
|
7
|
-
module Gollum
|
8
|
-
class RemoteCode
|
9
|
-
def initialize path
|
10
|
-
raise(ArgumentError, 'path is nil or empty') if path.nil? or path.empty?
|
11
|
-
@uri = URI(path)
|
12
|
-
end
|
13
|
-
|
14
|
-
def contents
|
15
|
-
@contents ||= req @uri
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def req uri, cut = 1
|
21
|
-
return "Too many redirects or retries" if cut >= 10
|
22
|
-
http = Net::HTTP.new uri.host, uri.port
|
23
|
-
http.use_ssl = true
|
24
|
-
resp = http.get uri.path, {
|
25
|
-
'Accept' => 'text/plain',
|
26
|
-
'Cache-Control' => 'no-cache',
|
27
|
-
'Connection' => 'keep-alive',
|
28
|
-
'User-Agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0'
|
29
|
-
}
|
30
|
-
code = resp.code.to_i
|
31
|
-
return resp.body if code == 200
|
32
|
-
return "Not Found" if code == 404
|
33
|
-
return "Unhandled Response Code #{code}" unless code == 304 or not resp.header['location'].nil?
|
34
|
-
loc = URI.parse resp.header['location']
|
35
|
-
uri2 = loc.relative? ? (uri + loc) : loc # overloads (+)
|
36
|
-
req uri2, (cut + 1)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# ~*~ encoding: utf-8 ~*~
|
2
|
-
require 'net/http'
|
3
|
-
require 'uri'
|
4
|
-
require 'open-uri'
|
5
|
-
|
6
|
-
class Gollum::WebSequenceDiagram
|
7
|
-
WSD_URL = "http://www.websequencediagrams.com/index.php"
|
8
|
-
|
9
|
-
# Initialize a new WebSequenceDiagram object.
|
10
|
-
#
|
11
|
-
# code - The String containing the sequence diagram markup.
|
12
|
-
# style - The String containing the rendering style.
|
13
|
-
#
|
14
|
-
# Returns a new Gollum::WebSequenceDiagram object
|
15
|
-
def initialize(code, style)
|
16
|
-
@code = code
|
17
|
-
@style = style
|
18
|
-
@tag = ""
|
19
|
-
|
20
|
-
render
|
21
|
-
end
|
22
|
-
|
23
|
-
# Render the sequence diagram on the remote server and store the url to
|
24
|
-
# the rendered image.
|
25
|
-
#
|
26
|
-
# Returns nil.
|
27
|
-
def render
|
28
|
-
response = Net::HTTP.post_form(URI.parse(WSD_URL), 'style' => @style, 'message' => @code)
|
29
|
-
if response.body =~ /img: "(.+)"/
|
30
|
-
url = "http://www.websequencediagrams.com/#{$1}"
|
31
|
-
@tag = "<img src=\"#{url}\" />"
|
32
|
-
else
|
33
|
-
puts response.body
|
34
|
-
@tag ="Sorry, unable to render sequence diagram at this time."
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Gets the HTML IMG tag for the sequence diagram.
|
39
|
-
#
|
40
|
-
# Returns a String containing the IMG tag.
|
41
|
-
def to_tag
|
42
|
-
@tag
|
43
|
-
end
|
44
|
-
end
|