motion-markdown-it 8.4.1.1 → 8.4.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +39 -0
  3. data/lib/motion-markdown-it.rb +0 -1
  4. data/lib/motion-markdown-it/common/simpleidn.rb +8 -9
  5. data/lib/motion-markdown-it/common/utils.rb +7 -3
  6. data/lib/motion-markdown-it/helpers/parse_link_destination.rb +3 -3
  7. data/lib/motion-markdown-it/helpers/parse_link_label.rb +1 -1
  8. data/lib/motion-markdown-it/helpers/parse_link_title.rb +3 -3
  9. data/lib/motion-markdown-it/rules_block/blockquote.rb +8 -8
  10. data/lib/motion-markdown-it/rules_block/fence.rb +2 -2
  11. data/lib/motion-markdown-it/rules_block/heading.rb +4 -4
  12. data/lib/motion-markdown-it/rules_block/hr.rb +2 -2
  13. data/lib/motion-markdown-it/rules_block/html_block.rb +2 -1
  14. data/lib/motion-markdown-it/rules_block/lheading.rb +2 -1
  15. data/lib/motion-markdown-it/rules_block/list.rb +8 -8
  16. data/lib/motion-markdown-it/rules_block/reference.rb +13 -13
  17. data/lib/motion-markdown-it/rules_block/state_block.rb +6 -6
  18. data/lib/motion-markdown-it/rules_block/table.rb +8 -8
  19. data/lib/motion-markdown-it/rules_core/linkify.rb +1 -1
  20. data/lib/motion-markdown-it/rules_core/smartquotes.rb +5 -5
  21. data/lib/motion-markdown-it/rules_inline/autolink.rb +3 -2
  22. data/lib/motion-markdown-it/rules_inline/backticks.rb +5 -4
  23. data/lib/motion-markdown-it/rules_inline/emphasis.rb +1 -1
  24. data/lib/motion-markdown-it/rules_inline/entity.rb +5 -5
  25. data/lib/motion-markdown-it/rules_inline/escape.rb +3 -3
  26. data/lib/motion-markdown-it/rules_inline/html_inline.rb +5 -5
  27. data/lib/motion-markdown-it/rules_inline/image.rb +8 -8
  28. data/lib/motion-markdown-it/rules_inline/link.rb +7 -7
  29. data/lib/motion-markdown-it/rules_inline/newline.rb +4 -4
  30. data/lib/motion-markdown-it/rules_inline/state_inline.rb +4 -4
  31. data/lib/motion-markdown-it/rules_inline/strikethrough.rb +1 -1
  32. data/lib/motion-markdown-it/rules_inline/text.rb +2 -1
  33. data/lib/motion-markdown-it/version.rb +1 -1
  34. metadata +3 -4
  35. data/lib/motion-markdown-it/common/string.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ce02411a4d64cb6e09347db122e59cb409d77316
4
- data.tar.gz: 130993721fe5e59734b17af32a77aa7980d60fcf
2
+ SHA256:
3
+ metadata.gz: 650922a627efaf3a0b14a2b615a77fa2368f3fa9521aebd02fa8102a9d472c03
4
+ data.tar.gz: e615b7de9baa7f930d2e69f3e8d6562d4796373e112602cc19b9472d5e4ed628
5
5
  SHA512:
