gfm2confluence 0.1.0
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.
- data/.document +5 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +46 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/bin/gfm2confluence +17 -0
- data/gfm2confluence.gemspec +72 -0
- data/lib/gfm2confluence.rb +15 -0
- data/lib/gfm2confluence/converter.rb +104 -0
- data/test/helper.rb +18 -0
- data/test/test_gfm2confluence-gem.rb +159 -0
- metadata +185 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem "redcarpet", "~> 2.1.1"
|
6
|
+
|
7
|
+
# Add dependencies to develop your gem here.
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
9
|
+
group :development do
|
10
|
+
gem "shoulda", ">= 0"
|
11
|
+
gem "rdoc", "~> 3.12"
|
12
|
+
gem "bundler", ">= 1.0.0"
|
13
|
+
gem "jeweler", ">= 1.8.4"
|
14
|
+
gem "rcov", ">= 0"
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 ablagoev
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
= gfm2confluence
|
2
|
+
|
3
|
+
This is a simple tool, which converts gfm documents (GitHub Flavored Markdown[http://github.github.com/github-flavored-markdown/]) to the {Atlassian Wiki Format}[https://confluence.atlassian.com/display/DOC/Confluence+Wiki+Markup]. This format is mostly used inside jira and confluence.
|
4
|
+
|
5
|
+
The implementation was greatly inspired by markdown2confluence[https://github.com/jedi4ever/markdown2confluence].
|
6
|
+
|
7
|
+
The gem is based on Redcarpet[https://github.com/vmg/redcarpet].
|
8
|
+
|
9
|
+
== Installation:
|
10
|
+
|
11
|
+
=== Via gem:
|
12
|
+
|
13
|
+
`gem install gfm2confluence`
|
14
|
+
|
15
|
+
=== From github:
|
16
|
+
|
17
|
+
`gem install bundler`
|
18
|
+
`git clone git://github.com/ablagoev/gfm2confluence.git`
|
19
|
+
`bundle install vendor`
|
20
|
+
|
21
|
+
== Usage:
|
22
|
+
|
23
|
+
`gfm2confluence <inputfile>`
|
24
|
+
`gfm2confluence <inputtext>`
|
25
|
+
|
26
|
+
== Known Issues:
|
27
|
+
|
28
|
+
* Since redcarper/sundown mostly remove newlines, extra newlines have been added to the parsing of paragraphs, list items, etc.
|
29
|
+
* Tables are not yet supported
|
30
|
+
* Nested lists are not supported
|
31
|
+
|
32
|
+
== Contributing to gfm2confluence
|
33
|
+
|
34
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
35
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
36
|
+
* Fork the project.
|
37
|
+
* Start a feature/bugfix branch.
|
38
|
+
* Commit and push until you are happy with your contribution.
|
39
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
40
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
41
|
+
|
42
|
+
== Copyright
|
43
|
+
|
44
|
+
Copyright (c) 2012 ablagoev. See LICENSE.txt for
|
45
|
+
further details.
|
46
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "gfm2confluence"
|
18
|
+
gem.homepage = "http://github.com/ablagoev/gfm2confluence"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = "Convert git hub flavoured markdown to atlassian confluence format"
|
21
|
+
gem.description = "This tool can be used to convert the git hub flavoured markdown format to the wiki markup used in atlassian products (jira, confluence, etc.)"
|
22
|
+
gem.email = "alexander.i.blagoev@gmail.com"
|
23
|
+
gem.authors = ["ablagoev"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
gem.add_dependency 'redcarpet', '~> 2.1.1'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
41
|
+
test.rcov_opts << '--exclude "gems/*"'
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => :test
|
45
|
+
|
46
|
+
require 'rdoc/task'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "gfm2confluence #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/gfm2confluence
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gfm2confluence'
|
3
|
+
|
4
|
+
abort "You need to specify at least one argument" if ARGV.size < 1
|
5
|
+
|
6
|
+
#Check if argument is a file
|
7
|
+
if File.exist? ARGV[0]
|
8
|
+
begin
|
9
|
+
text = File.read(ARGV[0])
|
10
|
+
rescue Exception => ex
|
11
|
+
abort "There was an error reading the file"
|
12
|
+
end
|
13
|
+
else
|
14
|
+
text = ARGV[0]
|
15
|
+
end
|
16
|
+
|
17
|
+
puts Gfm2Confluence.convert(text)
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{gfm2confluence}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["ablagoev"]
|
12
|
+
s.date = %q{2012-08-31}
|
13
|
+
s.default_executable = %q{gfm2confluence}
|
14
|
+
s.description = %q{This tool can be used to convert the git hub flavoured markdown format to the wiki markup used in atlassian products (jira, confluence, etc.)}
|
15
|
+
s.email = %q{alexander.i.blagoev@gmail.com}
|
16
|
+
s.executables = ["gfm2confluence"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/gfm2confluence",
|
29
|
+
"gfm2confluence.gemspec",
|
30
|
+
"lib/gfm2confluence.rb",
|
31
|
+
"lib/gfm2confluence/converter.rb",
|
32
|
+
"test/helper.rb",
|
33
|
+
"test/test_gfm2confluence-gem.rb"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/ablagoev/gfm2confluence}
|
36
|
+
s.licenses = ["MIT"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
39
|
+
s.summary = %q{Convert git hub flavoured markdown to atlassian confluence format}
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_runtime_dependency(%q<redcarpet>, ["~> 2.1.1"])
|
47
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
49
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
|
51
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<redcarpet>, ["~> 2.1.1"])
|
53
|
+
else
|
54
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.1.1"])
|
55
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
56
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
57
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
58
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
59
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
60
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.1.1"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.1.1"])
|
64
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
65
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
66
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
67
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.4"])
|
68
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
69
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.1.1"])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# The base class which is used to convert the text
|
3
|
+
require 'redcarpet'
|
4
|
+
|
5
|
+
class Gfm2Confluence
|
6
|
+
def self.convert(text)
|
7
|
+
markdown = Redcarpet::Markdown.new(Gfm2Confluence::Converter,
|
8
|
+
:autolink => true, :fenced_code_blocks => true,
|
9
|
+
:hard_wrap => true, :strikethrough => true,
|
10
|
+
:superscript => true, :no_intra_emphasis => true)
|
11
|
+
result = markdown.render(text)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'gfm2confluence/converter.rb'
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# The class which extends Redcarpet::Render::Base and converts the text
|
3
|
+
|
4
|
+
require 'redcarpet'
|
5
|
+
|
6
|
+
#TODO: parse <pre> tags for {code} tags
|
7
|
+
#TODO: parse <p> tags to paragraphs
|
8
|
+
#TODO: parse <iframe> tags
|
9
|
+
class Gfm2Confluence::Converter < Redcarpet::Render::Base
|
10
|
+
def block_code(code, language)
|
11
|
+
"{code}\n#{code}{code}\n\n"
|
12
|
+
end
|
13
|
+
|
14
|
+
def block_quote(quote)
|
15
|
+
"{quote}\n#{quote}{quote}\n"
|
16
|
+
end
|
17
|
+
|
18
|
+
def block_html(raw_html)
|
19
|
+
#TODO: try to parse the html body and replce tags where possible
|
20
|
+
raw_html
|
21
|
+
end
|
22
|
+
|
23
|
+
def header(text, header_level)
|
24
|
+
"h#{header_level}. #{text}\n"
|
25
|
+
end
|
26
|
+
|
27
|
+
def hrule()
|
28
|
+
"----\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
def list(contents, list_type)
|
32
|
+
"#{contents}\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
def list_item(text, list_type)
|
36
|
+
marker = '-'
|
37
|
+
if list_type.to_s == "ordered"
|
38
|
+
marker = '#'
|
39
|
+
end
|
40
|
+
"#{marker} #{text}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def paragraph(text)
|
44
|
+
"#{text}\n\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
def autolink(link, link_type)
|
48
|
+
"[#{link}]"
|
49
|
+
end
|
50
|
+
|
51
|
+
def codespan(code)
|
52
|
+
"{code}#{code}{code}"
|
53
|
+
end
|
54
|
+
|
55
|
+
def double_emphasis(text)
|
56
|
+
"*#{text}*"
|
57
|
+
end
|
58
|
+
|
59
|
+
def emphasis(text)
|
60
|
+
"_#{text}_"
|
61
|
+
end
|
62
|
+
|
63
|
+
def image(link, title, alt_text)
|
64
|
+
alt_text.to_s.empty? ? "!#{link}!" : "!#{link}|alt=#{alt_text}!"
|
65
|
+
end
|
66
|
+
|
67
|
+
def linebreak()
|
68
|
+
"\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
def link(link, title, alt_text)
|
72
|
+
alt_text.to_s.empty? ? "[#{link}]" : "[#{alt_text}|#{link}]"
|
73
|
+
end
|
74
|
+
|
75
|
+
def raw_html(raw_html)
|
76
|
+
#TODO: parse the separate tags along with block_html and make replacements where applicable
|
77
|
+
raw_html
|
78
|
+
end
|
79
|
+
|
80
|
+
def triple_emphasis(text)
|
81
|
+
"*#{text}*"
|
82
|
+
end
|
83
|
+
|
84
|
+
def strikethrough(text)
|
85
|
+
"-#{text}-"
|
86
|
+
end
|
87
|
+
|
88
|
+
def superscript(text)
|
89
|
+
"^#{text}^"
|
90
|
+
end
|
91
|
+
|
92
|
+
def entity(text)
|
93
|
+
"#{text}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def normal_text(text)
|
97
|
+
escape "#{text}"
|
98
|
+
end
|
99
|
+
|
100
|
+
def escape(text)
|
101
|
+
#TODO: Check if anything else needs to be escaped
|
102
|
+
text.gsub(/\{|\}/, '\\\\\0') #This replaces { with \{
|
103
|
+
end
|
104
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
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 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'gfm2confluence'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestGfm2Confluence < Test::Unit::TestCase
|
5
|
+
context 'the converter' do
|
6
|
+
should "generate code block" do
|
7
|
+
text = "```js\n//code\n```"
|
8
|
+
expect = "{code}\n//code\n{code}\n\n"
|
9
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
10
|
+
end
|
11
|
+
|
12
|
+
should "generate block quote" do
|
13
|
+
text = ">Blockquote"
|
14
|
+
expect = "{quote}\nBlockquote\n\n{quote}\n"
|
15
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
16
|
+
end
|
17
|
+
|
18
|
+
should "generate block html" do
|
19
|
+
text = "<div>\n<span>Test</span>\n</div>"
|
20
|
+
expect = "<div>\n<span>Test</span>\n</div>\n"
|
21
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
22
|
+
end
|
23
|
+
|
24
|
+
should "generate header" do
|
25
|
+
for i in 1..3 do
|
26
|
+
level = "#" * i
|
27
|
+
text = "#{level} Level#{i}"
|
28
|
+
expect = "h#{i}. Level#{i}\n"
|
29
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
should "generate hr" do
|
34
|
+
expect = "----\n"
|
35
|
+
assert_equal(expect, Gfm2Confluence.convert('***'))
|
36
|
+
assert_equal(expect, Gfm2Confluence.convert('- - -'))
|
37
|
+
assert_equal(expect, Gfm2Confluence.convert('---------------'))
|
38
|
+
end
|
39
|
+
|
40
|
+
should "generate list" do
|
41
|
+
#Ordered lsits
|
42
|
+
expect = "# Item 1\n# Item 2\n# Item 3\n\n"
|
43
|
+
text = "1. Item 1\n2. Item 2\n3. Item 3"
|
44
|
+
|
45
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
46
|
+
|
47
|
+
#Unorderd lists
|
48
|
+
expect = "- Item 1\n- Item 2\n- Item 3\n\n"
|
49
|
+
text = "* Item 1\n* Item 2\n* Item 3"
|
50
|
+
|
51
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
52
|
+
text = "- Item 1\n- Item 2\n- Item 3"
|
53
|
+
|
54
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
55
|
+
end
|
56
|
+
|
57
|
+
should "generate a paragraph" do
|
58
|
+
expect = "Paragraph text\n\n"
|
59
|
+
text = expect
|
60
|
+
|
61
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
62
|
+
end
|
63
|
+
|
64
|
+
should "autolink" do
|
65
|
+
expect = "[http://google.com/]\n\n"
|
66
|
+
text = "http://google.com/"
|
67
|
+
|
68
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
69
|
+
end
|
70
|
+
|
71
|
+
should "generate code span" do
|
72
|
+
text = "`//code`"
|
73
|
+
expect = "{code}//code{code}\n\n"
|
74
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
75
|
+
end
|
76
|
+
|
77
|
+
should "generate double emphasis" do
|
78
|
+
text = "**emphasis**"
|
79
|
+
expect = "*emphasis*\n\n"
|
80
|
+
|
81
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
82
|
+
end
|
83
|
+
|
84
|
+
should "generate emphasis" do
|
85
|
+
text = "*emphasis*"
|
86
|
+
expect = "_emphasis_\n\n"
|
87
|
+
|
88
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
89
|
+
end
|
90
|
+
|
91
|
+
should "generate image" do
|
92
|
+
text = ""
|
93
|
+
expect = "!/path/to/img.jpg|alt=Alt text!\n\n"
|
94
|
+
|
95
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
96
|
+
|
97
|
+
#Titles are not handled
|
98
|
+
text = ""
|
99
|
+
expect = "!/path/to/img.jpg|alt=Alt text!\n\n"
|
100
|
+
|
101
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
102
|
+
end
|
103
|
+
|
104
|
+
should "generate link" do
|
105
|
+
#Link titles are not handled
|
106
|
+
text = "This is [an example](http://example.com/ \"Title\") inline link."
|
107
|
+
expect = "This is [an example|http://example.com/] inline link.\n\n"
|
108
|
+
|
109
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
110
|
+
end
|
111
|
+
|
112
|
+
should "generate raw html" do
|
113
|
+
text = "<span>Test</span>"
|
114
|
+
expect = "<span>Test</span>\n\n"
|
115
|
+
|
116
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
117
|
+
end
|
118
|
+
|
119
|
+
should "generate triple emphasis" do
|
120
|
+
text = "***empahsis***"
|
121
|
+
expect = "*empahsis*\n\n"
|
122
|
+
|
123
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
124
|
+
end
|
125
|
+
|
126
|
+
should "generate strikethrough" do
|
127
|
+
text = "~~strike~~"
|
128
|
+
expect = "-strike-\n\n"
|
129
|
+
|
130
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
131
|
+
end
|
132
|
+
|
133
|
+
should "generate superscript" do
|
134
|
+
text = "^super"
|
135
|
+
expect = "^super^\n\n"
|
136
|
+
|
137
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
138
|
+
end
|
139
|
+
|
140
|
+
should "generate entity" do
|
141
|
+
text = "&"
|
142
|
+
expect = "&\n\n"
|
143
|
+
|
144
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
145
|
+
end
|
146
|
+
|
147
|
+
should "generate normal text" do
|
148
|
+
text = "normal text"
|
149
|
+
expect = "normal text\n\n"
|
150
|
+
|
151
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
152
|
+
|
153
|
+
text = "test if { } are escaped properly"
|
154
|
+
expect = "test if \\{ \\} are escaped properly\n\n"
|
155
|
+
|
156
|
+
assert_equal(expect, Gfm2Confluence.convert(text))
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
metadata
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gfm2confluence
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- ablagoev
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-08-31 00:00:00 +03:00
|
19
|
+
default_executable: gfm2confluence
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
name: redcarpet
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 9
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 1
|
34
|
+
- 1
|
35
|
+
version: 2.1.1
|
36
|
+
requirement: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
name: shoulda
|
41
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
requirement: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
type: :development
|
53
|
+
prerelease: false
|
54
|
+
name: rdoc
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 31
|
61
|
+
segments:
|
62
|
+
- 3
|
63
|
+
- 12
|
64
|
+
version: "3.12"
|
65
|
+
requirement: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
name: bundler
|
70
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 23
|
76
|
+
segments:
|
77
|
+
- 1
|
78
|
+
- 0
|
79
|
+
- 0
|
80
|
+
version: 1.0.0
|
81
|
+
requirement: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
name: jeweler
|
86
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 63
|
92
|
+
segments:
|
93
|
+
- 1
|
94
|
+
- 8
|
95
|
+
- 4
|
96
|
+
version: 1.8.4
|
97
|
+
requirement: *id005
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
name: rcov
|
102
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
111
|
+
requirement: *id006
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
type: :runtime
|
114
|
+
prerelease: false
|
115
|
+
name: redcarpet
|
116
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ~>
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 9
|
122
|
+
segments:
|
123
|
+
- 2
|
124
|
+
- 1
|
125
|
+
- 1
|
126
|
+
version: 2.1.1
|
127
|
+
requirement: *id007
|
128
|
+
description: This tool can be used to convert the git hub flavoured markdown format to the wiki markup used in atlassian products (jira, confluence, etc.)
|
129
|
+
email: alexander.i.blagoev@gmail.com
|
130
|
+
executables:
|
131
|
+
- gfm2confluence
|
132
|
+
extensions: []
|
133
|
+
|
134
|
+
extra_rdoc_files:
|
135
|
+
- LICENSE.txt
|
136
|
+
- README.rdoc
|
137
|
+
files:
|
138
|
+
- .document
|
139
|
+
- Gemfile
|
140
|
+
- LICENSE.txt
|
141
|
+
- README.rdoc
|
142
|
+
- Rakefile
|
143
|
+
- VERSION
|
144
|
+
- bin/gfm2confluence
|
145
|
+
- gfm2confluence.gemspec
|
146
|
+
- lib/gfm2confluence.rb
|
147
|
+
- lib/gfm2confluence/converter.rb
|
148
|
+
- test/helper.rb
|
149
|
+
- test/test_gfm2confluence-gem.rb
|
150
|
+
has_rdoc: true
|
151
|
+
homepage: http://github.com/ablagoev/gfm2confluence
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
post_install_message:
|
155
|
+
rdoc_options: []
|
156
|
+
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
hash: 3
|
165
|
+
segments:
|
166
|
+
- 0
|
167
|
+
version: "0"
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
hash: 3
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
version: "0"
|
177
|
+
requirements: []
|
178
|
+
|
179
|
+
rubyforge_project:
|
180
|
+
rubygems_version: 1.3.7
|
181
|
+
signing_key:
|
182
|
+
specification_version: 3
|
183
|
+
summary: Convert git hub flavoured markdown to atlassian confluence format
|
184
|
+
test_files: []
|
185
|
+
|