github-markup 0.7.5 → 1.0.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.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/github-markup.gemspec +12 -2
- data/lib/github-markup.rb +1 -1
- data/lib/github/commands/rest2html +8 -0
- data/lib/github/markup.rb +23 -64
- data/lib/github/markup/command_implementation.rb +52 -0
- data/lib/github/markup/gem_implementation.rb +26 -0
- data/lib/github/markup/implementation.rb +28 -0
- data/lib/github/markup/markdown.rb +56 -0
- data/lib/github/markups.rb +2 -20
- data/script/bootstrap +9 -0
- data/script/cibuild +20 -0
- data/test/markup_test.rb +3 -2
- data/test/markups/README.asciidoc.html +6 -8
- data/test/markups/README.lhs.html +1 -1
- data/test/markups/README.litcoffee +59 -0
- data/test/markups/README.litcoffee.html +66 -0
- data/test/markups/README.mediawiki.html +4 -4
- data/test/markups/README.org.html +82 -103
- data/test/markups/README.rst +8 -0
- data/test/markups/README.rst.html +23 -1
- metadata +18 -10
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37119f750db66a695879748bc56748aa31e54ad7
|
4
|
+
data.tar.gz: 2bfd5d36c6933e9de2d9320cdda49735f44f0fd5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ca4a0185167529c03823d514b3c47a2d184e9fcc7461fc6746267a705312a215a4ec8c14f698f8092c20e1c0bd7e8fce56cc7f9919564ff7b85a0bed4c35f8c
|
7
|
+
data.tar.gz: 02272c864ef5e2df2359dcc84319e9da6afebf24b60eb8b29e700b935da0de58a885299acfa897ec4b9415676479b56b9c867775ae4a6b81965a7060d403a3ee
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Markups
|
|
8
8
|
-------
|
9
9
|
|
10
10
|
The following markups are supported. The dependencies listed are required if
|
11
|
-
you wish to run the library.
|
11
|
+
you wish to run the library. You can also run `script/bootstrap` to fetch them all.
|
12
12
|
|
13
13
|
* [.markdown, .mdown, .md](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet` (https://github.com/vmg/redcarpet)
|
14
14
|
* [.textile](http://www.textism.com/tools/textile/) -- `gem install RedCloth`
|
@@ -17,7 +17,7 @@ you wish to run the library.
|
|
17
17
|
* [.creole](http://wikicreole.org/) -- `gem install creole`
|
18
18
|
* [.mediawiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
|
19
19
|
* [.rst](http://docutils.sourceforge.net/rst.html) -- `easy_install docutils`
|
20
|
-
* [.asciidoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
|
20
|
+
* [.asciidoc, .adoc, .asc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
|
21
21
|
* [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML`
|
22
22
|
comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
|
23
23
|
|
@@ -115,6 +115,6 @@ Contributing
|
|
115
115
|
6. Enjoy a refreshing Diet Coke and wait
|
116
116
|
|
117
117
|
|
118
|
-
[r2h]:
|
119
|
-
[r2hc]:
|
118
|
+
[r2h]: lib/github/commands/rest2html
|
119
|
+
[r2hc]: lib/github/markups.rb#L51
|
120
120
|
[1]: http://github.com/github/markup/pulls
|
data/github-markup.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require File.expand_path("../lib/github-markup", __FILE__)
|
2
|
+
|
1
3
|
## This is the rakegem gemspec template. Make sure you read and understand
|
2
4
|
## all of the comments. Some sections require modification, and others can
|
3
5
|
## be deleted if you don't need them. Once you understand the contents of
|
@@ -13,8 +15,8 @@ Gem::Specification.new do |s|
|
|
13
15
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
16
|
## the sub! line in the Rakefile
|
15
17
|
s.name = 'github-markup'
|
16
|
-
s.version =
|
17
|
-
s.date = '
|
18
|
+
s.version = GitHub::Markup::VERSION
|
19
|
+
s.date = '2013-12-04'
|
18
20
|
s.executables = ['github-markup']
|
19
21
|
|
20
22
|
## Make sure your summary is short. The description may be as long
|
@@ -64,8 +66,14 @@ desc
|
|
64
66
|
lib/github-markup.rb
|
65
67
|
lib/github/commands/rest2html
|
66
68
|
lib/github/markup.rb
|
69
|
+
lib/github/markup/command_implementation.rb
|
70
|
+
lib/github/markup/gem_implementation.rb
|
71
|
+
lib/github/markup/implementation.rb
|
72
|
+
lib/github/markup/markdown.rb
|
67
73
|
lib/github/markup/rdoc.rb
|
68
74
|
lib/github/markups.rb
|
75
|
+
script/bootstrap
|
76
|
+
script/cibuild
|
69
77
|
test/markup_test.rb
|
70
78
|
test/markups/README.asciidoc
|
71
79
|
test/markups/README.asciidoc.html
|
@@ -73,6 +81,8 @@ desc
|
|
73
81
|
test/markups/README.creole.html
|
74
82
|
test/markups/README.lhs
|
75
83
|
test/markups/README.lhs.html
|
84
|
+
test/markups/README.litcoffee
|
85
|
+
test/markups/README.litcoffee.html
|
76
86
|
test/markups/README.markdown
|
77
87
|
test/markups/README.markdown.html
|
78
88
|
test/markups/README.mediawiki
|
data/lib/github-markup.rb
CHANGED
@@ -40,6 +40,14 @@ class GitHubHTMLTranslator(HTMLTranslator):
|
|
40
40
|
else:
|
41
41
|
self.body.append(self.starttag(node, 'pre'))
|
42
42
|
|
43
|
+
def visit_table(self, node):
|
44
|
+
classes = ' '.join(['docutils', self.settings.table_style]).strip()
|
45
|
+
self.body.append(
|
46
|
+
self.starttag(node, 'table', CLASS=classes))
|
47
|
+
|
48
|
+
def depart_table(self, node):
|
49
|
+
self.body.append('</table>\n')
|
50
|
+
|
43
51
|
def main():
|
44
52
|
"""
|
45
53
|
Parses the given ReST file or the redirected string input and returns the
|
data/lib/github/markup.rb
CHANGED
@@ -1,59 +1,41 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
rescue LoadError
|
4
|
-
require 'open3'
|
5
|
-
end
|
1
|
+
require "github/markup/command_implementation"
|
2
|
+
require "github/markup/gem_implementation"
|
6
3
|
|
7
4
|
module GitHub
|
8
5
|
module Markup
|
9
6
|
extend self
|
10
|
-
@@markups =
|
7
|
+
@@markups = []
|
8
|
+
|
9
|
+
def markups
|
10
|
+
@@markups
|
11
|
+
end
|
12
|
+
|
13
|
+
def preload!
|
14
|
+
markups.each do |markup|
|
15
|
+
markup.load
|
16
|
+
end
|
17
|
+
end
|
11
18
|
|
12
19
|
def render(filename, content = nil)
|
13
20
|
content ||= File.read(filename)
|
14
21
|
|
15
|
-
if
|
16
|
-
|
22
|
+
if impl = renderer(filename)
|
23
|
+
impl.render(content)
|
17
24
|
else
|
18
25
|
content
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
|
-
def markup(file, pattern, &block)
|
23
|
-
|
24
|
-
add_markup(pattern, &block)
|
25
|
-
true
|
26
|
-
rescue LoadError
|
27
|
-
false
|
29
|
+
def markup(file, pattern, opts = {}, &block)
|
30
|
+
markups << GemImplementation.new(pattern, file, &block)
|
28
31
|
end
|
29
32
|
|
30
33
|
def command(command, regexp, &block)
|
31
|
-
command = command.to_s
|
32
|
-
|
33
34
|
if File.exists?(file = File.dirname(__FILE__) + "/commands/#{command}")
|
34
35
|
command = file
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
-
rendered = execute(command, content)
|
39
|
-
rendered = rendered.to_s.empty? ? content : rendered
|
40
|
-
|
41
|
-
if block && block.arity == 2
|
42
|
-
# If the block takes two arguments, pass new content and old
|
43
|
-
# content.
|
44
|
-
block.call(rendered, content)
|
45
|
-
elsif block
|
46
|
-
# One argument is just the new content.
|
47
|
-
block.call(rendered)
|
48
|
-
else
|
49
|
-
# No block? No problem!
|
50
|
-
rendered
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def add_markup(regexp, &block)
|
56
|
-
@@markups[regexp] = block
|
38
|
+
markups << CommandImplementation.new(regexp, command, &block)
|
57
39
|
end
|
58
40
|
|
59
41
|
def can_render?(filename)
|
@@ -61,36 +43,13 @@ module GitHub
|
|
61
43
|
end
|
62
44
|
|
63
45
|
def renderer(filename)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
69
|
-
nil
|
70
|
-
end
|
71
|
-
|
72
|
-
def renderer_name(filename)
|
73
|
-
@@markups.each do |key, value|
|
74
|
-
if Regexp.compile("\\.(#{key})$") =~ filename
|
75
|
-
return key
|
76
|
-
end
|
77
|
-
end
|
78
|
-
nil
|
79
|
-
end
|
80
|
-
|
81
|
-
def execute(command, target)
|
82
|
-
out = ''
|
83
|
-
Open3.popen3(command) do |stdin, stdout, _|
|
84
|
-
stdin.puts target
|
85
|
-
stdin.close
|
86
|
-
out = stdout.read
|
87
|
-
end
|
88
|
-
out.gsub("\r", '')
|
89
|
-
rescue Errno::EPIPE
|
90
|
-
""
|
46
|
+
markups.find { |impl|
|
47
|
+
impl.match?(filename)
|
48
|
+
}
|
91
49
|
end
|
92
50
|
|
93
51
|
# Define markups
|
94
|
-
|
52
|
+
markups_rb = File.dirname(__FILE__) + '/markups.rb'
|
53
|
+
instance_eval File.read(markups_rb), markups_rb
|
95
54
|
end
|
96
55
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
begin
|
2
|
+
require "open3_detach"
|
3
|
+
rescue LoadError
|
4
|
+
require "open3"
|
5
|
+
end
|
6
|
+
|
7
|
+
require "github/markup/implementation"
|
8
|
+
|
9
|
+
module GitHub
|
10
|
+
module Markup
|
11
|
+
class CommandImplementation < Implementation
|
12
|
+
attr_reader :command, :block
|
13
|
+
|
14
|
+
def initialize(regexp, command, &block)
|
15
|
+
super regexp
|
16
|
+
@command = command.to_s
|
17
|
+
@block = block
|
18
|
+
end
|
19
|
+
|
20
|
+
def render(content)
|
21
|
+
rendered = execute(command, content)
|
22
|
+
rendered = rendered.to_s.empty? ? content : rendered
|
23
|
+
call_block(rendered, content)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def call_block(rendered, content)
|
28
|
+
if block && block.arity == 2
|
29
|
+
block.call(rendered, content)
|
30
|
+
elsif block
|
31
|
+
block.call(rendered)
|
32
|
+
else
|
33
|
+
rendered
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def execute(command, target)
|
38
|
+
out = ''
|
39
|
+
Open3.popen3(command) do |stdin, stdout, _|
|
40
|
+
stdin.puts target
|
41
|
+
stdin.close
|
42
|
+
out = stdout.read
|
43
|
+
end
|
44
|
+
out.gsub("\r", '')
|
45
|
+
rescue Errno::EPIPE
|
46
|
+
""
|
47
|
+
rescue Errno::ENOENT
|
48
|
+
""
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "github/markup/implementation"
|
2
|
+
|
3
|
+
module GitHub
|
4
|
+
module Markup
|
5
|
+
class GemImplementation < Implementation
|
6
|
+
attr_reader :gem_name, :renderer
|
7
|
+
|
8
|
+
def initialize(regexp, gem_name, &renderer)
|
9
|
+
super regexp
|
10
|
+
@gem_name = gem_name.to_s
|
11
|
+
@renderer = renderer
|
12
|
+
end
|
13
|
+
|
14
|
+
def load
|
15
|
+
return if @loaded
|
16
|
+
require gem_name
|
17
|
+
@loaded = true
|
18
|
+
end
|
19
|
+
|
20
|
+
def render(content)
|
21
|
+
load
|
22
|
+
renderer.call(content)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GitHub
|
2
|
+
module Markup
|
3
|
+
class Implementation
|
4
|
+
attr_reader :regexp
|
5
|
+
|
6
|
+
def initialize(regexp)
|
7
|
+
@regexp = regexp
|
8
|
+
end
|
9
|
+
|
10
|
+
def load
|
11
|
+
# no-op by default
|
12
|
+
end
|
13
|
+
|
14
|
+
def render(content)
|
15
|
+
raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render"
|
16
|
+
end
|
17
|
+
|
18
|
+
def match?(filename)
|
19
|
+
file_ext_regexp =~ filename
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def file_ext_regexp
|
24
|
+
@file_ext_regexp ||= /\.(#{regexp})\z/
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "github/markup/implementation"
|
2
|
+
|
3
|
+
module GitHub
|
4
|
+
module Markup
|
5
|
+
class Markdown < Implementation
|
6
|
+
MARKDOWN_GEMS = {
|
7
|
+
"github/markdown" => proc { |content|
|
8
|
+
GitHub::Markdown.render(content)
|
9
|
+
},
|
10
|
+
"redcarpet" => proc { |content|
|
11
|
+
RedcarpetCompat.new(content).to_html
|
12
|
+
},
|
13
|
+
"rdiscount" => proc { |content|
|
14
|
+
RDiscount.new(content).to_html
|
15
|
+
},
|
16
|
+
"maruku" => proc { |content|
|
17
|
+
Maruku.new(content).to_html
|
18
|
+
},
|
19
|
+
"kramdown" => proc { |content|
|
20
|
+
Kramdown::Document.new(content).to_html
|
21
|
+
},
|
22
|
+
"bluecloth" => proc { |content|
|
23
|
+
BlueCloth.new(content).to_html
|
24
|
+
},
|
25
|
+
}
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
super(/md|mkdn?|mdwn|mdown|markdown|litcoffee/)
|
29
|
+
end
|
30
|
+
|
31
|
+
def load
|
32
|
+
return if @renderer
|
33
|
+
MARKDOWN_GEMS.each do |gem_name, renderer|
|
34
|
+
if try_require(gem_name)
|
35
|
+
@renderer = renderer
|
36
|
+
return
|
37
|
+
end
|
38
|
+
end
|
39
|
+
raise LoadError, "no suitable markdown gem found"
|
40
|
+
end
|
41
|
+
|
42
|
+
def render(content)
|
43
|
+
load
|
44
|
+
@renderer.call(content)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def try_require(file)
|
49
|
+
require file
|
50
|
+
true
|
51
|
+
rescue LoadError
|
52
|
+
false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/github/markups.rb
CHANGED
@@ -1,24 +1,6 @@
|
|
1
|
-
|
1
|
+
require "github/markup/markdown"
|
2
2
|
|
3
|
-
|
4
|
-
GitHub::Markdown.render(content)
|
5
|
-
end
|
6
|
-
elsif markup(:redcarpet, MD_FILES) do |content|
|
7
|
-
RedcarpetCompat.new(content).to_html
|
8
|
-
end
|
9
|
-
elsif markup(:rdiscount, MD_FILES) do |content|
|
10
|
-
RDiscount.new(content).to_html
|
11
|
-
end
|
12
|
-
elsif markup(:maruku, MD_FILES) do |content|
|
13
|
-
Maruku.new(content).to_html
|
14
|
-
end
|
15
|
-
elsif markup(:kramdown, MD_FILES) do |content|
|
16
|
-
Kramdown::Document.new(content).to_html
|
17
|
-
end
|
18
|
-
elsif markup(:bluecloth, MD_FILES) do |content|
|
19
|
-
BlueCloth.new(content).to_html
|
20
|
-
end
|
21
|
-
end
|
3
|
+
markups << GitHub::Markup::Markdown.new
|
22
4
|
|
23
5
|
markup(:redcloth, /textile/) do |content|
|
24
6
|
RedCloth.new(content).to_html
|
data/script/bootstrap
ADDED
data/script/cibuild
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
# GC customizations
|
6
|
+
export RUBY_GC_MALLOC_LIMIT=79000000
|
7
|
+
export RUBY_HEAP_MIN_SLOTS=800000
|
8
|
+
export RUBY_HEAP_FREE_MIN=100000
|
9
|
+
export RUBY_HEAP_SLOTS_INCREMENT=400000
|
10
|
+
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
|
11
|
+
|
12
|
+
export PATH="/usr/share/rbenv/shims:$PATH"
|
13
|
+
export RBENV_VERSION="1.9.3"
|
14
|
+
|
15
|
+
# bootstrap gem environment changes
|
16
|
+
echo "Bootstrapping gem environment ..."
|
17
|
+
|
18
|
+
script/bootstrap --local
|
19
|
+
|
20
|
+
rake
|
data/test/markup_test.rb
CHANGED
@@ -12,8 +12,8 @@ class MarkupTest < Test::Unit::TestCase
|
|
12
12
|
source = File.read(readme)
|
13
13
|
|
14
14
|
expected_file = "#{readme}.html"
|
15
|
-
expected = File.read(expected_file)
|
16
|
-
actual = GitHub::Markup.render(readme, File.read(readme))
|
15
|
+
expected = File.read(expected_file).rstrip
|
16
|
+
actual = GitHub::Markup.render(readme, File.read(readme)).rstrip
|
17
17
|
|
18
18
|
if source != expected
|
19
19
|
assert(source != actual, "#{markup} did not render anything")
|
@@ -36,6 +36,7 @@ message
|
|
36
36
|
assert_equal false, GitHub::Markup.can_render?('README.html')
|
37
37
|
assert_equal true, GitHub::Markup.can_render?('README.markdown')
|
38
38
|
assert_equal false, GitHub::Markup.can_render?('README.cmd')
|
39
|
+
assert_equal true, GitHub::Markup.can_render?('README.litcoffee')
|
39
40
|
end
|
40
41
|
|
41
42
|
def test_fails_gracefully_on_missing_commands
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<p>Except with more magic added.</p>
|
4
4
|
|
5
|
-
<pre><code class="haskell">isPrefixOf :: (Eq a) => [a]
|
5
|
+
<pre><code class="haskell">isPrefixOf :: (Eq a) => [a] -> [a] -> Bool
|
6
6
|
isPrefixOf [] _ = True
|
7
7
|
isPrefixOf _ [] = False
|
8
8
|
isPrefixOf (x:xs) (y:ys)= x == y && isPrefixOf xs ys
|
@@ -0,0 +1,59 @@
|
|
1
|
+
Literate CoffeeScript Test
|
2
|
+
--------------------------
|
3
|
+
|
4
|
+
> Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee
|
5
|
+
|
6
|
+
comment comment
|
7
|
+
|
8
|
+
test "basic literate CoffeeScript parsing", ->
|
9
|
+
ok yes
|
10
|
+
|
11
|
+
now with a...
|
12
|
+
|
13
|
+
test "broken up indentation", ->
|
14
|
+
|
15
|
+
... broken up ...
|
16
|
+
|
17
|
+
do ->
|
18
|
+
|
19
|
+
... nested block.
|
20
|
+
|
21
|
+
ok yes
|
22
|
+
|
23
|
+
Code must be separated from text by a blank line.
|
24
|
+
|
25
|
+
test "code blocks must be preceded by a blank line", ->
|
26
|
+
|
27
|
+
The next line is part of the text and will not be executed.
|
28
|
+
fail()
|
29
|
+
|
30
|
+
ok yes
|
31
|
+
|
32
|
+
Code in `backticks is not parsed` and...
|
33
|
+
|
34
|
+
test "comments in indented blocks work", ->
|
35
|
+
do ->
|
36
|
+
do ->
|
37
|
+
# Regular comment.
|
38
|
+
|
39
|
+
###
|
40
|
+
Block comment.
|
41
|
+
###
|
42
|
+
|
43
|
+
ok yes
|
44
|
+
|
45
|
+
Regular [Markdown](http://example.com/markdown) features,
|
46
|
+
like links and unordered lists, are fine:
|
47
|
+
|
48
|
+
* I
|
49
|
+
|
50
|
+
* Am
|
51
|
+
|
52
|
+
* A
|
53
|
+
|
54
|
+
* List
|
55
|
+
|
56
|
+
Tabs work too:
|
57
|
+
|
58
|
+
test "tabbed code", ->
|
59
|
+
ok yes
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<h2>Literate CoffeeScript Test</h2>
|
2
|
+
|
3
|
+
<blockquote>
|
4
|
+
<p>Taken from https://github.com/jashkenas/coffee-script/blob/master/test/literate.litcoffee</p>
|
5
|
+
</blockquote>
|
6
|
+
|
7
|
+
<p>comment comment</p>
|
8
|
+
|
9
|
+
<pre><code>test "basic literate CoffeeScript parsing", ->
|
10
|
+
ok yes
|
11
|
+
</code></pre>
|
12
|
+
|
13
|
+
<p>now with a...</p>
|
14
|
+
|
15
|
+
<pre><code>test "broken up indentation", ->
|
16
|
+
</code></pre>
|
17
|
+
|
18
|
+
<p>... broken up ...</p>
|
19
|
+
|
20
|
+
<pre><code> do ->
|
21
|
+
</code></pre>
|
22
|
+
|
23
|
+
<p>... nested block.</p>
|
24
|
+
|
25
|
+
<pre><code> ok yes
|
26
|
+
</code></pre>
|
27
|
+
|
28
|
+
<p>Code must be separated from text by a blank line.</p>
|
29
|
+
|
30
|
+
<pre><code>test "code blocks must be preceded by a blank line", ->
|
31
|
+
</code></pre>
|
32
|
+
|
33
|
+
<p>The next line is part of the text and will not be executed.
|
34
|
+
fail()</p>
|
35
|
+
|
36
|
+
<pre><code> ok yes
|
37
|
+
</code></pre>
|
38
|
+
|
39
|
+
<p>Code in <code>backticks is not parsed</code> and...</p>
|
40
|
+
|
41
|
+
<pre><code>test "comments in indented blocks work", ->
|
42
|
+
do ->
|
43
|
+
do ->
|
44
|
+
# Regular comment.
|
45
|
+
|
46
|
+
###
|
47
|
+
Block comment.
|
48
|
+
###
|
49
|
+
|
50
|
+
ok yes
|
51
|
+
</code></pre>
|
52
|
+
|
53
|
+
<p>Regular <a href="http://example.com/markdown">Markdown</a> features,
|
54
|
+
like links and unordered lists, are fine:</p>
|
55
|
+
|
56
|
+
<ul>
|
57
|
+
<li><p>I</p></li>
|
58
|
+
<li><p>Am</p></li>
|
59
|
+
<li><p>A</p></li>
|
60
|
+
<li><p>List</p></li>
|
61
|
+
</ul>
|
62
|
+
|
63
|
+
<p>Tabs work too:</p>
|
64
|
+
|
65
|
+
<p>test "tabbed code", ->
|
66
|
+
ok yes</p>
|
@@ -9,12 +9,12 @@ Using Java from Ruby is JRuby's best-known feature---but you can also go in the
|
|
9
9
|
<table id="toc" class="toc" summary="Contents"><tr><td><div style="font-weight:bold">Table of Contents</div><ul></ul></td></tr></table>
|
10
10
|
|
11
11
|
</p><p>
|
12
|
-
<h1> <span class="mw-headline"
|
12
|
+
<h1> <span id="Red_Bridge_JRuby_Embed" class="mw-headline">Red Bridge (JRuby Embed)</span></h1>
|
13
13
|
|
14
14
|
JRuby has long had a private embedding API, which was closely tied to the runtime's internals and therefore changed frequently as JRuby evolved. Since version 1.4, however, we have also provided a more stable public API, known as Red Bridge or JRuby Embed. Existing Java programs written to the <a href="javascript:void(0)">legacy API</a> should still work, but we strongly recommend Red Bridge for all new projects.
|
15
15
|
|
16
16
|
</p><p>
|
17
|
-
<h2> <span class="mw-headline"
|
17
|
+
<h2> <span id="Features_of_Red_Bridge" class="mw-headline">Features of Red Bridge</span></h2>Red Bridge consists of two layers: Embed Core on the bottom, and implementations of <a href="http://www.jcp.org/en/jsr/detail?id=223">JSR223</a> and <a href="http://jakarta.apache.org/bsf/">BSF</a> on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages.
|
18
18
|
|
19
19
|
</p><p>
|
20
20
|
Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons:
|
@@ -31,5 +31,5 @@ Which API should you use? For projects where Ruby is the only scripting language
|
|
31
31
|
The full <a href="http://jruby-embed.kenai.com/docs/">API documentation</a> has all the gory details. It's worth talking about a couple of the finer points here.
|
32
32
|
|
33
33
|
</p><p>
|
34
|
-
<h1> <span class="mw-headline"
|
35
|
-
</p>
|
34
|
+
<h1> <span id="Previous_Embedding_JRuby_Page" class="mw-headline">Previous Embedding JRuby Page</span></h1>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <a href="javascript:void(0)">legacy embedding</a> page.
|
35
|
+
</p>
|
@@ -4,133 +4,112 @@
|
|
4
4
|
<tr><td>Location:</td><td><a href="http://github.com/bdewey/org-ruby">http://github.com/bdewey/org-ruby</a></td></tr>
|
5
5
|
<tr><td>Version:</td><td>0.5.1</td></tr>
|
6
6
|
</table>
|
7
|
-
<h1><span class="heading-number heading-number-1">1
|
8
|
-
<p>Helpful Ruby routines for parsing orgmode files. The most
|
9
|
-
|
10
|
-
|
7
|
+
<h1><span class="heading-number heading-number-1">1</span> Description</h1>
|
8
|
+
<p>Helpful Ruby routines for parsing orgmode files. The most
|
9
|
+
significant thing this library does today is convert orgmode files
|
10
|
+
to textile. Currently, you cannot do much to customize the
|
11
|
+
conversion. The supplied textile conversion is optimized for
|
12
|
+
extracting “content” from the orgfile as opposed to “metadata.”</p>
|
13
|
+
<h1><span class="heading-number heading-number-1">2</span> History</h1>
|
14
|
+
<h2><span class="heading-number heading-number-2">2.1</span> 2009-12-30: Version 0.5.1</h2>
|
11
15
|
<ul>
|
12
|
-
<li>Minor enhancement: Recognize lines starting with “:” as examples
|
13
|
-
</li>
|
14
|
-
<li>Minor enhancement:
|
15
|
-
</li>
|
16
|
-
<li>Minor enhancement: Add “src” and “example” classes to <pre> blocks.
|
17
|
-
</li>
|
16
|
+
<li>Minor enhancement: Recognize lines starting with “:” as examples.</li>
|
17
|
+
<li>Minor enhancement: Recognize #+BEGIN_SRC as source blocks</li>
|
18
|
+
<li>Minor enhancement: Add “src” and “example” classes to <pre> blocks.</li>
|
18
19
|
</ul>
|
19
|
-
<h2><span class="heading-number heading-number-2">2.2
|
20
|
+
<h2><span class="heading-number heading-number-2">2.2</span> 2009-12-30: Version 0.5.0</h2>
|
20
21
|
<ul>
|
21
|
-
<li>Parse (but not necessarily <b>use</b>) in-buffer settings. The following
|
22
|
-
|
23
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
</
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
</ul>
|
38
|
-
</li>
|
39
|
-
<li>Rewrite “file:(blah).org” links to “http:(blah).html” links. This makes the inter-links to other org-mode files work.
|
40
|
-
</li>
|
41
|
-
<li>Uses <th> tags inside table rows that precede table separators.
|
42
|
-
</li>
|
22
|
+
<li>Parse (but not necessarily <b>use</b>) in-buffer settings. The following
|
23
|
+
in-buffer settings <b>are</b> used:
|
24
|
+
<ul>
|
25
|
+
<li>Understand the #+TITLE: directive.</li>
|
26
|
+
<li>Exporting todo keywords (option todo:t)</li>
|
27
|
+
<li>Numbering headlines (option num:t)</li>
|
28
|
+
<li>Skipping text before the first headline (option skip:t)</li>
|
29
|
+
<li>Skipping tables (option |:nil)</li>
|
30
|
+
<li>Custom todo keywords</li>
|
31
|
+
<li>EXPORT_SELECT_TAGS and EXPORT_EXLUDE_TAGS for controlling parts of
|
32
|
+
the tree to export</li>
|
33
|
+
</ul>
|
34
|
+
</li>
|
35
|
+
<li>Rewrite “file:(blah).org” links to “http:(blah).html” links. This
|
36
|
+
makes the inter-links to other org-mode files work.</li>
|
37
|
+
<li>Uses <th> tags inside table rows that precede table separators.</li>
|
43
38
|
<li>Bugfixes:
|
44
|
-
|
45
|
-
|
46
|
-
</
|
47
|
-
</ul>
|
39
|
+
<ul>
|
40
|
+
<li>Headings now have HTML escaped.</li>
|
41
|
+
</ul>
|
48
42
|
</li>
|
49
43
|
</ul>
|
50
|
-
<h2><span class="heading-number heading-number-2">2.3
|
44
|
+
<h2><span class="heading-number heading-number-2">2.3</span> 2009-12-29: Version 0.4.2</h2>
|
51
45
|
<ul>
|
52
|
-
<li>Got rid of the extraneous newline at the start of code blocks
|
53
|
-
|
54
|
-
<li>Everything now shows up in code blocks, even org-mode metadata.
|
55
|
-
</li>
|
46
|
+
<li>Got rid of the extraneous newline at the start of code blocks.</li>
|
47
|
+
<li>Everything now shows up in code blocks, even org-mode metadata.</li>
|
56
48
|
<li>Fixed bugs:
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
49
|
+
<ul>
|
50
|
+
<li>Regressed smart double quotes with HTML escaping. Added a test
|
51
|
+
case and fixed the regression.</li>
|
52
|
+
</ul>
|
61
53
|
</li>
|
62
54
|
</ul>
|
63
|
-
<h2><span class="heading-number heading-number-2">2.4
|
55
|
+
<h2><span class="heading-number heading-number-2">2.4</span> 2009-12-29: Version 0.4.1</h2>
|
64
56
|
<ul>
|
65
|
-
<li>HTML is now escaped by default
|
66
|
-
|
67
|
-
<li>org-mode comments will show up in a code block.
|
68
|
-
</li>
|
57
|
+
<li>HTML is now escaped by default</li>
|
58
|
+
<li>org-mode comments will show up in a code block.</li>
|
69
59
|
</ul>
|
70
|
-
<h2><span class="heading-number heading-number-2">2.5
|
60
|
+
<h2><span class="heading-number heading-number-2">2.5</span> 2009-12-29: Version 0.4</h2>
|
71
61
|
<ul>
|
72
|
-
<li>The first thing output in HTML gets the class “title”
|
73
|
-
</li>
|
74
|
-
<li>HTML output is now indented
|
75
|
-
</li>
|
62
|
+
<li>The first thing output in HTML gets the class “title”</li>
|
63
|
+
<li>HTML output is now indented</li>
|
76
64
|
<li>Proper support for multi-paragraph list items.
|
77
|
-
|
65
|
+
<p>See? This paragraph is part of the last bullet.</p>
|
78
66
|
</li>
|
79
67
|
<li>Fixed bugs:
|
80
|
-
|
81
|
-
|
82
|
-
</
|
83
|
-
</ul>
|
68
|
+
<ul>
|
69
|
+
<li>“rake spec” wouldn’t work on Linux. Needed “require ‘rubygems’”.</li>
|
70
|
+
</ul>
|
84
71
|
</li>
|
85
72
|
</ul>
|
86
|
-
<h2><span class="heading-number heading-number-2">2.6
|
73
|
+
<h2><span class="heading-number heading-number-2">2.6</span> 2009-12-27: Version 0.3</h2>
|
87
74
|
<ul>
|
88
|
-
<li>Uses rubypants to get better typography (smart quotes, elipses, etc…)
|
89
|
-
</li>
|
75
|
+
<li>Uses rubypants to get better typography (smart quotes, elipses, etc…).</li>
|
90
76
|
<li>Fixed bugs:
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
</
|
96
|
-
<li>Characters in PRE blocks were not HTML escaped.
|
97
|
-
</li>
|
98
|
-
</ul>
|
77
|
+
<ul>
|
78
|
+
<li>Tables and lists did not get properly closed at the end of file</li>
|
79
|
+
<li>You couldn’t do inline formatting inside table cells</li>
|
80
|
+
<li>Characters in PRE blocks were not HTML escaped.</li>
|
81
|
+
</ul>
|
99
82
|
</li>
|
100
83
|
</ul>
|
101
|
-
<h2><span class="heading-number heading-number-2">2.7
|
84
|
+
<h2><span class="heading-number heading-number-2">2.7</span> 2009-12-26: Version 0.2</h2>
|
102
85
|
<ul>
|
103
|
-
<li>Added <code>to_html</code> output on the parser
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
<li>Lots of refactoring to make the code more maintainable.
|
108
|
-
</li>
|
86
|
+
<li>Added <code>to_html</code> output on the parser.</li>
|
87
|
+
<li>Added support for the full range of inline markup: <b>bold</b>,
|
88
|
+
<i>italic</i>, <code>code</code>, <code>verbatim</code>, <span style="text-decoration:underline;">underline</span>, <del>strikethrough</del>.</li>
|
89
|
+
<li>Lots of refactoring to make the code more maintainable.</li>
|
109
90
|
</ul>
|
110
|
-
<h2><span class="heading-number heading-number-2">2.8
|
91
|
+
<h2><span class="heading-number heading-number-2">2.8</span> 2009-12-23: Version 0.1</h2>
|
111
92
|
<ul>
|
112
93
|
<li>Added support for block code, like this:
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
</li>
|
130
|
-
<
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
</li>
|
135
|
-
</ul>
|
94
|
+
<pre class="example">
|
95
|
+
def flush!
|
96
|
+
@logger.debug "FLUSH ==========> #{@output_type}"
|
97
|
+
if (@output_type == :blank) then
|
98
|
+
@output << "\n"
|
99
|
+
elsif (@buffer.length > 0) then
|
100
|
+
if @cancel_modifier then
|
101
|
+
@output << "p. " if @output_type == :paragraph
|
102
|
+
@cancel_modifier = false
|
103
|
+
end
|
104
|
+
@output << @paragraph_modifier if (@paragraph_modifier and not sticky_modifier?)
|
105
|
+
@output << @buffer.textile_substitution << "\n"
|
106
|
+
end
|
107
|
+
@buffer = ""
|
108
|
+
end
|
109
|
+
</pre>
|
110
|
+
</li>
|
111
|
+
<li>Major code cleanup: Created the <code>OutputBuffer</code> class that
|
112
|
+
greatly simplified a lot of the messiness of <code>textile</code>
|
113
|
+
conversion.</li>
|
114
|
+
<li>Added support for line breaks within list items.</li>
|
136
115
|
</ul>
|
data/test/markups/README.rst
CHANGED
@@ -11,3 +11,11 @@ Header 2
|
|
11
11
|
2. More ``code``, hooray
|
12
12
|
|
13
13
|
3. Somé UTF-8°
|
14
|
+
|
15
|
+
============== ==========================================================
|
16
|
+
Travis http://travis-ci.org/tony/pullv
|
17
|
+
Docs http://pullv.rtfd.org
|
18
|
+
API http://pullv.readthedocs.org/en/latest/api.html
|
19
|
+
Issues https://github.com/tony/pullv/issues
|
20
|
+
Source https://github.com/tony/pullv
|
21
|
+
============== ==========================================================
|
@@ -9,7 +9,29 @@
|
|
9
9
|
<li>More <tt class="docutils literal">code</tt>, hooray</li>
|
10
10
|
<li>Somé UTF-8°</li>
|
11
11
|
</ol>
|
12
|
+
<table class="docutils">
|
13
|
+
<colgroup>
|
14
|
+
<col width="19%" />
|
15
|
+
<col width="81%" />
|
16
|
+
</colgroup>
|
17
|
+
<tbody valign="top">
|
18
|
+
<tr><td>Travis</td>
|
19
|
+
<td><a class="reference external" href="http://travis-ci.org/tony/pullv">http://travis-ci.org/tony/pullv</a></td>
|
20
|
+
</tr>
|
21
|
+
<tr><td>Docs</td>
|
22
|
+
<td><a class="reference external" href="http://pullv.rtfd.org">http://pullv.rtfd.org</a></td>
|
23
|
+
</tr>
|
24
|
+
<tr><td>API</td>
|
25
|
+
<td><a class="reference external" href="http://pullv.readthedocs.org/en/latest/api.html">http://pullv.readthedocs.org/en/latest/api.html</a></td>
|
26
|
+
</tr>
|
27
|
+
<tr><td>Issues</td>
|
28
|
+
<td><a class="reference external" href="https://github.com/tony/pullv/issues">https://github.com/tony/pullv/issues</a></td>
|
29
|
+
</tr>
|
30
|
+
<tr><td>Source</td>
|
31
|
+
<td><a class="reference external" href="https://github.com/tony/pullv">https://github.com/tony/pullv</a></td>
|
32
|
+
</tr>
|
33
|
+
</tbody>
|
34
|
+
</table>
|
12
35
|
</div>
|
13
36
|
</div>
|
14
37
|
</div>
|
15
|
-
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Chris Wanstrath
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
description:
|
15
|
-
|
13
|
+
description: |2
|
14
|
+
This gem is used by GitHub to render any fancy markup such as
|
15
|
+
Markdown, Textile, Org-Mode, etc. Fork it and add your own!
|
16
16
|
email: chris@ozmm.org
|
17
17
|
executables:
|
18
18
|
- github-markup
|
@@ -31,8 +31,14 @@ files:
|
|
31
31
|
- lib/github-markup.rb
|
32
32
|
- lib/github/commands/rest2html
|
33
33
|
- lib/github/markup.rb
|
34
|
+
- lib/github/markup/command_implementation.rb
|
35
|
+
- lib/github/markup/gem_implementation.rb
|
36
|
+
- lib/github/markup/implementation.rb
|
37
|
+
- lib/github/markup/markdown.rb
|
34
38
|
- lib/github/markup/rdoc.rb
|
35
39
|
- lib/github/markups.rb
|
40
|
+
- script/bootstrap
|
41
|
+
- script/cibuild
|
36
42
|
- test/markup_test.rb
|
37
43
|
- test/markups/README.asciidoc
|
38
44
|
- test/markups/README.asciidoc.html
|
@@ -40,6 +46,8 @@ files:
|
|
40
46
|
- test/markups/README.creole.html
|
41
47
|
- test/markups/README.lhs
|
42
48
|
- test/markups/README.lhs.html
|
49
|
+
- test/markups/README.litcoffee
|
50
|
+
- test/markups/README.litcoffee.html
|
43
51
|
- test/markups/README.markdown
|
44
52
|
- test/markups/README.markdown.html
|
45
53
|
- test/markups/README.mediawiki
|
@@ -62,27 +70,27 @@ files:
|
|
62
70
|
- test/markups/README.txt.html
|
63
71
|
homepage: https://github.com/github/markup
|
64
72
|
licenses: []
|
73
|
+
metadata: {}
|
65
74
|
post_install_message:
|
66
75
|
rdoc_options:
|
67
76
|
- --charset=UTF-8
|
68
77
|
require_paths:
|
69
78
|
- lib
|
70
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
80
|
requirements:
|
73
|
-
- -
|
81
|
+
- - '>='
|
74
82
|
- !ruby/object:Gem::Version
|
75
83
|
version: '0'
|
76
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
85
|
requirements:
|
79
|
-
- -
|
86
|
+
- - '>='
|
80
87
|
- !ruby/object:Gem::Version
|
81
88
|
version: '0'
|
82
89
|
requirements: []
|
83
90
|
rubyforge_project:
|
84
|
-
rubygems_version:
|
91
|
+
rubygems_version: 2.0.3
|
85
92
|
signing_key:
|
86
93
|
specification_version: 2
|
87
94
|
summary: The code GitHub uses to render README.markup
|
88
95
|
test_files: []
|
96
|
+
has_rdoc:
|