6
- metadata.gz: 90fce20e2e664e6ea14def698f0a846c1e7235687164c48a7c0388d495fd431f11c83387534e6e965658e4211b7c55e4650f0a3681f5517f4a36a7c76e6c10a8
7
- data.tar.gz: 77560ecca3754fb7ab767ee6837a69f3b15c0f89c7d966c29c87a937cfa702e5f4728e2127ead479a5dab18673ef264eba3e0b1dfe117aa98044950f5d7da34e
6
+ metadata.gz: 13890868afe5b3eb188a35fbcd0042c9334e5047a7e05fe46262ca45cd8bd919442e129856b74dfd8844edf66884899f3c36bf350664cd2e9b057d2d43690985
7
+ data.tar.gz: 73b64c8811203fb281a8ab9d802ca59ae330b2134d6d2cf0142c8fd20ca526efc97667ef8f080485f4d1e6f4f37813ee45b925df5e661a90f377e561fce636b2
data/README.md CHANGED
@@ -55,6 +55,7 @@ redcarpet 3.4.0 0.0065
55
55
  - [Install](#install)
56
56
  - [Usage examples](#usage-examples)
57
57
  - [Plugins](#plugins)
58
+ - [Upgrading](#upgrading)
58
59
  - [References / Thanks](#references--thanks)
59
60
  - [License](#license)
60
61
 
@@ -297,6 +298,44 @@ other implementations.
297
298
 
298
299
  -->
299
300
 
301
+ ## Upgrading
302
+
303
+ Upgrading to `8.4.1.2` could cause some small breakage if you are using any custom plugins. The [motion-markdown-it-plugins](https://github.com/digitalmoksha/motion-markdown-it-plugins) plugins have already been upgraded.
304
+
305
+ #### charCodeAt
306
+
307
+ Make sure you have
308
+
309
+ ```ruby
310
+ include MarkdownIt::Common::Utils
311
+ ```
312
+
313
+ at the top of your plugin file. Then change any references to `charCodeAt`. For example,
314
+
315
+ ```ruby
316
+ state.src.charCodeAt(pos)
317
+ ```
318
+
319
+ would become
320
+
321
+ ```ruby
322
+ charCodeAt(state.src, pos)
323
+ ```
324
+
325
+ #### slice_to_end
326
+
327
+ `slice_to_end` has been removed. Change references like this
328
+
329
+ ```ruby
330
+ state.src.slice_to_end(pos)
331
+ ```
332
+
333
+ to
334
+
335
+ ```ruby
336
+ state.src[pos..-1]
337
+ ```
338
+
300
339
  ## References / Thanks
301
340
 
302
341
  Thanks to the authors of the original implementation in Javascript, [markdown-it](https://github.com/markdown-it/markdown-it):
@@ -24,7 +24,6 @@ else
24
24
  require 'motion-markdown-it/common/utils'
25
25
  require 'motion-markdown-it/common/html_blocks'
26
26
  require 'motion-markdown-it/common/html_re'
27
- require 'motion-markdown-it/common/string'
28
27
  require 'motion-markdown-it/common/simpleidn'
29
28
  require 'motion-markdown-it/helpers/parse_link_destination'
30
29
  require 'motion-markdown-it/helpers/parse_link_label'
@@ -1,11 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  # Borrowed from https://github.com/mmriis/simpleidn
3
3
  #------------------------------------------------------------------------------
4
- class Integer
5
- def to_utf8_character
6
- [self].pack("U*")
7
- end
8
- end
9
4
 
10
5
  module SimpleIDN
11
6
 
@@ -21,7 +16,11 @@ module SimpleIDN
21
16
  SKEW = 38
22
17
  MAXINT = 0x7FFFFFFF
23
18
 
24
- module_function
19
+ module_function
20
+
21
+ def to_utf8_character(int)
22
+ [int].pack("U*")
23
+ end
25
24
 
26
25
  # decode_digit(cp) returns the numeric value of a basic code
27
26
  # point (for use in representing integers) in the range 0 to
@@ -75,7 +74,7 @@ module SimpleIDN
75
74
  # Handle the basic code points: Let basic be the number of input code
76
75
  # points before the last delimiter, or 0 if there is none, then
77
76
  # copy the first basic code points to the output.
78
- basic = input.rindex(DELIMITER.to_utf8_character) || 0
77
+ basic = input.rindex(to_utf8_character(DELIMITER)) || 0
79
78
 
80
79
  input.unpack("U*")[0, basic].each do |char|
81
80
  raise(RangeError, "Illegal input >= 0x80") if char >= 0x80
@@ -126,7 +125,7 @@ module SimpleIDN
126
125
  i %= out
127
126
 
128
127
  # Insert n at position i of the output:
129
- output.insert(i, n.to_utf8_character)
128
+ output.insert(i, to_utf8_character(n))
130
129
  i += 1
131
130
  end
132
131
 
@@ -202,7 +201,7 @@ module SimpleIDN
202
201
  delta += 1
203
202
  n += 1
204
203
  end
205
- return output.collect {|c| c.to_utf8_character}.join
204
+ return output.collect {|c| to_utf8_character(c)}.join
206
205
  end
207
206
 
208
207
  end
@@ -55,7 +55,11 @@ module MarkdownIt
55
55
  def fromCharCode(c)
56
56
  c.chr
57
57
  end
58
-
58
+
59
+ #------------------------------------------------------------------------------
60
+ def charCodeAt(str, ch)
61
+ str[ch].ord unless str[ch].nil?
62
+ end
59
63
 
60
64
  UNESCAPE_MD_RE = /\\([\!\"\#\$\%\&\'\(\)\*\+\,\-.\/:;<=>?@\[\\\]^_`{|}~])/
61
65
 
@@ -70,8 +74,8 @@ module MarkdownIt
70
74
 
71
75
  return fromCodePoint(MarkdownIt::HTMLEntities::MAPPINGS[name]) if MarkdownIt::HTMLEntities::MAPPINGS[name]
72
76
 
73
- if (name.charCodeAt(0) == 0x23 && DIGITAL_ENTITY_TEST_RE =~ name) # '#'
74
- code = name[1].downcase == 'x' ? name.slice_to_end(2).to_i(16) : name.slice_to_end(1).to_i
77
+ if (charCodeAt(name, 0) == 0x23 && DIGITAL_ENTITY_TEST_RE =~ name) # '#'
78
+ code = name[1].downcase == 'x' ? name[2..-1].to_i(16) : name[1..-1].to_i
75
79
  if (isValidEntityCode(code))
76
80
  return fromCodePoint(code)
77
81
  end
@@ -11,10 +11,10 @@ module MarkdownIt
11
11
  start = pos
12
12
  result = {ok: false, pos: 0, lines: 0, str: ''}
13
13
 
14
- if (str.charCodeAt(pos) == 0x3C ) # <
14
+ if (charCodeAt(str, pos) == 0x3C ) # <
15
15
  pos += 1
16
16
  while (pos < max)
17
- code = str.charCodeAt(pos)
17
+ code = charCodeAt(str, pos)
18
18
  return result if (code == 0x0A || isSpace(code)) # \n
19
19
  if (code == 0x3E) # >
20
20
  result[:pos] = pos + 1
@@ -38,7 +38,7 @@ module MarkdownIt
38
38
 
39
39
  level = 0
40
40
  while (pos < max)
41
- code = str.charCodeAt(pos)
41
+ code = charCodeAt(str, pos)
42
42
 
43
43
  break if (code == 0x20)
44
44
 
@@ -15,7 +15,7 @@ module MarkdownIt
15
15
  level = 1
16
16
 
17
17
  while (state.pos < max)
18
- marker = state.src.charCodeAt(state.pos)
18
+ marker = charCodeAt(state.src, state.pos)
19
19
  if (marker == 0x5D) # ]
20
20
  level -= 1
21
21
  if (level == 0)
@@ -12,7 +12,7 @@ module MarkdownIt
12
12
 
13
13
  return result if (pos >= max)
14
14
 
15
- marker = str.charCodeAt(pos)
15
+ marker = charCodeAt(str, pos)
16
16
 
17
17
  return result if (marker != 0x22 && marker != 0x27 && marker != 0x28) # " ' (
18
18
 
@@ -22,7 +22,7 @@ module MarkdownIt
22
22
  marker = 0x29 if (marker == 0x28)
23
23
 
24
24
  while (pos < max)
25
- code = str.charCodeAt(pos)
25
+ code = charCodeAt(str, pos)
26
26
  if (code == marker)
27
27
  result[:pos] = pos + 1
28
28
  result[:lines] = lines
@@ -33,7 +33,7 @@ module MarkdownIt
33
33
  lines += 1
34
34
  elsif (code == 0x5C && pos + 1 < max) # \
35
35
  pos += 1
36
- if (str.charCodeAt(pos) == 0x0A)
36
+ if (charCodeAt(str, pos) == 0x0A)
37
37
  lines += 1
38
38
  end
39
39
  end
@@ -15,7 +15,7 @@ module MarkdownIt
15
15
  return false if (state.sCount[startLine] - state.blkIndent >= 4)
16
16
 
17
17
  # check the block quote marker
18
- return false if state.src.charCodeAt(pos) != 0x3E # >
18
+ return false if charCodeAt(state.src, pos) != 0x3E # >
19
19
  pos += 1
20
20
 
21
21
  # we know that it's going to be a valid blockquote,
@@ -26,7 +26,7 @@ module MarkdownIt
26
26
  initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine])
27
27
 
28
28
  # skip one optional space after '>'
29
- if state.src.charCodeAt(pos) == 0x20 # space
29
+ if charCodeAt(state.src, pos) == 0x20 # space
30
30
  # ' > test '
31
31
  # ^ -- position start of line here:
32
32
  pos += 1
@@ -34,7 +34,7 @@ module MarkdownIt
34
34
  offset +=1
35
35
  adjustTab = false
36
36
  spaceAfterMarker = true
37
- elsif state.src.charCodeAt(pos) == 0x09 # tab
37
+ elsif charCodeAt(state.src, pos) == 0x09 # tab
38
38
  spaceAfterMarker = true
39
39
 
40
40
  if ((state.bsCount[startLine] + offset) % 4 == 3)
@@ -58,7 +58,7 @@ module MarkdownIt
58
58
  state.bMarks[startLine] = pos
59
59
 
60
60
  while pos < max
61
- ch = state.src.charCodeAt(pos)
61
+ ch = charCodeAt(state.src, pos)
62
62
 
63
63
  if isSpace(ch)
64
64
  if ch == 0x09
@@ -128,7 +128,7 @@ module MarkdownIt
128
128
  break
129
129
  end
130
130
 
131
- if state.src.charCodeAt(pos) == 0x3E && !wasOutdented # >
131
+ if charCodeAt(state.src, pos) == 0x3E && !wasOutdented # >
132
132
  pos += 1
133
133
  # This line is inside the blockquote.
134
134
 
@@ -136,7 +136,7 @@ module MarkdownIt
136
136
  initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine])
137
137
 
138
138
  # skip one optional space after '>'
139
- if state.src.charCodeAt(pos) == 0x20 # space
139
+ if charCodeAt(state.src, pos) == 0x20 # space
140
140
  # ' > test '
141
141
  # ^ -- position start of line here:
142
142
  pos += 1
@@ -144,7 +144,7 @@ module MarkdownIt
144
144
  offset += 1
145
145
  adjustTab = false
146
146
  spaceAfterMarker = true
147
- elsif state.src.charCodeAt(pos) == 0x09 # tab
147
+ elsif charCodeAt(state.src, pos) == 0x09 # tab
148
148
  spaceAfterMarker = true
149
149
 
150
150
  if ((state.bsCount[nextLine] + offset) % 4 == 3)
@@ -168,7 +168,7 @@ module MarkdownIt
168
168
  state.bMarks[nextLine] = pos
169
169
 
170
170
  while pos < max
171
- ch = state.src.charCodeAt(pos)
171
+ ch = charCodeAt(state.src, pos)
172
172
 
173
173
  if isSpace(ch)
174
174
  if ch == 0x09
@@ -16,7 +16,7 @@ module MarkdownIt
16
16
 
17
17
  return false if pos + 3 > max
18
18
 
19
- marker = state.src.charCodeAt(pos)
19
+ marker = charCodeAt(state.src, pos)
20
20
 
21
21
  if marker != 0x7E && marker != 0x60 # != ~ && != `
22
22
  return false
@@ -58,7 +58,7 @@ module MarkdownIt
58
58
  break
59
59
  end
60
60
 
61
- next if state.src.charCodeAt(pos) != marker
61
+ next if charCodeAt(state.src, pos) != marker
62
62
 
63
63
  if state.sCount[nextLine] - state.blkIndent >= 4
64
64
  # closing fence should be indented less than 4 spaces
@@ -13,18 +13,18 @@ module MarkdownIt
13
13
  # if it's indented more than 3 spaces, it should be a code block
14
14
  return false if state.sCount[startLine] - state.blkIndent >= 4
15
15
 
16
- ch = state.src.charCodeAt(pos)
16
+ ch = charCodeAt(state.src, pos)
17
17
 
18
18
  return false if (ch != 0x23 || pos >= max)
19
19
 
20
20
  # count heading level
21
21
  level = 1
22
22
  pos += 1
23
- ch = state.src.charCodeAt(pos)
23
+ ch = charCodeAt(state.src, pos)
24
24
  while (ch == 0x23 && pos < max && level <= 6) # '#'
25
25
  level += 1
26
26
  pos += 1
27
- ch = state.src.charCodeAt(pos)
27
+ ch = charCodeAt(state.src, pos)
28
28
  end
29
29
 
30
30
  return false if (level > 6 || (pos < max && !isSpace(ch)))
@@ -35,7 +35,7 @@ module MarkdownIt
35
35
 
36
36
  max = state.skipSpacesBack(max, pos)
37
37
  tmp = state.skipCharsBack(max, 0x23, pos) # '#'
38
- if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1)))
38
+ if (tmp > pos && isSpace(charCodeAt(state.src, tmp - 1)))
39
39
  max = tmp
40
40
  end
41
41
 
@@ -13,7 +13,7 @@ module MarkdownIt
13
13
  # if it's indented more than 3 spaces, it should be a code block
14
14
  return false if (state.sCount[startLine] - state.blkIndent >= 4)
15
15
 
16
- marker = state.src.charCodeAt(pos)
16
+ marker = charCodeAt(state.src, pos)
17
17
  pos += 1
18
18
 
19
19
  # Check hr marker
@@ -27,7 +27,7 @@ module MarkdownIt
27
27
 
28
28
  cnt = 1
29
29
  while (pos < max)
30
- ch = state.src.charCodeAt(pos)
30
+ ch = charCodeAt(state.src, pos)
31
31
  pos += 1
32
32
  return false if ch != marker && !isSpace(ch)
33
33
  cnt += 1 if ch == marker
@@ -3,6 +3,7 @@
3
3
  module MarkdownIt
4
4
  module RulesBlock
5
5
  class HtmlBlock
6
+ extend Common::Utils
6
7
 
7
8
  HTML_OPEN_CLOSE_TAG_RE = MarkdownIt::Common::HtmlRe::HTML_OPEN_CLOSE_TAG_RE
8
9
 
@@ -28,7 +29,7 @@ module MarkdownIt
28
29
  return false if state.sCount[startLine] - state.blkIndent >= 4
29
30
 
30
31
  return false if !state.md.options[:html]
31
- return false if state.src.charCodeAt(pos) != 0x3C # <
32
+ return false if charCodeAt(state.src, pos) != 0x3C # <
32
33
 
33
34
  lineText = state.src.slice(pos...max)
34
35
 
@@ -3,6 +3,7 @@
3
3
  module MarkdownIt
4
4
  module RulesBlock
5
5
  class Lheading
6
+ extend Common::Utils
6
7
 
7
8
  #------------------------------------------------------------------------------
8
9
  def self.lheading(state, startLine, endLine, silent = true)
@@ -29,7 +30,7 @@ module MarkdownIt
29
30
  max = state.eMarks[nextLine]
30
31
 
31
32
  if pos < max
32
- marker = state.src.charCodeAt(pos)
33
+ marker = charCodeAt(state.src, pos)
33
34
 
34
35
  if marker == 0x2D || marker == 0x3D # - or =
35
36
  pos = state.skipChars(pos, marker)
@@ -12,7 +12,7 @@ module MarkdownIt
12
12
  pos = state.bMarks[startLine] + state.tShift[startLine]
13
13
  max = state.eMarks[startLine]
14
14
 
15
- marker = state.src.charCodeAt(pos)
15
+ marker = charCodeAt(state.src, pos)
16
16
  pos += 1
17
17
  # Check bullet
18
18
  if (marker != 0x2A && # *
@@ -22,7 +22,7 @@ module MarkdownIt
22
22
  end
23
23
 
24
24
  if pos < max
25
- ch = state.src.charCodeAt(pos)
25
+ ch = charCodeAt(state.src, pos)
26
26
 
27
27
  if !isSpace(ch)
28
28
  # " -test " - is not a list item
@@ -44,7 +44,7 @@ module MarkdownIt
44
44
  # List marker should have at least 2 chars (digit + dot)
45
45
  return -1 if (pos + 1 >= max)
46
46
 
47
- ch = state.src.charCodeAt(pos)
47
+ ch = charCodeAt(state.src, pos)
48
48
  pos += 1
49
49
 
50
50
  return -1 if ch.nil?
@@ -54,7 +54,7 @@ module MarkdownIt
54
54
  # EOL -> fail
55
55
  return -1 if (pos >= max)
56
56
 
57
- ch = state.src.charCodeAt(pos)
57
+ ch = charCodeAt(state.src, pos)
58
58
  pos += 1
59
59
 
60
60
  if (ch >= 0x30 && ch <= 0x39) # >= 0 && <= 9
@@ -75,7 +75,7 @@ module MarkdownIt
75
75
  end
76
76
 
77
77
  if pos < max
78
- ch = state.src.charCodeAt(pos)
78
+ ch = charCodeAt(state.src, pos)
79
79
 
80
80
  if !isSpace(ch)
81
81
  # " 1.test " - is not a list item
@@ -144,7 +144,7 @@ module MarkdownIt
144
144
  end
145
145
 
146
146
  # We should terminate list on style change. Remember first one to compare.
147
- markerCharCode = state.src.charCodeAt(posAfterMarker - 1)
147
+ markerCharCode = charCodeAt(state.src, posAfterMarker - 1)
148
148
 
149
149
  # For validation mode we can terminate immediately
150
150
  return true if (silent)
@@ -185,7 +185,7 @@ module MarkdownIt
185
185
  initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine])
186
186
 
187
187
  while pos < max
188
- ch = state.src.charCodeAt(pos)
188
+ ch = charCodeAt(state.src, pos)
189
189
 
190
190
  if ch == 0x09
191
191
  offset += 4 - (offset + state.bsCount[nextLine]) % 4
@@ -288,7 +288,7 @@ module MarkdownIt
288
288
  break if (posAfterMarker < 0)
289
289
  end
290
290
 
291
- break if (markerCharCode != state.src.charCodeAt(posAfterMarker - 1))
291
+ break if (markerCharCode != charCodeAt(state.src, posAfterMarker - 1))
292
292
  end
293
293
 
294
294
  # Finalize list
@@ -13,16 +13,16 @@ module MarkdownIt
13
13
  # if it's indented more than 3 spaces, it should be a code block
14
14
  return false if state.sCount[startLine] - state.blkIndent >= 4
15
15
 
16
- return false if state.src.charCodeAt(pos) != 0x5B # [
16
+ return false if charCodeAt(state.src, pos) != 0x5B # [
17
17
 
18
18
  # Simple check to quickly interrupt scan on [link](url) at the start of line.
19
19
  # Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
20
20
  pos += 1
21
21
  while (pos < max)
22
- if (state.src.charCodeAt(pos) == 0x5D && # ]
23
- state.src.charCodeAt(pos - 1) != 0x5C) # \
22
+ if (charCodeAt(state.src, pos) == 0x5D && # ]
23
+ charCodeAt(state.src, pos - 1) != 0x5C) # \
24
24
  return false if (pos + 1 === max)
25
- return false if (state.src.charCodeAt(pos + 1) != 0x3A) # :
25
+ return false if (charCodeAt(state.src, pos + 1) != 0x3A) # :
26
26
  break
27
27
  end
28
28
  pos += 1
@@ -62,7 +62,7 @@ module MarkdownIt
62
62
 
63
63
  pos = 1
64
64
  while pos < max
65
- ch = str.charCodeAt(pos)
65
+ ch = charCodeAt(str, pos)
66
66
  if (ch == 0x5B ) # [
67
67
  return false
68
68
  elsif (ch == 0x5D) # ]
@@ -72,20 +72,20 @@ module MarkdownIt
72
72
  lines += 1
73
73
  elsif (ch == 0x5C) # \
74
74
  pos += 1
75
- if (pos < max && str.charCodeAt(pos) == 0x0A)
75
+ if (pos < max && charCodeAt(str, pos) == 0x0A)
76
76
  lines += 1
77
77
  end
78
78
  end
79
79
  pos += 1
80
80
  end
81
81
 
82
- return false if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) != 0x3A) # :
82
+ return false if (labelEnd < 0 || charCodeAt(str, labelEnd + 1) != 0x3A) # :
83
83
 
