github-markup 0.5.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -0
- data/HISTORY.md +76 -0
- data/README.md +3 -3
- data/Rakefile +125 -3
- data/github-markup.gemspec +103 -0
- data/lib/github-markup.rb +6 -0
- data/lib/github/markup.rb +2 -1
- data/lib/github/markup/rdoc.rb +4 -7
- data/lib/github/markups.rb +17 -2
- data/test/markups/README.markdown.html +0 -1
- data/test/markups/README.rdoc.html +9 -14
- metadata +22 -20
- data/lib/github/markup/version.rb +0 -5
data/Gemfile
ADDED
data/HISTORY.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
## 0.5.1 (2010-09-30)
|
2
|
+
|
3
|
+
* Support relative path links in rdoc
|
4
|
+
|
5
|
+
## 0.5.0 (2010-07-07)
|
6
|
+
|
7
|
+
* Added creole support
|
8
|
+
|
9
|
+
## 0.4.0 (2010-04-23)
|
10
|
+
|
11
|
+
* Removed man page support until it's ready.
|
12
|
+
|
13
|
+
## 0.3.3 (2010-03-29)
|
14
|
+
|
15
|
+
* UTF-8 works with ReST now.
|
16
|
+
|
17
|
+
## 0.3.2 (2010-03-25)
|
18
|
+
|
19
|
+
* Improved test runner
|
20
|
+
* Forgive ReST problems that aren't user errors.
|
21
|
+
|
22
|
+
## 0.3.1 (2010-03-22)
|
23
|
+
|
24
|
+
* Add .rst.txt extension
|
25
|
+
* Fix ASCII encoding error while using print u'\u010c' non-ASCII char and similar.
|
26
|
+
|
27
|
+
## 0.3.0 (2010-03-11)
|
28
|
+
|
29
|
+
* man rendering
|
30
|
+
* `github-markup` command line runner
|
31
|
+
|
32
|
+
## 0.2.2 (2010-02-09)
|
33
|
+
|
34
|
+
* pod fixes from Ricardo Signes
|
35
|
+
|
36
|
+
## 0.2.1 (2010-01-25)
|
37
|
+
|
38
|
+
* ReST fixes from Michael Jones
|
39
|
+
|
40
|
+
## 0.2.0 (2010-01-10)
|
41
|
+
|
42
|
+
* org-mode support
|
43
|
+
|
44
|
+
## 0.1.7 (2009-11-17)
|
45
|
+
|
46
|
+
* Ditch asciidoc2html, call asciidoc directly
|
47
|
+
|
48
|
+
## 0.1.6 (2009-11-17)
|
49
|
+
|
50
|
+
* mdown
|
51
|
+
|
52
|
+
## 0.1.5 (2009-11-17)
|
53
|
+
|
54
|
+
* Actually, if we can't render a thing then don't. Not once, not never.
|
55
|
+
|
56
|
+
## 0.1.4 (2009-11-17)
|
57
|
+
|
58
|
+
* Bugfix: Missing commands return the input (instead of nothing)
|
59
|
+
|
60
|
+
## 0.1.3 (2009-11-02)
|
61
|
+
|
62
|
+
* Strip the INDEX comments from POD
|
63
|
+
|
64
|
+
## 0.1.2 (2009-11-02)
|
65
|
+
|
66
|
+
* Renamed to `github-markup`
|
67
|
+
* Bugfix: POD rendering works now, not just index
|
68
|
+
|
69
|
+
## 0.1.1 (2009-11-02)
|
70
|
+
|
71
|
+
* Added `GitHub::Markup.can_render?` helper.
|
72
|
+
* Bugfix: Actually check file extensions
|
73
|
+
|
74
|
+
## 0.1.0 (2009-11-02)
|
75
|
+
|
76
|
+
* First release
|
data/README.md
CHANGED
@@ -10,16 +10,16 @@ Markups
|
|
10
10
|
The following markups are supported. The dependencies listed are required if
|
11
11
|
you wish to run the library.
|
12
12
|
|
13
|
-
* [.markdown](http://daringfireball.net/projects/markdown/) -- `gem install
|
13
|
+
* [.markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/tanoku/redcarpet)
|
14
14
|
* [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
|
15
|
-
* [.rdoc](http://rdoc.sourceforge.net/)
|
15
|
+
* [.rdoc](http://rdoc.sourceforge.net/) -- `gem install rdoc -v 3.6.1`
|
16
16
|
* [.org](http://orgmode.org/) -- `gem install org-ruby`
|
17
17
|
* [.creole](http://wikicreole.org/) -- `gem install creole`
|
18
|
+
* [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
|
18
19
|
* [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
|
19
20
|
* [.asciidoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
|
20
21
|
* [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML`
|
21
22
|
comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
|
22
|
-
* .1 - Requires [`groff`](http://www.gnu.org/software/groff/)
|
23
23
|
|
24
24
|
|
25
25
|
Contributing
|
data/Rakefile
CHANGED
@@ -1,11 +1,133 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
#############################################################################
|
6
|
+
#
|
7
|
+
# Helper functions
|
8
|
+
#
|
9
|
+
#############################################################################
|
10
|
+
|
11
|
+
def name
|
12
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
17
|
+
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
def date
|
21
|
+
Date.today.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def rubyforge_project
|
25
|
+
name
|
26
|
+
end
|
27
|
+
|
28
|
+
def gemspec_file
|
29
|
+
"#{name}.gemspec"
|
30
|
+
end
|
31
|
+
|
32
|
+
def gem_file
|
33
|
+
"#{name}-#{version}.gem"
|
34
|
+
end
|
35
|
+
|
36
|
+
def replace_header(head, header_name)
|
37
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
38
|
+
end
|
39
|
+
|
40
|
+
#############################################################################
|
41
|
+
#
|
42
|
+
# Standard tasks
|
43
|
+
#
|
44
|
+
#############################################################################
|
45
|
+
|
1
46
|
task :default => :test
|
2
47
|
|
3
|
-
|
4
|
-
|
5
|
-
|
48
|
+
require 'rake/testtask'
|
49
|
+
Rake::TestTask.new(:test) do |test|
|
50
|
+
test.libs << 'lib' << 'test'
|
51
|
+
test.pattern = 'test/**/*_test.rb'
|
52
|
+
test.verbose = true
|
6
53
|
end
|
7
54
|
|
55
|
+
desc "Open an irb session preloaded with this library"
|
56
|
+
task :console do
|
57
|
+
sh "irb -rubygems -r ./lib/#{name}.rb"
|
58
|
+
end
|
59
|
+
|
60
|
+
#############################################################################
|
61
|
+
#
|
62
|
+
# Custom tasks (add your own tasks here)
|
63
|
+
#
|
64
|
+
#############################################################################
|
65
|
+
|
8
66
|
desc "Kick it"
|
9
67
|
task :kick do
|
10
68
|
exec "kicker -e rake test lib"
|
11
69
|
end
|
70
|
+
|
71
|
+
#############################################################################
|
72
|
+
#
|
73
|
+
# Packaging tasks
|
74
|
+
#
|
75
|
+
#############################################################################
|
76
|
+
|
77
|
+
desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
|
78
|
+
task :release => :build do
|
79
|
+
unless `git branch` =~ /^\* master$/
|
80
|
+
puts "You must be on the master branch to release!"
|
81
|
+
exit!
|
82
|
+
end
|
83
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
84
|
+
sh "git tag v#{version}"
|
85
|
+
sh "git push origin master"
|
86
|
+
sh "git push origin v#{version}"
|
87
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
88
|
+
end
|
89
|
+
|
90
|
+
desc "Build #{gem_file} into the pkg directory"
|
91
|
+
task :build => :gemspec do
|
92
|
+
sh "mkdir -p pkg"
|
93
|
+
sh "gem build #{gemspec_file}"
|
94
|
+
sh "mv #{gem_file} pkg"
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "Generate #{gemspec_file}"
|
98
|
+
task :gemspec => :validate do
|
99
|
+
# read spec file and split out manifest section
|
100
|
+
spec = File.read(gemspec_file)
|
101
|
+
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
102
|
+
|
103
|
+
# replace name version and date
|
104
|
+
replace_header(head, :name)
|
105
|
+
replace_header(head, :version)
|
106
|
+
replace_header(head, :date)
|
107
|
+
#comment this out if your rubyforge_project has a different name
|
108
|
+
replace_header(head, :rubyforge_project)
|
109
|
+
|
110
|
+
# determine file list from git ls-files
|
111
|
+
files = `git ls-files`.
|
112
|
+
split("\n").
|
113
|
+
sort.
|
114
|
+
reject { |file| file =~ /^\./ }.
|
115
|
+
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
116
|
+
map { |file| " #{file}" }.
|
117
|
+
join("\n")
|
118
|
+
|
119
|
+
# piece file back together and write
|
120
|
+
manifest = " s.files = %w[\n#{files}\n ]\n"
|
121
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
122
|
+
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
123
|
+
puts "Updated #{gemspec_file}"
|
124
|
+
end
|
125
|
+
|
126
|
+
desc "Validate #{gemspec_file}"
|
127
|
+
task :validate do
|
128
|
+
unless Dir['VERSION*'].empty?
|
129
|
+
puts "A `VERSION` file at root level violates Gem best practices."
|
130
|
+
exit!
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
@@ -0,0 +1,103 @@
|
|
1
|
+
## This is the rakegem gemspec template. Make sure you read and understand
|
2
|
+
## all of the comments. Some sections require modification, and others can
|
3
|
+
## be deleted if you don't need them. Once you understand the contents of
|
4
|
+
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
+
## You can find comprehensive Gem::Specification documentation, at
|
6
|
+
## http://docs.rubygems.org/read/chapter/20
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
+
s.rubygems_version = '1.3.5'
|
11
|
+
|
12
|
+
## Leave these as is they will be modified for you by the rake gemspec task.
|
13
|
+
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
+
## the sub! line in the Rakefile
|
15
|
+
s.name = 'github-markup'
|
16
|
+
s.version = '0.7.0'
|
17
|
+
s.date = '2011-12-07'
|
18
|
+
s.rubyforge_project = 'github-markup'
|
19
|
+
|
20
|
+
## Make sure your summary is short. The description may be as long
|
21
|
+
## as you like.
|
22
|
+
s.summary = "The code GitHub uses to render README.markup"
|
23
|
+
s.description = <<desc
|
24
|
+
This gem is used by GitHub to render any fancy markup such as
|
25
|
+
Markdown, Textile, Org-Mode, etc. Fork it and add your own!
|
26
|
+
desc
|
27
|
+
|
28
|
+
## List the primary authors. If there are a bunch of authors, it's probably
|
29
|
+
## better to set the email to an email list or something. If you don't have
|
30
|
+
## a custom homepage, consider using your GitHub URL or the like.
|
31
|
+
s.authors = ["Chris Wanstrath"]
|
32
|
+
s.email = 'chris@ozmm.org'
|
33
|
+
s.homepage = 'https://github.com/github/markup'
|
34
|
+
|
35
|
+
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
36
|
+
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
37
|
+
s.require_paths = %w[lib]
|
38
|
+
|
39
|
+
## Specify any RDoc options here. You'll want to add your README and
|
40
|
+
## LICENSE files to the extra_rdoc_files list.
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
43
|
+
|
44
|
+
## List your runtime dependencies here. Runtime dependencies are those
|
45
|
+
## that are needed for an end user to actually USE your code.
|
46
|
+
#s.add_dependency('simple_uuid', "~> 0.1.2")
|
47
|
+
|
48
|
+
## List your development dependencies here. Development dependencies are
|
49
|
+
## those that are only needed during development
|
50
|
+
#s.add_development_dependency("test-unit", "~> 2.3.0")
|
51
|
+
|
52
|
+
## Leave this section as-is. It will be automatically generated from the
|
53
|
+
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
54
|
+
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
55
|
+
# = MANIFEST =
|
56
|
+
s.files = %w[
|
57
|
+
Gemfile
|
58
|
+
HISTORY.md
|
59
|
+
LICENSE
|
60
|
+
README.md
|
61
|
+
Rakefile
|
62
|
+
bin/github-markup
|
63
|
+
github-markup.gemspec
|
64
|
+
lib/github-markup.rb
|
65
|
+
lib/github/commands/asciidoc2html
|
66
|
+
lib/github/commands/asciidocapi.py
|
67
|
+
lib/github/commands/rest2html
|
68
|
+
lib/github/markup.rb
|
69
|
+
lib/github/markup/rdoc.rb
|
70
|
+
lib/github/markups.rb
|
71
|
+
test/markup_test.rb
|
72
|
+
test/markups/README.asciidoc
|
73
|
+
test/markups/README.asciidoc.html
|
74
|
+
test/markups/README.creole
|
75
|
+
test/markups/README.creole.html
|
76
|
+
test/markups/README.markdown
|
77
|
+
test/markups/README.markdown.html
|
78
|
+
test/markups/README.mediawiki
|
79
|
+
test/markups/README.mediawiki.html
|
80
|
+
test/markups/README.noformat
|
81
|
+
test/markups/README.noformat.html
|
82
|
+
test/markups/README.org
|
83
|
+
test/markups/README.org.html
|
84
|
+
test/markups/README.pod
|
85
|
+
test/markups/README.pod.html
|
86
|
+
test/markups/README.rdoc
|
87
|
+
test/markups/README.rdoc.html
|
88
|
+
test/markups/README.rst
|
89
|
+
test/markups/README.rst.html
|
90
|
+
test/markups/README.rst.txt
|
91
|
+
test/markups/README.rst.txt.html
|
92
|
+
test/markups/README.textile
|
93
|
+
test/markups/README.textile.html
|
94
|
+
test/markups/README.txt
|
95
|
+
test/markups/README.txt.html
|
96
|
+
]
|
97
|
+
# = MANIFEST =
|
98
|
+
|
99
|
+
## Test files will be grabbed from the file list. Make sure the path glob
|
100
|
+
## matches what you actually use.
|
101
|
+
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
102
|
+
end
|
103
|
+
|
data/lib/github/markup.rb
CHANGED
data/lib/github/markup/rdoc.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rdoc"
|
2
|
+
require "rdoc/markup/to_html"
|
3
3
|
|
4
4
|
module GitHub
|
5
5
|
module Markup
|
@@ -9,11 +9,8 @@ module GitHub
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_html
|
12
|
-
|
13
|
-
|
14
|
-
simple_markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
|
15
|
-
simple_markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
|
16
|
-
simple_markup.convert(@content, generator)
|
12
|
+
h = ::RDoc::Markup::ToHtml.new
|
13
|
+
h.convert(@content)
|
17
14
|
end
|
18
15
|
end
|
19
16
|
end
|
data/lib/github/markups.rb
CHANGED
@@ -1,5 +1,20 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
MD_FILES = /md|mkdn?|mdown|markdown/
|
2
|
+
|
3
|
+
if markup(:redcarpet, MD_FILES) do |content|
|
4
|
+
RedcarpetCompat.new(content).to_html
|
5
|
+
end
|
6
|
+
elsif markup(:rdiscount, MD_FILES) do |content|
|
7
|
+
RDiscount.new(content).to_html
|
8
|
+
end
|
9
|
+
elsif markup(:maruku, MD_FILES) do |content|
|
10
|
+
Maruku.new(content).to_html
|
11
|
+
end
|
12
|
+
elsif markup(:kramdown, MD_FILES) do |content|
|
13
|
+
Kramdown::Document.new(content).to_html
|
14
|
+
end
|
15
|
+
elsif markup(:bluecloth, MD_FILES) do |content|
|
16
|
+
BlueCloth.new(content).to_html
|
17
|
+
end
|
3
18
|
end
|
4
19
|
|
5
20
|
markup(:redcloth, /textile/) do |content|
|
@@ -1,16 +1,11 @@
|
|
1
|
-
<ul>
|
2
|
-
<
|
1
|
+
<ul><li>
|
2
|
+
<p>One</p>
|
3
|
+
</li><li>
|
4
|
+
<p>Two</p>
|
5
|
+
</li></ul>
|
3
6
|
|
4
|
-
</
|
5
|
-
|
7
|
+
<p>This is an <a href="http://github.com">absolute link</a>. So is this: <a
|
8
|
+
href="http://github.com">github.com</a></p>
|
6
9
|
|
7
|
-
</
|
8
|
-
</
|
9
|
-
<p>
|
10
|
-
This is an <a href="http://github.com">absolute link</a>. So is this: <a
|
11
|
-
href="http://github.com">github.com</a>
|
12
|
-
</p>
|
13
|
-
<p>
|
14
|
-
This is a <a href="rawr.html">relative link</a>. So is this: <a
|
15
|
-
href="rawr.html">rawr.html</a>
|
16
|
-
</p>
|
10
|
+
<p>This is a <a href="rawr.html">relative link</a>. So is this: <a
|
11
|
+
href="rawr.html">rawr.html</a></p>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Wanstrath
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-12-07 00:00:00 Z
|
20
19
|
dependencies: []
|
21
20
|
|
22
21
|
description: " This gem is used by GitHub to render any fancy markup such as\n Markdown, Textile, Org-Mode, etc. Fork it and add your own!\n"
|
@@ -25,20 +24,24 @@ executables: []
|
|
25
24
|
|
26
25
|
extensions: []
|
27
26
|
|
28
|
-
extra_rdoc_files:
|
29
|
-
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.md
|
29
|
+
- LICENSE
|
30
30
|
files:
|
31
|
+
- Gemfile
|
32
|
+
- HISTORY.md
|
33
|
+
- LICENSE
|
31
34
|
- README.md
|
32
35
|
- Rakefile
|
33
|
-
-
|
36
|
+
- bin/github-markup
|
37
|
+
- github-markup.gemspec
|
38
|
+
- lib/github-markup.rb
|
34
39
|
- lib/github/commands/asciidoc2html
|
35
40
|
- lib/github/commands/asciidocapi.py
|
36
41
|
- lib/github/commands/rest2html
|
37
|
-
- lib/github/markup/rdoc.rb
|
38
|
-
- lib/github/markup/version.rb
|
39
42
|
- lib/github/markup.rb
|
43
|
+
- lib/github/markup/rdoc.rb
|
40
44
|
- lib/github/markups.rb
|
41
|
-
- bin/github-markup
|
42
45
|
- test/markup_test.rb
|
43
46
|
- test/markups/README.asciidoc
|
44
47
|
- test/markups/README.asciidoc.html
|
@@ -64,13 +67,12 @@ files:
|
|
64
67
|
- test/markups/README.textile.html
|
65
68
|
- test/markups/README.txt
|
66
69
|
- test/markups/README.txt.html
|
67
|
-
|
68
|
-
homepage: http://github.com/github/markup
|
70
|
+
homepage: https://github.com/github/markup
|
69
71
|
licenses: []
|
70
72
|
|
71
73
|
post_install_message:
|
72
|
-
rdoc_options:
|
73
|
-
|
74
|
+
rdoc_options:
|
75
|
+
- --charset=UTF-8
|
74
76
|
require_paths:
|
75
77
|
- lib
|
76
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -93,10 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
95
|
version: "0"
|
94
96
|
requirements: []
|
95
97
|
|
96
|
-
rubyforge_project:
|
97
|
-
rubygems_version: 1.
|
98
|
+
rubyforge_project: github-markup
|
99
|
+
rubygems_version: 1.8.10
|
98
100
|
signing_key:
|
99
|
-
specification_version:
|
101
|
+
specification_version: 2
|
100
102
|
summary: The code GitHub uses to render README.markup
|
101
103
|
test_files: []
|
102
104
|
|