gitlab_kramdown 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +4 -1
- data/lib/gitlab_kramdown.rb +1 -0
- data/lib/gitlab_kramdown/parser/reference.rb +18 -17
- data/lib/gitlab_kramdown/version.rb +5 -0
- metadata +24 -29
- data/.document +0 -5
- data/.gitlab-ci.yml +0 -28
- data/.rubocop.yml +0 -28
- data/.ruby-version +0 -1
- data/CHANGELOG.md +0 -36
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -103
- data/Rakefile +0 -52
- data/VERSION +0 -1
- data/gitlab_kramdown.gemspec +0 -96
- data/spec/fixtures/autolink.html +0 -21
- data/spec/fixtures/autolink.text +0 -18
- data/spec/fixtures/code_highlight.html +0 -18
- data/spec/fixtures/code_highlight.text +0 -20
- data/spec/fixtures/header.html +0 -12
- data/spec/fixtures/header.linkable_headers.html +0 -12
- data/spec/fixtures/header.text +0 -14
- data/spec/fixtures/multi_blockquote.html +0 -13
- data/spec/fixtures/multi_blockquote.text +0 -13
- data/spec/fixtures/references.html +0 -19
- data/spec/fixtures/references.text +0 -19
- data/spec/integration/parser_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -20
- data/spec/support/fixtures.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d97e30917ac631afb70c1e37fb2d807279604195fd538a5093620ca087d2b6fe
|
4
|
+
data.tar.gz: 9895d7ffa9284ebcd9edbb892b726f0e038a727e545191d6128256071d069aff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8704fb0267233b71c4dd3ca5a147b637a14b0d0dde02e9cedb3047bdda6de5941c05302186e31821b1dd6feb617e8fc892055930adcd94beb6fffef9e5e55d4
|
7
|
+
data.tar.gz: 0eea8586e745f4c57b910e23d991a35514a4289105d25ca0d129be7c673a9fa60b18d67dd4b02acaa46918946a89733ddc6ef69a2b247774594fae32cdb6b4c4
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# GitLab Kramdown
|
2
2
|
|
3
|
-
This is an
|
3
|
+
This is an official gem that implements [GitLab flavored Markdown] extensions on top of [Kramdown].
|
4
|
+
|
5
|
+
> **Note**: This is not the same code that runs on GitLab. The [GitLab flavored Markdown] runs on top of
|
6
|
+
CommonMark with extensions implemented inside the Rails application.
|
4
7
|
|
5
8
|
## GitLab Flavored Markdown extensions support
|
6
9
|
|
data/lib/gitlab_kramdown.rb
CHANGED
@@ -9,11 +9,12 @@ module GitlabKramdown
|
|
9
9
|
#
|
10
10
|
# @see https://docs.gitlab.com/ee/user/markdown.html#special-gitlab-references
|
11
11
|
module Reference
|
12
|
-
PATH_REGEX = /[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]
|
12
|
+
PATH_REGEX = /[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]+/
|
13
13
|
|
14
14
|
NAMESPACE_FORMAT_REGEX = %r{
|
15
|
-
(?:#{PATH_REGEX}[a-zA-Z0-9_\-]
|
15
|
+
(?:#{PATH_REGEX}[a-zA-Z0-9_\-])
|
16
16
|
(?<!\.git|\.atom)
|
17
|
+
|[a-zA-Z0-9_]
|
17
18
|
}x
|
18
19
|
|
19
20
|
FULL_NAMESPACE_FORMAT_REGEX = %r{(#{NAMESPACE_FORMAT_REGEX}/)*#{NAMESPACE_FORMAT_REGEX}}
|
@@ -27,38 +28,38 @@ module GitlabKramdown
|
|
27
28
|
PROJECT_COMMIT_PATTERN = %r{
|
28
29
|
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
29
30
|
#{Regexp.escape('@')}
|
30
|
-
(?<commit>[a-
|
31
|
+
(?<commit>[a-f0-9]{7,40})
|
31
32
|
(?!\.{3})
|
32
33
|
}x
|
33
34
|
|
34
35
|
PROJECT_COMMIT_DIFF_PATTERN = %r{
|
35
|
-
(?<namespace>#{
|
36
|
+
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
36
37
|
#{Regexp.escape('@')}
|
37
|
-
(?<commit_source>[a-f0-9]
|
38
|
+
(?<commit_source>[a-f0-9]{7,40})
|
38
39
|
\.{3}
|
39
|
-
(?<commit_target>[a-f0-9]
|
40
|
+
(?<commit_target>[a-f0-9]{7,40})
|
40
41
|
}x
|
41
42
|
|
42
43
|
PROJECT_ISSUE_PATTERN = %r{
|
43
|
-
(?<namespace>#{
|
44
|
+
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
44
45
|
#{Regexp.escape('#')}
|
45
46
|
(?<issue>[1-9][0-9]*)
|
46
47
|
}x
|
47
48
|
|
48
49
|
PROJECT_MERGE_REQUEST_PATTERN = %r{
|
49
|
-
(?<namespace>#{
|
50
|
+
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
50
51
|
#{Regexp.escape('!')}
|
51
52
|
(?<merge_request>[1-9][0-9]*)
|
52
53
|
}x
|
53
54
|
|
54
55
|
PROJECT_SNIPPET_PATTERN = %r{
|
55
|
-
(?<namespace>#{
|
56
|
+
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
56
57
|
#{Regexp.escape('$')}
|
57
58
|
(?<snippet>[1-9][0-9]*)
|
58
59
|
}x
|
59
60
|
|
60
61
|
PROJECT_LABEL_PATTERN = %r{
|
61
|
-
(?<namespace>#{
|
62
|
+
(?<namespace>#{ALWAYS_FULL_NAMESPACE_FORMAT_REGEX})
|
62
63
|
#{Regexp.escape('~')}
|
63
64
|
(?<label>
|
64
65
|
[A-Za-z0-9_\-\?\.&]+ | # String-based single-word label title, or
|
@@ -67,13 +68,13 @@ module GitlabKramdown
|
|
67
68
|
}x
|
68
69
|
|
69
70
|
def self.included(klass)
|
70
|
-
klass.define_parser(:user_group_mention, USER_GROUP_PATTERN)
|
71
|
-
klass.define_parser(:commit, PROJECT_COMMIT_PATTERN)
|
72
|
-
klass.define_parser(:commit_diff, PROJECT_COMMIT_DIFF_PATTERN)
|
73
|
-
klass.define_parser(:issue, PROJECT_ISSUE_PATTERN)
|
74
|
-
klass.define_parser(:merge_request, PROJECT_MERGE_REQUEST_PATTERN)
|
75
|
-
klass.define_parser(:snippet, PROJECT_SNIPPET_PATTERN)
|
76
|
-
klass.define_parser(:label, PROJECT_LABEL_PATTERN)
|
71
|
+
klass.define_parser(:user_group_mention, USER_GROUP_PATTERN, '@')
|
72
|
+
klass.define_parser(:commit, PROJECT_COMMIT_PATTERN, '@')
|
73
|
+
klass.define_parser(:commit_diff, PROJECT_COMMIT_DIFF_PATTERN, '@')
|
74
|
+
klass.define_parser(:issue, PROJECT_ISSUE_PATTERN, '#')
|
75
|
+
klass.define_parser(:merge_request, PROJECT_MERGE_REQUEST_PATTERN, '\!')
|
76
|
+
klass.define_parser(:snippet, PROJECT_SNIPPET_PATTERN, '\$')
|
77
|
+
klass.define_parser(:label, PROJECT_LABEL_PATTERN, '\~')
|
77
78
|
end
|
78
79
|
|
79
80
|
def parse_user_group_mention
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_kramdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Mazetto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kramdown
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: benchmark-ips
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.7'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.7'
|
125
139
|
description: GitLab Flavored Markdown extensions on top of Kramdown markup. Tries
|
126
140
|
to be as close as possible to existing extensions.
|
127
141
|
email: brodock@gmail.com
|
@@ -131,18 +145,8 @@ extra_rdoc_files:
|
|
131
145
|
- LICENSE.txt
|
132
146
|
- README.md
|
133
147
|
files:
|
134
|
-
- ".document"
|
135
|
-
- ".gitlab-ci.yml"
|
136
|
-
- ".rubocop.yml"
|
137
|
-
- ".ruby-version"
|
138
|
-
- CHANGELOG.md
|
139
|
-
- Gemfile
|
140
|
-
- Gemfile.lock
|
141
148
|
- LICENSE.txt
|
142
149
|
- README.md
|
143
|
-
- Rakefile
|
144
|
-
- VERSION
|
145
|
-
- gitlab_kramdown.gemspec
|
146
150
|
- lib/gitlab_kramdown.rb
|
147
151
|
- lib/gitlab_kramdown/parser.rb
|
148
152
|
- lib/gitlab_kramdown/parser/autolink.rb
|
@@ -150,25 +154,16 @@ files:
|
|
150
154
|
- lib/gitlab_kramdown/parser/fenced_codeblock.rb
|
151
155
|
- lib/gitlab_kramdown/parser/header.rb
|
152
156
|
- lib/gitlab_kramdown/parser/reference.rb
|
157
|
+
- lib/gitlab_kramdown/version.rb
|
153
158
|
- lib/kramdown/parser/gitlab_kramdown.rb
|
154
|
-
|
155
|
-
- spec/fixtures/autolink.text
|
156
|
-
- spec/fixtures/code_highlight.html
|
157
|
-
- spec/fixtures/code_highlight.text
|
158
|
-
- spec/fixtures/header.html
|
159
|
-
- spec/fixtures/header.linkable_headers.html
|
160
|
-
- spec/fixtures/header.text
|
161
|
-
- spec/fixtures/multi_blockquote.html
|
162
|
-
- spec/fixtures/multi_blockquote.text
|
163
|
-
- spec/fixtures/references.html
|
164
|
-
- spec/fixtures/references.text
|
165
|
-
- spec/integration/parser_spec.rb
|
166
|
-
- spec/spec_helper.rb
|
167
|
-
- spec/support/fixtures.rb
|
168
|
-
homepage: http://gitlab.com/brodock/gitlab_kramdown
|
159
|
+
homepage: http://gitlab.com/gitlab-org/gitlab_kramdown
|
169
160
|
licenses:
|
170
161
|
- MIT
|
171
|
-
metadata:
|
162
|
+
metadata:
|
163
|
+
bug_tracker_uri: http://gitlab.com/gitlab-org/gitlab_kramdown/issues
|
164
|
+
changelog_uri: http://gitlab.com/gitlab-org/gitlab_kramdown/blob/master/CHANGELOG.md
|
165
|
+
homepage_uri: http://gitlab.com/gitlab-org/gitlab_kramdown
|
166
|
+
source_code_uri: http://gitlab.com/gitlab-org/gitlab_kramdown
|
172
167
|
post_install_message:
|
173
168
|
rdoc_options: []
|
174
169
|
require_paths:
|
@@ -185,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
180
|
version: '0'
|
186
181
|
requirements: []
|
187
182
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.
|
183
|
+
rubygems_version: 2.7.7
|
189
184
|
signing_key:
|
190
185
|
specification_version: 4
|
191
186
|
summary: GitLab Flavored Kramdown
|
data/.document
DELETED
data/.gitlab-ci.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
image: "ruby:2.4"
|
2
|
-
|
3
|
-
# Cache gems in between builds
|
4
|
-
cache: &cache
|
5
|
-
paths:
|
6
|
-
- vendor/ruby
|
7
|
-
key: 'ruby2.4'
|
8
|
-
|
9
|
-
before_script:
|
10
|
-
- ruby -v # Print out ruby version for debugging
|
11
|
-
- gem install bundler --no-ri --no-rdoc # Bundler is not installed with the image
|
12
|
-
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
13
|
-
|
14
|
-
rubocop:
|
15
|
-
script:
|
16
|
-
- rubocop
|
17
|
-
|
18
|
-
rspec ruby2.4:
|
19
|
-
script:
|
20
|
-
- rake spec
|
21
|
-
|
22
|
-
rspec ruby2.5:
|
23
|
-
image: "ruby:2.5"
|
24
|
-
cache:
|
25
|
-
<<: *cache
|
26
|
-
key: 'ruby2.5'
|
27
|
-
script:
|
28
|
-
- rake spec
|
data/.rubocop.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- '**/Rakefile'
|
4
|
-
- 'Gemfile'
|
5
|
-
- 'vendor/**/**'
|
6
|
-
- '*.gemspec'
|
7
|
-
Layout/IndentArray:
|
8
|
-
EnforcedStyle: consistent
|
9
|
-
Lint/InterpolationCheck:
|
10
|
-
Enabled: false
|
11
|
-
Metrics/BlockLength:
|
12
|
-
Exclude:
|
13
|
-
- 'spec/**/**'
|
14
|
-
Metrics/LineLength:
|
15
|
-
Max: 120
|
16
|
-
Metrics/MethodLength:
|
17
|
-
Enabled: false
|
18
|
-
Metrics/ModuleLength:
|
19
|
-
Enabled: false
|
20
|
-
Metrics/AbcSize:
|
21
|
-
Max: 30
|
22
|
-
Style/FrozenStringLiteralComment:
|
23
|
-
Exclude:
|
24
|
-
- 'spec/**/**'
|
25
|
-
Style/RegexpLiteral:
|
26
|
-
EnforcedStyle: mixed
|
27
|
-
Style/ParallelAssignment:
|
28
|
-
Enabled: false
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-2.4.3
|
data/CHANGELOG.md
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# Changelog
|
2
|
-
All notable changes to this project will be documented in this file.
|
3
|
-
|
4
|
-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
|
-
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
|
-
|
7
|
-
## [Unreleased]
|
8
|
-
|
9
|
-
## [0.4.0] - 2018-04-12
|
10
|
-
### Added
|
11
|
-
- URL auto-linking support
|
12
|
-
|
13
|
-
### Changed
|
14
|
-
- Fixed many inconsistencies in references autolink
|
15
|
-
|
16
|
-
## [0.3.0] - 2018-03-23
|
17
|
-
### Added
|
18
|
-
- Headers will include by default an anchor tag (you can disable with `linkable_headers: false`)
|
19
|
-
|
20
|
-
### Changed
|
21
|
-
- Fixed multiline blockquote delimiter
|
22
|
-
- GitLab URL is not customizable with `gitlab_url: 'http://yourcustomgitlab.com'`
|
23
|
-
|
24
|
-
## [0.2.0] - 2018-03-19
|
25
|
-
### Added
|
26
|
-
- Syntax highlighter uses ``` or ~~~
|
27
|
-
|
28
|
-
### Changed
|
29
|
-
- Requires Ruby 2.4
|
30
|
-
- Requires rouge `~> 3.0`
|
31
|
-
|
32
|
-
## [0.1.0] - 2018-03-17
|
33
|
-
### Added
|
34
|
-
- The initial version of the Gem
|
35
|
-
- Special GitLab References
|
36
|
-
- Multiline Blockquote
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.5.2)
|
5
|
-
public_suffix (>= 2.0.2, < 4.0)
|
6
|
-
ast (2.4.0)
|
7
|
-
builder (3.2.3)
|
8
|
-
descendants_tracker (0.0.4)
|
9
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
10
|
-
diff-lcs (1.3)
|
11
|
-
docile (1.1.5)
|
12
|
-
faraday (0.12.2)
|
13
|
-
multipart-post (>= 1.2, < 3)
|
14
|
-
git (1.3.0)
|
15
|
-
github_api (0.18.2)
|
16
|
-
addressable (~> 2.4)
|
17
|
-
descendants_tracker (~> 0.0.4)
|
18
|
-
faraday (~> 0.8)
|
19
|
-
hashie (~> 3.5, >= 3.5.2)
|
20
|
-
oauth2 (~> 1.0)
|
21
|
-
hashie (3.5.7)
|
22
|
-
highline (1.7.10)
|
23
|
-
json (1.8.6)
|
24
|
-
juwelier (2.1.3)
|
25
|
-
builder
|
26
|
-
bundler (>= 1.13)
|
27
|
-
git (>= 1.2.5)
|
28
|
-
github_api
|
29
|
-
highline (>= 1.6.15)
|
30
|
-
nokogiri (>= 1.5.10)
|
31
|
-
rake
|
32
|
-
rdoc
|
33
|
-
semver
|
34
|
-
jwt (1.5.6)
|
35
|
-
kramdown (1.16.2)
|
36
|
-
mini_portile2 (2.3.0)
|
37
|
-
multi_json (1.13.1)
|
38
|
-
multi_xml (0.6.0)
|
39
|
-
multipart-post (2.0.0)
|
40
|
-
nokogiri (1.8.2)
|
41
|
-
mini_portile2 (~> 2.3.0)
|
42
|
-
oauth2 (1.4.0)
|
43
|
-
faraday (>= 0.8, < 0.13)
|
44
|
-
jwt (~> 1.0)
|
45
|
-
multi_json (~> 1.3)
|
46
|
-
multi_xml (~> 0.5)
|
47
|
-
rack (>= 1.2, < 3)
|
48
|
-
parallel (1.12.1)
|
49
|
-
parser (2.5.0.2)
|
50
|
-
ast (~> 2.4.0)
|
51
|
-
powerpack (0.1.1)
|
52
|
-
public_suffix (3.0.2)
|
53
|
-
rack (2.0.4)
|
54
|
-
rainbow (3.0.0)
|
55
|
-
rake (12.3.0)
|
56
|
-
rdoc (3.12.2)
|
57
|
-
json (~> 1.4)
|
58
|
-
rouge (3.1.1)
|
59
|
-
rspec (3.7.0)
|
60
|
-
rspec-core (~> 3.7.0)
|
61
|
-
rspec-expectations (~> 3.7.0)
|
62
|
-
rspec-mocks (~> 3.7.0)
|
63
|
-
rspec-core (3.7.1)
|
64
|
-
rspec-support (~> 3.7.0)
|
65
|
-
rspec-expectations (3.7.0)
|
66
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
-
rspec-support (~> 3.7.0)
|
68
|
-
rspec-mocks (3.7.0)
|
69
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
70
|
-
rspec-support (~> 3.7.0)
|
71
|
-
rspec-support (3.7.1)
|
72
|
-
rubocop (0.52.1)
|
73
|
-
parallel (~> 1.10)
|
74
|
-
parser (>= 2.4.0.2, < 3.0)
|
75
|
-
powerpack (~> 0.1)
|
76
|
-
rainbow (>= 2.2.2, < 4.0)
|
77
|
-
ruby-progressbar (~> 1.7)
|
78
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
79
|
-
ruby-progressbar (1.9.0)
|
80
|
-
semver (1.0.1)
|
81
|
-
simplecov (0.15.1)
|
82
|
-
docile (~> 1.1.0)
|
83
|
-
json (>= 1.8, < 3)
|
84
|
-
simplecov-html (~> 0.10.0)
|
85
|
-
simplecov-html (0.10.2)
|
86
|
-
thread_safe (0.3.6)
|
87
|
-
unicode-display_width (1.3.0)
|
88
|
-
|
89
|
-
PLATFORMS
|
90
|
-
ruby
|
91
|
-
|
92
|
-
DEPENDENCIES
|
93
|
-
bundler (~> 1.0)
|
94
|
-
juwelier (~> 2.1.0)
|
95
|
-
kramdown (~> 1.16)
|
96
|
-
rdoc (~> 3.12)
|
97
|
-
rouge (~> 3.0)
|
98
|
-
rspec
|
99
|
-
rubocop
|
100
|
-
simplecov
|
101
|
-
|
102
|
-
BUNDLED WITH
|
103
|
-
1.16.1
|
data/Rakefile
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
require 'juwelier'
|
12
|
-
Juwelier::Tasks.new do |gem|
|
13
|
-
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
14
|
-
gem.name = "gitlab_kramdown"
|
15
|
-
gem.homepage = "http://gitlab.com/brodock/gitlab_kramdown"
|
16
|
-
gem.license = "MIT"
|
17
|
-
gem.summary = %Q{GitLab Flavored Kramdown}
|
18
|
-
gem.description = %Q{GitLab Flavored Markdown extensions on top of Kramdown markup. Tries to be as close as possible to existing extensions.}
|
19
|
-
gem.email = "brodock@gmail.com"
|
20
|
-
gem.authors = ["Gabriel Mazetto"]
|
21
|
-
gem.required_ruby_version = '~> 2.4'
|
22
|
-
|
23
|
-
# dependencies defined in Gemfile
|
24
|
-
end
|
25
|
-
Juwelier::RubygemsDotOrgTasks.new
|
26
|
-
|
27
|
-
require 'rspec'
|
28
|
-
require 'rspec/core/rake_task'
|
29
|
-
desc "Run all examples"
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
31
|
-
t.ruby_opts = %w[-w]
|
32
|
-
t.rspec_opts = %w[--color]
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
desc "Code coverage detail"
|
37
|
-
task :simplecov do
|
38
|
-
ENV['COVERAGE'] = "true"
|
39
|
-
Rake::Task['spec'].execute
|
40
|
-
end
|
41
|
-
|
42
|
-
task :default => :test
|
43
|
-
|
44
|
-
require 'rdoc/task'
|
45
|
-
Rake::RDocTask.new do |rdoc|
|
46
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
-
|
48
|
-
rdoc.rdoc_dir = 'rdoc'
|
49
|
-
rdoc.title = "gitlab_kramdown #{version}"
|
50
|
-
rdoc.rdoc_files.include('README*')
|
51
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.0
|
data/gitlab_kramdown.gemspec
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
# Generated by juwelier
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: gitlab_kramdown 0.4.0 ruby lib
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "gitlab_kramdown".freeze
|
9
|
-
s.version = "0.4.0"
|
10
|
-
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib".freeze]
|
13
|
-
s.authors = ["Gabriel Mazetto".freeze]
|
14
|
-
s.date = "2018-04-12"
|
15
|
-
s.description = "GitLab Flavored Markdown extensions on top of Kramdown markup. Tries to be as close as possible to existing extensions.".freeze
|
16
|
-
s.email = "brodock@gmail.com".freeze
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.md"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".gitlab-ci.yml",
|
24
|
-
".rubocop.yml",
|
25
|
-
".ruby-version",
|
26
|
-
"CHANGELOG.md",
|
27
|
-
"Gemfile",
|
28
|
-
"Gemfile.lock",
|
29
|
-
"LICENSE.txt",
|
30
|
-
"README.md",
|
31
|
-
"Rakefile",
|
32
|
-
"VERSION",
|
33
|
-
"gitlab_kramdown.gemspec",
|
34
|
-
"lib/gitlab_kramdown.rb",
|
35
|
-
"lib/gitlab_kramdown/parser.rb",
|
36
|
-
"lib/gitlab_kramdown/parser/autolink.rb",
|
37
|
-
"lib/gitlab_kramdown/parser/fenced_blockquote.rb",
|
38
|
-
"lib/gitlab_kramdown/parser/fenced_codeblock.rb",
|
39
|
-
"lib/gitlab_kramdown/parser/header.rb",
|
40
|
-
"lib/gitlab_kramdown/parser/reference.rb",
|
41
|
-
"lib/kramdown/parser/gitlab_kramdown.rb",
|
42
|
-
"spec/fixtures/autolink.html",
|
43
|
-
"spec/fixtures/autolink.text",
|
44
|
-
"spec/fixtures/code_highlight.html",
|
45
|
-
"spec/fixtures/code_highlight.text",
|
46
|
-
"spec/fixtures/header.html",
|
47
|
-
"spec/fixtures/header.linkable_headers.html",
|
48
|
-
"spec/fixtures/header.text",
|
49
|
-
"spec/fixtures/multi_blockquote.html",
|
50
|
-
"spec/fixtures/multi_blockquote.text",
|
51
|
-
"spec/fixtures/references.html",
|
52
|
-
"spec/fixtures/references.text",
|
53
|
-
"spec/integration/parser_spec.rb",
|
54
|
-
"spec/spec_helper.rb",
|
55
|
-
"spec/support/fixtures.rb"
|
56
|
-
]
|
57
|
-
s.homepage = "http://gitlab.com/brodock/gitlab_kramdown".freeze
|
58
|
-
s.licenses = ["MIT".freeze]
|
59
|
-
s.required_ruby_version = Gem::Requirement.new("~> 2.4".freeze)
|
60
|
-
s.rubygems_version = "2.6.14".freeze
|
61
|
-
s.summary = "GitLab Flavored Kramdown".freeze
|
62
|
-
|
63
|
-
if s.respond_to? :specification_version then
|
64
|
-
s.specification_version = 4
|
65
|
-
|
66
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
67
|
-
s.add_runtime_dependency(%q<kramdown>.freeze, ["~> 1.16"])
|
68
|
-
s.add_runtime_dependency(%q<rouge>.freeze, ["~> 3.0"])
|
69
|
-
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
70
|
-
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
71
|
-
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
72
|
-
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
73
|
-
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
74
|
-
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
75
|
-
else
|
76
|
-
s.add_dependency(%q<kramdown>.freeze, ["~> 1.16"])
|
77
|
-
s.add_dependency(%q<rouge>.freeze, ["~> 3.0"])
|
78
|
-
s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
79
|
-
s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
80
|
-
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
81
|
-
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
82
|
-
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
83
|
-
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
84
|
-
end
|
85
|
-
else
|
86
|
-
s.add_dependency(%q<kramdown>.freeze, ["~> 1.16"])
|
87
|
-
s.add_dependency(%q<rouge>.freeze, ["~> 3.0"])
|
88
|
-
s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
89
|
-
s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
90
|
-
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
91
|
-
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
92
|
-
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
93
|
-
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
data/spec/fixtures/autolink.html
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
<h1 id="autolinks">Autolinks</h1>
|
2
|
-
|
3
|
-
<p>The following URLs will be autolinked:</p>
|
4
|
-
|
5
|
-
<ul>
|
6
|
-
<li><a href="https://www.google.com">https://www.google.com</a> ! This is google</li>
|
7
|
-
<li><a href="https://google.com/">https://google.com/</a></li>
|
8
|
-
<li><a href="ftp://ftp.us.debian.org/debian/">ftp://ftp.us.debian.org/debian/</a></li>
|
9
|
-
<li><a href="smb://foo/bar/baz">smb://foo/bar/baz</a></li>
|
10
|
-
<li><a href="irc://irc.freenode.net/gitlab">irc://irc.freenode.net/gitlab</a></li>
|
11
|
-
<li><a href="http://localhost:3000">http://localhost:3000</a></li>
|
12
|
-
<li>This is an email: <a href="mailto:john.doe@example.com">john.doe@example.com</a> .</li>
|
13
|
-
<li>URL with ampersand: <a href="http://www.example.com/?doit&x=y">http://www.example.com/?doit&x=y</a> !</li>
|
14
|
-
</ul>
|
15
|
-
|
16
|
-
<blockquote>
|
17
|
-
<p>It works even inside other blocks: <a href="https://www.google.com">https://www.google.com</a></p>
|
18
|
-
</blockquote>
|
19
|
-
|
20
|
-
<pre><code>Doesn't work inside code-blocks: https://www.google.com
|
21
|
-
</code></pre>
|
data/spec/fixtures/autolink.text
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Autolinks
|
2
|
-
|
3
|
-
The following URLs will be autolinked:
|
4
|
-
|
5
|
-
* https://www.google.com ! This is google
|
6
|
-
* https://google.com/
|
7
|
-
* ftp://ftp.us.debian.org/debian/
|
8
|
-
* smb://foo/bar/baz
|
9
|
-
* irc://irc.freenode.net/gitlab
|
10
|
-
* http://localhost:3000
|
11
|
-
* This is an email: john.doe@example.com .
|
12
|
-
* URL with ampersand: http://www.example.com/?doit&x=y !
|
13
|
-
|
14
|
-
> It works even inside other blocks: https://www.google.com
|
15
|
-
|
16
|
-
```
|
17
|
-
Doesn't work inside code-blocks: https://www.google.com
|
18
|
-
```
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<p>This is a code block using 4 spaces syntax:
|
2
|
-
class Something
|
3
|
-
def method(param)
|
4
|
-
end
|
5
|
-
end</p>
|
6
|
-
|
7
|
-
<p>This is a code block using 3-backticks ```:</p>
|
8
|
-
|
9
|
-
<pre><code>This is a code block without any specific language
|
10
|
-
</code></pre>
|
11
|
-
|
12
|
-
<p>This is a code block specifying a language:</p>
|
13
|
-
|
14
|
-
<pre><code class="language-ruby">class Something
|
15
|
-
def method(param)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
</code></pre>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
This is a code block using 4 spaces syntax:
|
2
|
-
class Something
|
3
|
-
def method(param)
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
This is a code block using 3-backticks ```:
|
8
|
-
|
9
|
-
```
|
10
|
-
This is a code block without any specific language
|
11
|
-
```
|
12
|
-
|
13
|
-
This is a code block specifying a language:
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
class Something
|
17
|
-
def method(param)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
```
|
data/spec/fixtures/header.html
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
<h1 id="h1">H1</h1>
|
2
|
-
<h2 id="h2">H2</h2>
|
3
|
-
<h3 id="h3">H3</h3>
|
4
|
-
<h4 id="h4">H4</h4>
|
5
|
-
<h5 id="h5">H5</h5>
|
6
|
-
<h6 id="h6">H6</h6>
|
7
|
-
|
8
|
-
<p>Alternatively, for H1 and H2, an underline-ish style:</p>
|
9
|
-
|
10
|
-
<h1 id="alt-h1">Alt-H1</h1>
|
11
|
-
|
12
|
-
<h2 id="alt-h2">Alt-H2</h2>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<h1 id="h1">H1<a href="#h1" title="Permalink" class="anchor"></a></h1>
|
2
|
-
<h2 id="h2">H2<a href="#h2" title="Permalink" class="anchor"></a></h2>
|
3
|
-
<h3 id="h3">H3<a href="#h3" title="Permalink" class="anchor"></a></h3>
|
4
|
-
<h4 id="h4">H4<a href="#h4" title="Permalink" class="anchor"></a></h4>
|
5
|
-
<h5 id="h5">H5<a href="#h5" title="Permalink" class="anchor"></a></h5>
|
6
|
-
<h6 id="h6">H6<a href="#h6" title="Permalink" class="anchor"></a></h6>
|
7
|
-
|
8
|
-
<p>Alternatively, for H1 and H2, an underline-ish style:</p>
|
9
|
-
|
10
|
-
<h1 id="alt-h1">Alt-H1<a href="#alt-h1" title="Permalink" class="anchor"></a></h1>
|
11
|
-
|
12
|
-
<h2 id="alt-h2">Alt-H2<a href="#alt-h2" title="Permalink" class="anchor"></a></h2>
|
data/spec/fixtures/header.text
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
<blockquote>
|
2
|
-
<p>If you paste a message from somewhere else</p>
|
3
|
-
|
4
|
-
<p>that</p>
|
5
|
-
|
6
|
-
<p>spans</p>
|
7
|
-
|
8
|
-
<p>multiple lines,</p>
|
9
|
-
|
10
|
-
<p>you can quote that without having to manually prepend <code>></code> to every line!</p>
|
11
|
-
</blockquote>
|
12
|
-
|
13
|
-
<h2 id="title-here">Title here</h2>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<p>User: <a href="https://gitlab.com/user_name">@user_name</a></p>
|
2
|
-
|
3
|
-
<p>Group: <a href="https://gitlab.com/group_name">@group_name</a></p>
|
4
|
-
|
5
|
-
<p>Subgroup: <a href="https://gitlab.com/maingroup123/group_name">@maingroup123/group_name</a></p>
|
6
|
-
|
7
|
-
<p>Project Issue: <a href="https://gitlab.com/group_name/project_name/issues/12345">group_name/project_name#12345</a></p>
|
8
|
-
|
9
|
-
<p>Merge Request: <a href="https://gitlab.com/group_name/project_name/merge_requests/12345">group_name/project_name!12345</a></p>
|
10
|
-
|
11
|
-
<p>Project Snippet: <a href="https://gitlab.com/group_name/project_name/snippets/12345">group_name/project_name$12345</a></p>
|
12
|
-
|
13
|
-
<p>Project Commit: <a href="https://gitlab.com/group_name/project_name/commit/9ba12248">group_name/project_name@9ba12248</a> not to get confused by email: <a href="mailto:john.doe@example.com">john.doe@example.com</a></p>
|
14
|
-
|
15
|
-
<p>Project Commit Range comparison: <a href="https://gitlab.com/group_name/project_name/compare/9ba12248...b19a04f5">group_name/project_name@9ba12248...b19a04f5</a></p>
|
16
|
-
|
17
|
-
<p>Project Label: <a href="https://gitlab.com/group_name/project_name/issues?label_name=label">group_name/project_name~label</a></p>
|
18
|
-
|
19
|
-
<p>Project Label with Space: <a href="https://gitlab.com/group_name/project_name/issues?label_name=Some+label">group_name/project_name~"Some label"</a></p>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
User: @user_name
|
2
|
-
|
3
|
-
Group: @group_name
|
4
|
-
|
5
|
-
Subgroup: @maingroup123/group_name
|
6
|
-
|
7
|
-
Project Issue: group_name/project_name#12345
|
8
|
-
|
9
|
-
Merge Request: group_name/project_name!12345
|
10
|
-
|
11
|
-
Project Snippet: group_name/project_name$12345
|
12
|
-
|
13
|
-
Project Commit: group_name/project_name@9ba12248 not to get confused by email: john.doe@example.com
|
14
|
-
|
15
|
-
Project Commit Range comparison: group_name/project_name@9ba12248...b19a04f5
|
16
|
-
|
17
|
-
Project Label: group_name/project_name~label
|
18
|
-
|
19
|
-
Project Label with Space: group_name/project_name~"Some label"
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
context 'GitLab Kramdown Integration tests' do
|
4
|
-
let(:options) do
|
5
|
-
{ input: 'GitlabKramdown', linkable_headers: false }
|
6
|
-
end
|
7
|
-
|
8
|
-
context 'HTML render' do
|
9
|
-
Fixtures.text_files.each do |text_file|
|
10
|
-
it "Renders #{File.basename(text_file)} as #{File.basename(Fixtures.html_file(text_file))}" do
|
11
|
-
source = File.read(text_file)
|
12
|
-
target = File.read(Fixtures.html_file(text_file))
|
13
|
-
parser = Kramdown::Document.new(source, options)
|
14
|
-
|
15
|
-
expect(parser.to_html).to eq(target)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'linkable_headers enabled' do
|
20
|
-
let(:options) do
|
21
|
-
{ input: 'GitlabKramdown', linkable_headers: true }
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'Renders header as headers.linkable_headers.html' do
|
25
|
-
text_file = File.join(Fixtures.fixtures_path, 'header.text')
|
26
|
-
html_file = File.join(Fixtures.fixtures_path, 'header.linkable_headers.html')
|
27
|
-
|
28
|
-
source = File.read(text_file)
|
29
|
-
target = File.read(html_file)
|
30
|
-
parser = Kramdown::Document.new(source, options)
|
31
|
-
|
32
|
-
expect(parser.to_html).to eq(target)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
Bundler.setup
|
5
|
-
|
6
|
-
require 'simplecov'
|
7
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
8
|
-
SimpleCov::Formatter::HTMLFormatter
|
9
|
-
])
|
10
|
-
SimpleCov.start { add_filter '/spec/' }
|
11
|
-
|
12
|
-
require 'kramdown'
|
13
|
-
require 'gitlab_kramdown'
|
14
|
-
|
15
|
-
# Load support files
|
16
|
-
Dir[File.join('./spec/support/**/*.rb')].each { |f| require f }
|
17
|
-
|
18
|
-
RSpec.configure do |config|
|
19
|
-
# some (optional) config here
|
20
|
-
end
|
data/spec/support/fixtures.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Fixtures
|
4
|
-
def self.text_files
|
5
|
-
Dir[File.join(fixtures_path, '**/*.text')]
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.html_file(text_file)
|
9
|
-
text_file.sub('.text', '.html')
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.fixtures_path
|
13
|
-
File.expand_path(File.join(File.dirname(__FILE__), '../fixtures'))
|
14
|
-
end
|
15
|
-
end
|