84
84
  # [label]: destination 'title'
85
85
  # ^^^ skip optional whitespace here
86
86
  pos = labelEnd + 2
87
87
  while pos < max
88
- ch = str.charCodeAt(pos)
88
+ ch = charCodeAt(str, pos)
89
89
  if (ch == 0x0A)
90
90
  lines += 1
91
91
  elsif isSpace(ch)
@@ -114,7 +114,7 @@ module MarkdownIt
114
114
  # ^^^ skipping those spaces
115
115
  start = pos
116
116
  while (pos < max)
117
- ch = str.charCodeAt(pos)
117
+ ch = charCodeAt(str, pos)
118
118
  if (ch == 0x0A)
119
119
  lines += 1
120
120
  elsif isSpace(ch)
@@ -139,12 +139,12 @@ module MarkdownIt
139
139
 
140
140
  # skip trailing spaces until the rest of the line
141
141
  while pos < max
142
- ch = str.charCodeAt(pos)
142
+ ch = charCodeAt(str, pos)
143
143
  break if !isSpace(ch)
144
144
  pos += 1
145
145
  end
146
146
 
147
- if (pos < max && str.charCodeAt(pos) != 0x0A)
147
+ if (pos < max && charCodeAt(str, pos) != 0x0A)
148
148
  if (title)
