github-markdown 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6433aeeb45a4d139e4245c135b7b43065095c37b
4
- data.tar.gz: 62050a7a94c8dd6e6e0516bb3bd61ab31c272f49
3
+ metadata.gz: b2259a61a92711bdcd173441f680a8562efcb5cf
4
+ data.tar.gz: 8864e4e619a0c537b562c09ae6380c2d76fcf2d4
5
5
  SHA512:
6
- metadata.gz: 2894fe2ff8e055f248a2c16bbacbc54e73d1c0db547176631c81d284713f23d40fb16c406a1b5bf3a7352624e1304ce06a4c00bf31d2e665b7fe6e2a4b820078
7
- data.tar.gz: 4f01241c3918cc5d68c091ef5c52bc7da93f306677e7ff4b00c5db1d295d6a70bb7e82f1d1dd1db9a815fb42f8b7719a04d12cf0a5edd65af96a92a17b4f0965
6
+ metadata.gz: f246c6463214dda999648c480d5612a70e425e1d11ef10c3f066eb07a100fa4f5d8fe668ba268b2c43b1df10803c6cb2ef55ca40ad0e1772226de968cebd7365
7
+ data.tar.gz: c9765a24214c9b6b05f24829582c0730e5765ef82526f2975d3d79ba1c37e960b4b500b5a4ce97bd1b15c40e54f2710f0b3bdab59eb272c1626d718ce536d876
@@ -1365,7 +1365,7 @@ prefix_uli(uint8_t *data, size_t size)
1365
1365
 
1366
1366
  if (i < size && data[i] == ' ') i++;
1367
1367
  if (i < size && data[i] == ' ') i++;
1368
- if (i < size && data[i] == ' ') i++;
1368
+ if (i < size && data[i] == ' ') i++;
1369
1369
 
1370
1370
  if (i + 1 >= size ||
1371
1371
  (data[i] != '*' && data[i] != '+' && data[i] != '-') ||
@@ -1630,8 +1630,8 @@ static size_t
1630
1630
  parse_listitem(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t size, int *flags)
1631
1631
  {
1632
1632
  struct buf *work = 0, *inter = 0;
1633
- size_t beg = 0, end, pre, sublist = 0, orgpre = 0, i;
1634
- int in_empty = 0, has_inside_empty = 0, in_fence = 0;
1633
+ size_t beg = 0, end, pre, sublist = 0, orgpre = 0, previous_indent = 0, i;
1634
+ int in_empty = 0, has_inside_empty = 0, in_fence = 0, previous_indent_diff = 0;
1635
1635
 
1636
1636
  /* keeping track of the first indentation prefix */
1637
1637
  while (orgpre < 3 && orgpre < size && data[orgpre] == ' ')
@@ -1678,7 +1678,13 @@ parse_listitem(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t s
1678
1678
  while (i < 4 && beg + i < end && data[beg + i] == ' ')
1679
1679
  i++;
1680
1680
 
1681
+ previous_indent_diff = i - previous_indent;
1682
+ /* allow indentations between 2 and 4 spaces to count as a new list */
1683
+ if (previous_indent_diff > 1 && previous_indent_diff < 4)
1684
+ i = 2;
1685
+
1681
1686
  pre = i;
1687
+ previous_indent = pre;
1682
1688
 
1683
1689
  if (rndr->ext_flags & MKDEXT_FENCED_CODE) {
1684
1690
  if (is_codefence(data + beg + i, end - beg - i, NULL) != 0)
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'github-markdown'
4
- s.version = '0.5.5'
4
+ s.version = '0.6.0'
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
7
  s.date = '2013-10-01'
data/test/gfm_test.rb CHANGED
@@ -16,13 +16,13 @@ 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
19
+ Dir['test/fixtures/*.text', 'test/fixtures/Markdown_Redcarpet/**/*.text'].each do |md_file|
20
+ dirname = File.dirname(md_file)
21
+ markup = md_file.split('/').last.gsub(/\.text/, '').gsub(/(\s+)/, "_")
22
+ define_method "test_#{dirname}_#{markup}" do
23
23
  source = File.read(md_file)
24
24
 
25
- expected_file = "test/fixtures/#{markup}.html"
25
+ expected_file = "#{dirname}/#{markup}.html"
26
26
  expected = File.read(expected_file).rstrip
27
27
  actual = GitHub::Markdown.render(source).rstrip
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc