github-markdown 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1154,9 +1154,10 @@ is_hrule(uint8_t *data, size_t size)
1154
1154
  return n >= 3;
1155
1155
  }
1156
1156
 
1157
- /* check if a line is a code fence; return its size if it is */
1157
+ /* check if a line begins with a code fence; return the
1158
+ * width of the code fence */
1158
1159
  static size_t
1159
- is_codefence(uint8_t *data, size_t size, struct buf *syntax)
1160
+ prefix_codefence(uint8_t *data, size_t size)
1160
1161
  {
1161
1162
  size_t i = 0, n = 0;
1162
1163
  uint8_t c;
@@ -1181,6 +1182,19 @@ is_codefence(uint8_t *data, size_t size, struct buf *syntax)
1181
1182
  if (n < 3)
1182
1183
  return 0;
1183
1184
 
1185
+ return i;
1186
+ }
1187
+
1188
+ /* check if a line is a code fence; return its size if it is */
1189
+ static size_t
1190
+ is_codefence(uint8_t *data, size_t size, struct buf *syntax)
1191
+ {
1192
+ size_t i = 0;
1193
+
1194
+ i = prefix_codefence(data, size);
1195
+ if (i == 0)
1196
+ return 0;
1197
+
1184
1198
  if (syntax != NULL) {
1185
1199
  size_t syn = 0;
1186
1200
 
@@ -1454,7 +1468,7 @@ parse_paragraph(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t
1454
1468
 
1455
1469
  /* see if a code fence starts here */
1456
1470
  if ((rndr->ext_flags & MKDEXT_FENCED_CODE) != 0 &&
1457
- is_codefence(data + i, size - i, NULL) != 0) {
1471
+ prefix_codefence(data + i, size - i) != 0) {
1458
1472
  end = i;
1459
1473
  break;
1460
1474
  }
@@ -1656,7 +1670,7 @@ parse_listitem(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t s
1656
1670
  pre = i;
1657
1671
 
1658
1672
  if (rndr->ext_flags & MKDEXT_FENCED_CODE) {
1659
- if (is_codefence(data + beg + i, end - beg - i, NULL) != 0)
1673
+ if (prefix_codefence(data + beg + i, end - beg - i) != 0)
1660
1674
  in_fence = !in_fence;
1661
1675
  }
1662
1676
 
@@ -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.2.0'
4
+ s.version = '0.2.1'
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 = '2012-04-04'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-markdown
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - GitHub, Inc