149
149
  # garbage at the end of the line after title,
150
150
  # but it could still be a valid reference if we roll back
@@ -152,14 +152,14 @@ module MarkdownIt
152
152
  pos = destEndPos
153
153
  lines = destEndLineNo
154
154
  while pos < max
155
- ch = str.charCodeAt(pos)
155
+ ch = charCodeAt(str, pos)
156
156
  break if !isSpace(ch)
157
157
  pos += 1
158
158
  end
159
159
  end
160
160
  end
161
161
 
162
- if (pos < max && str.charCodeAt(pos) != 0x0A)
162
+ if (pos < max && charCodeAt(str, pos) != 0x0A)
163
163
  # garbage at the end of the line
164
164
  return false
165
165
  end
@@ -63,7 +63,7 @@ module MarkdownIt
63
63
  start = pos = indent = offset = 0
64
64
  len = s.length
65
65
  while pos < len
66
- ch = s.charCodeAt(pos)
66
+ ch = charCodeAt(s, pos)
67
67
 
68
68
  if !indent_found
69
69
  if isSpace(ch)
@@ -140,7 +140,7 @@ module MarkdownIt
140
140
  def skipSpaces(pos)
141
141
  max = @src.length
142
142
  while pos < max
143
- ch = @src.charCodeAt(pos)
143
+ ch = charCodeAt(@src, pos)
144
144
  break if !isSpace(ch)
