github-markup 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY.md +4 -0
- data/lib/github/markup.rb +3 -2
- data/lib/github/markup/version.rb +1 -1
- data/lib/github/markups.rb +1 -1
- data/test/markup_test.rb +2 -2
- data/test/markups/README.asciidoc.html +0 -1
- metadata +1 -1
data/HISTORY.md
CHANGED
data/lib/github/markup.rb
CHANGED
@@ -31,10 +31,9 @@ module GitHub
|
|
31
31
|
command = file
|
32
32
|
end
|
33
33
|
|
34
|
-
return if !system("which #{command} > /dev/null")
|
35
|
-
|
36
34
|
add_markup(regexp) do |content|
|
37
35
|
rendered = execute(command, content)
|
36
|
+
rendered = rendered.to_s.empty? ? content : rendered
|
38
37
|
block ? block.call(rendered) : rendered
|
39
38
|
end
|
40
39
|
end
|
@@ -64,6 +63,8 @@ module GitHub
|
|
64
63
|
out = stdout.read
|
65
64
|
end
|
66
65
|
out.gsub("\r", '')
|
66
|
+
rescue Errno::EPIPE
|
67
|
+
""
|
67
68
|
end
|
68
69
|
|
69
70
|
# Define markups
|
data/lib/github/markups.rb
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
|
13
13
|
command(:rest2html, /rest|rst/)
|
14
14
|
|
15
|
-
command(
|
15
|
+
command('asciidoc -s --backend=xhtml11 -o - -', /asciidoc/)
|
16
16
|
|
17
17
|
# pod2html is nice enough to generate a full-on HTML document for us,
|
18
18
|
# so we return the favor by ripping out the good parts.
|
data/test/markup_test.rb
CHANGED
@@ -30,7 +30,7 @@ message
|
|
30
30
|
def test_fails_gracefully_on_missing_commands
|
31
31
|
GitHub::Markup.command(:i_made_it_up, /mde/)
|
32
32
|
text = 'hi there'
|
33
|
-
|
33
|
+
assert GitHub::Markup.can_render?('README.mde')
|
34
34
|
actual = GitHub::Markup.render('README.mde', text)
|
35
35
|
assert_equal text, actual
|
36
36
|
end
|
@@ -38,7 +38,7 @@ message
|
|
38
38
|
def test_fails_gracefully_on_missing_env_commands
|
39
39
|
GitHub::Markup.command('/usr/bin/env totally_fake', /tf/)
|
40
40
|
text = 'hey mang'
|
41
|
-
|
41
|
+
assert GitHub::Markup.can_render?('README.tf')
|
42
42
|
actual = GitHub::Markup.render('README.tf', text)
|
43
43
|
assert_equal text, actual
|
44
44
|
end
|