github-markdown 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +30 -2
- data/ext/markdown/autolink.c +1 -2
- data/ext/markdown/markdown.c +3 -2
- data/github-markdown.gemspec +2 -3
- data/test/gfm_test.rb +28 -1
- metadata +23 -58
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a03de5bb440c8070c42e296151a4cb329a3cb05d
|
4
|
+
data.tar.gz: 7ce0d53435eb13f7a5d25d4af3bf55a853988583
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 63efa0699c41e6073bbc2adcc6f6f10aa3fd39e021eb15f89e6c30599faa0218fea80fd62f6771eded755b10632029ec79edca4082b2bcb7eb7275f1230aa62c
|
7
|
+
data.tar.gz: faf466f9e7533a7baf1f3d681bf42d3e2fae84da67187777ab5d39732d9a42605a35a30f30b9e47c73d2252963eb1dd07ffc9ee64f4cd7413eebdaef966f7f29
|
data/Rakefile
CHANGED
@@ -14,6 +14,22 @@ Rake::ExtensionTask.new('markdown') do |ext|
|
|
14
14
|
ext.lib_dir = 'lib/github'
|
15
15
|
end
|
16
16
|
|
17
|
+
# ==========================================================
|
18
|
+
# Helpers
|
19
|
+
# ==========================================================
|
20
|
+
|
21
|
+
def name
|
22
|
+
@name ||= "github-markdown"
|
23
|
+
end
|
24
|
+
|
25
|
+
def version
|
26
|
+
@version ||= File.read("#{name}.gemspec").match(/^\s*s.version\s*=\s*['"](.*)['"]/)[1]
|
27
|
+
end
|
28
|
+
|
29
|
+
def gem_file
|
30
|
+
"#{name}-#{version}.gem"
|
31
|
+
end
|
32
|
+
|
17
33
|
# ==========================================================
|
18
34
|
# Testing
|
19
35
|
# ==========================================================
|
@@ -44,6 +60,20 @@ file package('.gem') => %w[pkg/ github-markdown.gemspec] + $spec.files do |f|
|
|
44
60
|
mv File.basename(f.name), f.name
|
45
61
|
end
|
46
62
|
|
63
|
+
|
64
|
+
desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
|
65
|
+
task :release => :package do
|
66
|
+
unless `git branch` =~ /^\* master$/
|
67
|
+
puts "You must be on the master branch to release!"
|
68
|
+
exit!
|
69
|
+
end
|
70
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
71
|
+
sh "git tag v#{version}"
|
72
|
+
sh "git push origin master"
|
73
|
+
sh "git push origin v#{version}"
|
74
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
75
|
+
end
|
76
|
+
|
47
77
|
# GEMSPEC HELPERS ==========================================================
|
48
78
|
|
49
79
|
task :update_gem do
|
@@ -84,5 +114,3 @@ end
|
|
84
114
|
file 'sundown/src/markdown.h' do |t|
|
85
115
|
abort "The Sundown submodule is required."
|
86
116
|
end
|
87
|
-
|
88
|
-
|
data/ext/markdown/autolink.c
CHANGED
@@ -236,7 +236,7 @@ sd_autolink__email(
|
|
236
236
|
}
|
237
237
|
|
238
238
|
if (link_end < 2 || nb != 1 || np == 0 ||
|
239
|
-
!isalpha(data[link_end - 1]))
|
239
|
+
(!isalpha(data[link_end - 1]) && data[link_end - 1] != '.'))
|
240
240
|
return 0;
|
241
241
|
|
242
242
|
link_end = autolink_delim(data, link_end, max_rewind, size);
|
@@ -294,4 +294,3 @@ sd_autolink__url(
|
|
294
294
|
|
295
295
|
return link_end;
|
296
296
|
}
|
297
|
-
|
data/ext/markdown/markdown.c
CHANGED
@@ -501,7 +501,7 @@ parse_emph1(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size
|
|
501
501
|
if (data[i] == c && !_isspace(data[i - 1])) {
|
502
502
|
|
503
503
|
if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
|
504
|
-
if (i + 1 < size &&
|
504
|
+
if (i + 1 < size && data[i] < 33)
|
505
505
|
continue;
|
506
506
|
}
|
507
507
|
|
@@ -597,8 +597,9 @@ char_emphasis(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t of
|
|
597
597
|
size_t ret;
|
598
598
|
|
599
599
|
if (rndr->ext_flags & MKDEXT_NO_INTRA_EMPHASIS) {
|
600
|
-
if (offset > 0 && !_isspace(data[-1]) && data[-1]
|
600
|
+
if (offset > 0 && !_isspace(data[-1]) && (isalnum(data[-1]) || data[-1] == data[0])) {
|
601
601
|
return 0;
|
602
|
+
}
|
602
603
|
}
|
603
604
|
|
604
605
|
if (size > 2 && data[1] != c) {
|
data/github-markdown.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'github-markdown'
|
4
|
-
s.version = '0.5.
|
4
|
+
s.version = '0.5.4'
|
5
5
|
s.summary = 'The Markdown parser for GitHub.com'
|
6
6
|
s.description = 'Self-contained Markdown parser for GitHub, with all our custom extensions'
|
7
|
-
s.date = '
|
7
|
+
s.date = '2013-10-01'
|
8
8
|
s.email = 'vicent@github.com'
|
9
9
|
s.homepage = 'http://github.github.com/github-flavored-markdown/'
|
10
10
|
s.authors = ['GitHub, Inc']
|
@@ -38,5 +38,4 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.test_files = ["test/gfm_test.rb"]
|
39
39
|
s.extensions = ["ext/markdown/extconf.rb"]
|
40
40
|
s.require_paths = ["lib"]
|
41
|
-
s.add_development_dependency "rake-compiler"
|
42
41
|
end
|
data/test/gfm_test.rb
CHANGED
@@ -16,6 +16,33 @@ def html_equal(html_a, html_b)
|
|
16
16
|
end
|
17
17
|
|
18
18
|
class GFMBasicTest < Test::Unit::TestCase
|
19
|
+
Dir['test/fixtures/*.md'].each do |md_file|
|
20
|
+
markup = md_file.split('/').last.gsub(/\.md/, '')
|
21
|
+
|
22
|
+
define_method "test_#{markup}" do
|
23
|
+
source = File.read(md_file)
|
24
|
+
|
25
|
+
expected_file = "test/fixtures/#{markup}.html"
|
26
|
+
expected = File.read(expected_file).rstrip
|
27
|
+
actual = GitHub::Markdown.render(source).rstrip
|
28
|
+
|
29
|
+
if source != expected
|
30
|
+
assert(source != actual, "#{markup} did not render anything")
|
31
|
+
end
|
32
|
+
|
33
|
+
diff = IO.popen("diff -u - #{expected_file}", 'r+') do |f|
|
34
|
+
f.write actual
|
35
|
+
f.close_write
|
36
|
+
f.read
|
37
|
+
end
|
38
|
+
|
39
|
+
assert expected == actual, <<message
|
40
|
+
#{File.basename expected_file}'s contents don't match command output:
|
41
|
+
#{diff}
|
42
|
+
message
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
19
46
|
def test_that_render_works
|
20
47
|
GitHub::Markdown.to_html("Hello **world**!", :gfm)
|
21
48
|
end
|
@@ -50,7 +77,7 @@ class GFMBasicTest < Test::Unit::TestCase
|
|
50
77
|
parsed = Nokogiri::HTML::DocumentFragment.parse(html)
|
51
78
|
|
52
79
|
items.inject(parsed) do |node, expected_item|
|
53
|
-
child = node.
|
80
|
+
child = node.xpath('.//ul/li')
|
54
81
|
child_item = child.children.detect{|e| e.text?}.text.strip
|
55
82
|
assert_equal expected_item, child_item
|
56
83
|
node = child
|
metadata
CHANGED
@@ -1,46 +1,22 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markdown
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 3
|
10
|
-
version: 0.5.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.4
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- GitHub, Inc
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: rake-compiler
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
type: :development
|
34
|
-
version_requirements: *id001
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
35
13
|
description: Self-contained Markdown parser for GitHub, with all our custom extensions
|
36
14
|
email: vicent@github.com
|
37
15
|
executables: []
|
38
|
-
|
39
|
-
extensions:
|
16
|
+
extensions:
|
40
17
|
- ext/markdown/extconf.rb
|
41
18
|
extra_rdoc_files: []
|
42
|
-
|
43
|
-
files:
|
19
|
+
files:
|
44
20
|
- Rakefile
|
45
21
|
- bin/gfm
|
46
22
|
- ext/markdown/autolink.c
|
@@ -64,39 +40,28 @@ files:
|
|
64
40
|
- github-markdown.gemspec
|
65
41
|
- lib/github/markdown.rb
|
66
42
|
- test/gfm_test.rb
|
67
|
-
has_rdoc: true
|
68
43
|
homepage: http://github.github.com/github-flavored-markdown/
|
69
44
|
licenses: []
|
70
|
-
|
45
|
+
metadata: {}
|
71
46
|
post_install_message:
|
72
47
|
rdoc_options: []
|
73
|
-
|
74
|
-
require_paths:
|
48
|
+
require_paths:
|
75
49
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
none: false
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
94
60
|
requirements: []
|
95
|
-
|
96
61
|
rubyforge_project:
|
97
|
-
rubygems_version:
|
62
|
+
rubygems_version: 2.0.3
|
98
63
|
signing_key:
|
99
|
-
specification_version:
|
64
|
+
specification_version: 4
|
100
65
|
summary: The Markdown parser for GitHub.com
|
101
|
-
test_files:
|
66
|
+
test_files:
|
102
67
|
- test/gfm_test.rb
|