145
145
  pos += 1
146
146
  end
@@ -153,7 +153,7 @@ module MarkdownIt
153
153
  return pos if pos <= min
154
154
 
155
155
  while (pos > min)
156
- return pos + 1 if !isSpace(@src.charCodeAt(pos -= 1))
156
+ return pos + 1 if !isSpace(charCodeAt(@src, pos -= 1))
157
157
  end
158
158
  return pos
159
159
  end
@@ -163,7 +163,7 @@ module MarkdownIt
163
163
  def skipChars(pos, code)
164
164
  max = @src.length
165
165
  while pos < max
166
- break if (@src.charCodeAt(pos) != code)
166
+ break if (charCodeAt(@src, pos) != code)
167
167
  pos += 1
168
168
  end
169
169
  return pos
@@ -175,7 +175,7 @@ module MarkdownIt
175
175
  return pos if pos <= min
176
176
 
177
177
  while (pos > min)
178
- return (pos + 1) if code != @src.charCodeAt(pos -= 1)
178
+ return (pos + 1) if code != charCodeAt(@src, pos -= 1)
179
179
  end
180
180
  return pos
181
181
  end
@@ -202,7 +202,7 @@ module MarkdownIt
202
202
  end
203
203
 
204
204
  while first < last && lineIndent < indent
205
- ch = @src.charCodeAt(first)
205
+ ch = charCodeAt(@src, first)
206
206
 
207
207
  if isSpace(ch)
208
208
  if ch === 0x09
@@ -23,7 +23,7 @@ module MarkdownIt
23
23
  backTicked = false
24
24
  lastBackTick = 0
25
25
 
26
- ch = str.charCodeAt(pos)
26
+ ch = charCodeAt(str, pos)
27
27
 
28
28
  while (pos < max)
29
29
  if ch == 0x60 # `
@@ -54,10 +54,10 @@ module MarkdownIt
54
54
  backTicked = false
55
55
  pos = lastBackTick + 1
56
56
  end
57
- ch = str.charCodeAt(pos)
57
+ ch = charCodeAt(str, pos)
58
58
  end
59
59
 
60
- result.push(str.slice_to_end(lastPos))
60
+ result.push(str[lastPos..-1])
61
61
 
62
62
  return result
63
63
  end
@@ -82,12 +82,12 @@ module MarkdownIt
82
82
  pos = state.bMarks[nextLine] + state.tShift[nextLine]
83
83
  return false if (pos >= state.eMarks[nextLine])
84
84
 
85
- ch = state.src.charCodeAt(pos)
85
+ ch = charCodeAt(state.src, pos)
86
86
  pos += 1
87
87
  return false if (ch != 0x7C && ch != 0x2D && ch != 0x3A) # | or - or :
88
88
 
89
89
  while pos < state.eMarks[nextLine]
90
- ch = state.src.charCodeAt(pos)
90
+ ch = charCodeAt(state.src, pos)
91
91
  return false if (ch != 0x7C && ch != 0x2D && ch != 0x3A && !isSpace(ch)) # | or - or :
92
92
 
93
93
  pos += 1
@@ -110,9 +110,9 @@ module MarkdownIt
110
110
  end
111
111
 
112
112
  return false if (/^:?-+:?$/ =~ t).nil?
113
- if (t.charCodeAt(t.length - 1) == 0x3A) # ':'
114
- aligns.push(t.charCodeAt(0) == 0x3A ? 'center' : 'right')
115
- elsif (t.charCodeAt(0) == 0x3A)
113
+ if (charCodeAt(t, t.length - 1) == 0x3A) # ':'
114
+ aligns.push(charCodeAt(t, 0) == 0x3A ? 'center' : 'right')
115
+ elsif (charCodeAt(t, 0) == 0x3A)
116
116
  aligns.push('left')
117
117
  else
118
118
  aligns.push('')
@@ -117,7 +117,7 @@ module MarkdownIt
117
117
  end
118
118
  if (lastPos < text.length)
119
119
  token = Token.new('text', '', 0)
120
- token.content = text.slice_to_end(lastPos)
120
+ token.content = text[lastPos..-1]
121
121
  token.level = level
122
122
  nodes.push(token)
123
123
  end
@@ -11,7 +11,7 @@ module MarkdownIt
11
11
 
12
12
  #------------------------------------------------------------------------------
13
13
  def self.replaceAt(str, index, ch)
14
- return str[0, index] + ch + str.slice_to_end(index + 1)
14
+ return str[0, index] + ch + str[(index + 1)..-1]
15
15
  end
16
16
 
17
17
  #------------------------------------------------------------------------------
@@ -55,13 +55,13 @@ module MarkdownIt
55
55
  lastChar = 0x20
56
56
 
57
57
  if t.begin(0) - 1 >= 0
58
- lastChar = text.charCodeAt(t.begin(0) - 1)
58
+ lastChar = charCodeAt(text, t.begin(0) - 1)
59
59
  else
60
60
  (i - 1).downto(0) do |j|
61
61
  break if tokens[j].type == 'softbreak' || tokens[j].type == 'hardbreak' # lastChar defaults to 0x20
62
62
  next if tokens[j].type != 'text'
63
63
 
64
- lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1)
64
+ lastChar = charCodeAt(tokens[j].content, tokens[j].content.length - 1)
65
65
  break
66
66
  end
67
67
  end
@@ -72,13 +72,13 @@ module MarkdownIt
72
72
  nextChar = 0x20
73
73
 
74
74
  if pos < max
75
- nextChar = text.charCodeAt(pos)
75
+ nextChar = charCodeAt(text, pos)
76
76
  else
77
77
  (i + 1).upto(tokens.length - 1) do |j|
78
78
  break if tokens[j].type == 'softbreak' || tokens[j].type == 'hardbreak' # nextChar defaults to 0x20
79
79
  next if tokens[j].type != 'text'
80
80
 
81
- nextChar = tokens[j].content.charCodeAt(0)
81
+ nextChar = charCodeAt(tokens[j].content, 0)
82
82
  break
83
83
  end
84
84
  end
@@ -3,6 +3,7 @@
3
3
  module MarkdownIt
4
4
  module RulesInline
5
5
  class Autolink
6
+ extend Common::Utils
6
7
 
7
8
  EMAIL_RE = /^<([a-zA-Z0-9.!#$\%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/
8
9
  AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/
@@ -11,9 +12,9 @@ module MarkdownIt
11
12
  def self.autolink(state, silent)
12
13
  pos = state.pos
13
14
 
14
- return false if (state.src.charCodeAt(pos) != 0x3C) # <
15
+ return false if (charCodeAt(state.src, pos) != 0x3C) # <
15
16
 
16
- tail = state.src.slice_to_end(pos)
17
+ tail = state.src[pos..-1]
17
18
 
18
19
  return false if !tail.include?('>')
19
20
 
@@ -3,19 +3,20 @@
3
3
  module MarkdownIt
4
4
  module RulesInline
5
5
  class Backticks
6
+ extend Common::Utils
6
7
 
7
8
  #------------------------------------------------------------------------------
8
9
  def self.backtick(state, silent)
9
10
  pos = state.pos
10
- ch = state.src.charCodeAt(pos)
11
+ ch = charCodeAt(state.src, pos)
11
12
 
12
- return false if (ch != 0x60) # `
13
+ return false if (ch != 0x60) # `
13
14
 
14
15
  start = pos
15
16
  pos += 1
16
17
  max = state.posMax
17
18
 
18
- while (pos < max && state.src.charCodeAt(pos) == 0x60) # `
19
+ while (pos < max && charCodeAt(state.src, pos) == 0x60) # `
19
20
  pos += 1
20
21
  end
21
22
 
@@ -26,7 +27,7 @@ module MarkdownIt
26
27
  while ((matchStart = state.src.index('`', matchEnd)) != nil)
27
28
  matchEnd = matchStart + 1
28
29
 
29
- while (matchEnd < max && state.src.charCodeAt(matchEnd) == 0x60) # `
30
+ while (matchEnd < max && charCodeAt(state.src, matchEnd) == 0x60) # `
30
31
  matchEnd += 1
31
32
  end
32
33
 
@@ -9,7 +9,7 @@ module MarkdownIt
9
9
  #
10
10
  def self.tokenize(state, silent)
11
11
  start = state.pos
12
- marker = state.src.charCodeAt(start)
12
+ marker = charCodeAt(state.src, start)
13
13
 
14
14
  return false if silent
15
15
 
@@ -14,23 +14,23 @@ module MarkdownIt
14
14
  pos = state.pos
15
15
  max = state.posMax
16
16
 
17
- return false if state.src.charCodeAt(pos) != 0x26 # &
17
+ return false if charCodeAt(state.src, pos) != 0x26 # &
18
18
 
19
19
  if pos + 1 < max
20
- ch = state.src.charCodeAt(pos + 1)
20
+ ch = charCodeAt(state.src, pos + 1)
21
21
 
22
22
  if ch == 0x23 # '#'
23
- match = state.src.slice_to_end(pos).match(DIGITAL_RE)
23
+ match = state.src[pos..-1].match(DIGITAL_RE)
24
24
  if match
25
25
  if !silent
26
- code = match[1][0].downcase == 'x' ? match[1].slice_to_end(1).to_i(16) : match[1].to_i
26
+ code = match[1][0].downcase == 'x' ? match[1][1..-1].to_i(16) : match[1].to_i
27
27
  state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD)
28
28
  end
29
29
  state.pos += match[0].length
30
30
  return true
31
31
  end
32
32
  else
33
- match = state.src.slice_to_end(pos).match(NAMED_RE)
33
+ match = state.src[pos..-1].match(NAMED_RE)
34
34
  if match
35
35
  if MarkdownIt::HTMLEntities::MAPPINGS[match[1]]
36
36
  state.pending += fromCodePoint(MarkdownIt::HTMLEntities::MAPPINGS[match[1]]) if !silent
@@ -17,12 +17,12 @@ module MarkdownIt
17
17
  pos = state.pos
18
18
  max = state.posMax
19
19
 
20
- return false if state.src.charCodeAt(pos) != 0x5C # \
20
+ return false if charCodeAt(state.src, pos) != 0x5C # \
21
21
 
22
22
  pos += 1
23
23
 
24
24
  if pos < max
25
- ch = state.src.charCodeAt(pos)
25
+ ch = charCodeAt(state.src, pos)
26
26
 
27
27
  if ch < 256 && ESCAPED[ch] != 0
28
28
  state.pending += state.src[pos] if !silent
@@ -38,7 +38,7 @@ module MarkdownIt
38
38
  pos += 1
39
39
  # skip leading whitespaces from next line
40
40
  while pos < max
41
- ch = state.src.charCodeAt(pos)
41
+ ch = charCodeAt(state.src, pos)
42
42
  break if !isSpace(ch)
43
43
  pos += 1
44
44
  end
@@ -1,11 +1,11 @@
1
1
  # Process html tags
2
2
  #------------------------------------------------------------------------------
3
3
  module MarkdownIt
4
-
5
4
  module RulesInline
6
5
  class HtmlInline
6
+ extend Common::Utils
7
7
  include MarkdownIt::Common::HtmlRe
8
-
8
+
9
9
  #------------------------------------------------------------------------------
10
10
  def self.isLetter(ch)
11
11
  lc = ch | 0x20 # to lower case
@@ -20,12 +20,12 @@ module MarkdownIt
20
20
 
21
21
  # Check start
22
22
  max = state.posMax
23
- if (state.src.charCodeAt(pos) != 0x3C || pos + 2 >= max) # <
23
+ if (charCodeAt(state.src, pos) != 0x3C || pos + 2 >= max) # <
24
24
  return false
25
25
  end
26
26
 
27
27
  # Quick fail on second char
28
- ch = state.src.charCodeAt(pos + 1)
28
+ ch = charCodeAt(state.src, pos + 1)
29
29
  if (ch != 0x21 && # !
30
30
  ch != 0x3F && # ?
31
31
  ch != 0x2F && # /
@@ -33,7 +33,7 @@ module MarkdownIt
33
33
  return false
34
34
  end
35
35
 
36
- match = state.src.slice_to_end(pos).match(HTML_TAG_RE)
36
+ match = state.src[pos..-1].match(HTML_TAG_RE)
37
37
  return false if !match
38
38
 
39
39
  if !silent
@@ -11,8 +11,8 @@ module MarkdownIt
11
11
  oldPos = state.pos
12
12
  max = state.posMax
13
13
 
14
- return false if (state.src.charCodeAt(state.pos) != 0x21) # !
15
- return false if (state.src.charCodeAt(state.pos + 1) != 0x5B) # [
14
+ return false if (charCodeAt(state.src, state.pos) != 0x21) # !
15
+ return false if (charCodeAt(state.src, state.pos + 1) != 0x5B) # [
16
16
 
17
17
  labelStart = state.pos + 2
18
18
  labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false)
@@ -21,7 +21,7 @@ module MarkdownIt
21
21
  return false if (labelEnd < 0)
22
22
 
23
23
  pos = labelEnd + 1
24
- if (pos < max && state.src.charCodeAt(pos) == 0x28) # (
24
+ if (pos < max && charCodeAt(state.src, pos) == 0x28) # (
25
25
  #
26
26
  # Inline link
27
27
  #
@@ -30,7 +30,7 @@ module MarkdownIt
30
30
  # ^^ skipping these spaces
31
31
  pos += 1
32
32
  while pos < max
33
- code = state.src.charCodeAt(pos)
33
+ code = charCodeAt(state.src, pos)
34
34
  break if (!isSpace(code) && code != 0x0A)
35
35
  pos += 1
36
36
  end
@@ -53,7 +53,7 @@ module MarkdownIt
53
53
  # ^^ skipping these spaces
54
54
  start = pos
55
55
  while pos < max
56
- code = state.src.charCodeAt(pos)
56
+ code = charCodeAt(state.src, pos)
57
57
  break if (!isSpace(code) && code != 0x0A)
58
58
  pos += 1
59
59
  end
@@ -68,7 +68,7 @@ module MarkdownIt
68
68
  # [link]( <href> "title" )
69
69
  # ^^ skipping these spaces
70
70
  while pos < max
71
- code = state.src.charCodeAt(pos);
71
+ code = charCodeAt(state.src, pos);
72
72
  break if (!isSpace(code) && code != 0x0A)
73
73
  pos += 1
74
74
  end
@@ -76,7 +76,7 @@ module MarkdownIt
76
76
  title = ''
77
77
  end
78
78
 
79
- if (pos >= max || state.src.charCodeAt(pos) != 0x29) # )
79
+ if (pos >= max || charCodeAt(state.src, pos) != 0x29) # )
80
80
  state.pos = oldPos
81
81
  return false
82
82
  end
@@ -87,7 +87,7 @@ module MarkdownIt
87
87
  #
88
88
  return false if state.env[:references].nil?
89
89
 
90
- if (pos < max && state.src.charCodeAt(pos) == 0x5B) # [
90
+ if (pos < max && charCodeAt(state.src, pos) == 0x5B) # [
91
91
  start = pos + 1
92
92
  pos = state.md.helpers.parseLinkLabel(state, pos)
93
93
  if (pos >= 0)
@@ -13,7 +13,7 @@ module MarkdownIt
13
13
  start = state.pos
14
14
  parseReference = true
15
15
 
16
- return false if (state.src.charCodeAt(state.pos) != 0x5B) # [
16
+ return false if (charCodeAt(state.src, state.pos) != 0x5B) # [
17
17
 
18
18
  labelStart = state.pos + 1
19
19
  labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true)
@@ -22,7 +22,7 @@ module MarkdownIt
22
22
  return false if (labelEnd < 0)
23
23
 
24
24
  pos = labelEnd + 1
25
- if (pos < max && state.src.charCodeAt(pos) == 0x28) # (
25
+ if (pos < max && charCodeAt(state.src, pos) == 0x28) # (
26
26
  #
27
27
  # Inline link
28
28
  #
@@ -34,7 +34,7 @@ module MarkdownIt
34
34
  # ^^ skipping these spaces
35
35
  pos += 1
36
36
  while pos < max
37
- code = state.src.charCodeAt(pos)
37
+ code = charCodeAt(state.src, pos)
38
38
  break if (!isSpace(code) && code != 0x0A)
39
39
  pos += 1
40
40
  end
@@ -57,7 +57,7 @@ module MarkdownIt
57
57
  # ^^ skipping these spaces
58
58
  start = pos
59
59
  while pos < max
60
- code = state.src.charCodeAt(pos)
60
+ code = charCodeAt(state.src, pos)
61
61
  break if (!isSpace(code) && code != 0x0A)
62
62
  pos += 1
63
63
  end
@@ -72,7 +72,7 @@ module MarkdownIt
72
72
  # [link]( <href> "title" )
73
73
  # ^^ skipping these spaces
74
74
  while pos < max
75
- code = state.src.charCodeAt(pos)
75
+ code = charCodeAt(state.src, pos)
76
76
  break if (!isSpace(code) && code != 0x0A)
77
77
  pos += 1
78
78
  end
@@ -80,7 +80,7 @@ module MarkdownIt
80
80
  title = ''
81
81
  end
82
82
 
83
- if (pos >= max || state.src.charCodeAt(pos) != 0x29) # )
83
+ if (pos >= max || charCodeAt(state.src, pos) != 0x29) # )
84
84
  # parsing a valid shortcut link failed, fallback to reference
85
85
  parseReference = true
86
86
  end
@@ -93,7 +93,7 @@ module MarkdownIt
93
93
  #
94
94
  return false if state.env[:references].nil?
95
95
 
96
- if (pos < max && state.src.charCodeAt(pos) == 0x5B) # [
96
+ if (pos < max && charCodeAt(state.src, pos) == 0x5B) # [
97
97
  start = pos + 1
98
98
  pos = state.md.helpers.parseLinkLabel(state, pos)
99
99
  if (pos >= 0)
@@ -8,7 +8,7 @@ module MarkdownIt
8
8
  #------------------------------------------------------------------------------
9
9
  def self.newline(state, silent)
10
10
  pos = state.pos
11
- return false if state.src.charCodeAt(pos) != 0x0A # \n
11
+ return false if charCodeAt(state.src, pos) != 0x0A # \n
12
12
 
13
13
  pmax = state.pending.length - 1
14
14
  max = state.posMax
@@ -18,8 +18,8 @@ module MarkdownIt
18
18
  # Pending string is stored in concat mode, indexed lookups will cause
19
19
  # convertion to flat mode.
20
20
  if !silent
21
- if pmax >= 0 && state.pending.charCodeAt(pmax) == 0x20
22
- if pmax >= 1 && state.pending.charCodeAt(pmax - 1) == 0x20
21
+ if pmax >= 0 && charCodeAt(state.pending, pmax) == 0x20
22
+ if pmax >= 1 && charCodeAt(state.pending, pmax - 1) == 0x20
23
23
  state.pending = state.pending.sub(/ +$/, '')
24
24
  state.push('hardbreak', 'br', 0)
25
25
  else
@@ -35,7 +35,7 @@ module MarkdownIt
35
35
  pos += 1
36
36
 
37
37
  # skip heading spaces for next line
38
- while pos < max && isSpace(state.src.charCodeAt(pos))
38
+ while pos < max && isSpace(charCodeAt(state.src, pos))
39
39
  pos += 1
40
40
  end
41
41
 
@@ -65,19 +65,19 @@ module MarkdownIt
65
65
  left_flanking = true
66
66
  right_flanking = true
67
67
  max = @posMax
68
- marker = @src.charCodeAt(start)
68
+ marker = charCodeAt(@src, start)
69
69
 
70
70
  # treat beginning of the line as a whitespace
71
- lastChar = start > 0 ? @src.charCodeAt(start - 1) : 0x20
71
+ lastChar = start > 0 ? charCodeAt(@src, start - 1) : 0x20
72
72
 
73
- while (pos < max && @src.charCodeAt(pos) == marker)
73
+ while (pos < max && charCodeAt(@src, pos) == marker)
74
74
  pos += 1
75
75
  end
76
76
 
77
77
  count = pos - start
78
78
 
79
79
  # treat end of the line as a whitespace
80
- nextChar = pos < max ? @src.charCodeAt(pos) : 0x20
80
+ nextChar = pos < max ? charCodeAt(@src, pos) : 0x20
81
81
 
82
82
  isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(fromCodePoint(lastChar))
83
83
  isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(fromCodePoint(nextChar))
@@ -9,7 +9,7 @@ module MarkdownIt
9
9
  #------------------------------------------------------------------------------
10
10
  def self.tokenize(state, silent)
11
11
  start = state.pos
12
- marker = state.src.charCodeAt(start)
12
+ marker = charCodeAt(state.src, start)
13
13
 
14
14
  return false if silent
15
15
 
@@ -4,6 +4,7 @@
4
4
  module MarkdownIt
5
5
  module RulesInline
6
6
  class Text
7
+ extend Common::Utils
7
8
 
8
9
  # Rule to skip pure text
9
10
  # '{}$%@~+=:' reserved for extentions
@@ -48,7 +49,7 @@ module MarkdownIt
48
49
  def self.text(state, silent)
49
50
  pos = state.pos
50
51
 
51
- while pos < state.posMax && !self.isTerminatorChar(state.src.charCodeAt(pos))
52
+ while pos < state.posMax && !self.isTerminatorChar(charCodeAt(state.src, pos))
52
53
  pos += 1
53
54
  end
54
55
 
@@ -1,5 +1,5 @@
1
1
  module MotionMarkdownIt
2
2
 
3
- VERSION = '8.4.1.1'
3
+ VERSION = '8.4.1.2'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-markdown-it
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.4.1.1
4
+ version: 8.4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-04-16 00:00:00.000000000 Z
13
+ date: 2019-06-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mdurl-rb
@@ -80,7 +80,6 @@ files:
80
80
  - lib/motion-markdown-it/common/html_blocks.rb
81
81
  - lib/motion-markdown-it/common/html_re.rb
82
82
  - lib/motion-markdown-it/common/simpleidn.rb
83
- - lib/motion-markdown-it/common/string.rb
84
83
  - lib/motion-markdown-it/common/utils.rb
85
84
  - lib/motion-markdown-it/helpers/helper_wrapper.rb
86
85
  - lib/motion-markdown-it/helpers/parse_link_destination.rb
@@ -158,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
157
  version: '0'
159
158
  requirements: []
160
159
  rubyforge_project:
161
- rubygems_version: 2.6.8
160
+ rubygems_version: 2.7.6
162
161
  signing_key:
163
162
  specification_version: 4
164
163
  summary: Ruby version markdown-it
@@ -1,14 +0,0 @@
1
- class String
2
-
3
- # grab the remainder of the string starting at 'start'
4
- #------------------------------------------------------------------------------
5
- def slice_to_end(start)
6
- self.slice(start...self.length)
7
- end
8
-
9
- # port of Javascript function charCodeAt
10
- #------------------------------------------------------------------------------
11
- def charCodeAt(ch)
12
- self[ch].ord unless self[ch].nil?
13
- end
14
- end