motion-markdown-it 4.1.0.1 → 4.1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff09df2d99031e399da64902f3d11648574bd646
4
- data.tar.gz: f6f52c3479c1805ec267503ff12f567d7539df61
3
+ metadata.gz: 214800d2799b974abec953888695a55f613bf244
4
+ data.tar.gz: 16fed8197c4f45298e8afe3994ff701c49bf3b61
5
5
  SHA512:
6
- metadata.gz: c145910ac522f1e62985bce82e1509fb79f6ab803d52d35886ac1c370d3e84d3bc495c4c9592b501bd25775146a505471422ff17875ac78f97ebb7f25c5518fd
7
- data.tar.gz: 2d20509844c9f7d40b2702a0cb366dca3a65e8a0b2ed693b3c3c3e79b953004a460c6843a4e5d88ce415669c674d3cb3d4191302af5bd9965ae2077960700749
6
+ metadata.gz: 73a7c3eb82df1344805e860c58ad815618cbbe727a2cbd42350687d6c559a7bf7b6672f70f22d5234bbf679fc10896263192f6e617899663d7dfb0967b273c88
7
+ data.tar.gz: 357565490abb891b1bf6cc3d5b31240aa8b0da3c6e8f512e9440276bfcd750676c634989c76abe8db96109c86d207fe7b215526b0919535eac70f823d4870d1e
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Ruby/RubyMotion version of Markdown-it (CommonMark compliant and extendable)
6
6
 
7
- This gem is a port of the [markdown-it Javascript package](https://github.com/markdown-it/markdown-it) by Vitaly Puzrin and Alex Kocharin. Currently synced with markdown-it 4.0.3
7
+ This gem is a port of the [markdown-it Javascript package](https://github.com/markdown-it/markdown-it) by Vitaly Puzrin and Alex Kocharin. Currently synced with markdown-it 4.1.0
8
8
 
9
9
  __[Javascript Live demo](https://markdown-it.github.io)__
10
10
 
@@ -407,20 +407,20 @@ module MarkdownIt
407
407
  # chainable
408
408
  # MarkdownIt.use(plugin, params)
409
409
  #
410
- # Load specified plugin with given params into current parser instance.
411
- # It's just a sugar to call `plugin(md, params)` with curring.
410
+ # Initialize and Load specified plugin with given params into current parser
411
+ # instance. It's just a sugar to call `plugin.init_plugin(md, params)`
412
412
  #
413
413
  # ##### Example
414
414
  #
415
- # ```javascript
416
- # var iterator = require('markdown-it-for-inline');
417
- # var md = require('markdown-it')()
418
- # .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
419
- # tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
420
- # });
415
+ # ```ruby
416
+ # md = MarkdownIt::Parser.new
417
+ # md.use(MDPlugin::Iterator, 'foo_replace', 'text',
418
+ # lambda {|tokens, idx|
419
+ # tokens[idx].content = tokens[idx].content.gsub(/foo/, 'bar')
420
+ # })
421
421
  # ```
422
422
  def use(plugin, *args)
423
- plugin.call(plugin, *args)
423
+ plugin.init_plugin(self, *args)
424
424
  return self
425
425
  end
426
426
 
@@ -1,5 +1,5 @@
1
1
  module MotionMarkdownIt
2
2
 
3
- VERSION = '4.1.0.1'
3
+ VERSION = '4.1.0.2'
4
4
 
5
5
  end
@@ -26,17 +26,23 @@ describe 'API' do
26
26
  }.to raise_error
27
27
  end
28
28
 
29
- #------------------------------------------------------------------------------
30
- it 'plugin' do
29
+ class TestPlugin
31
30
  @success = false
32
- plugin = lambda {|plugin, opts| @success = true if (opts == 'bar') }
31
+ def self.init_plugin(md, options)
32
+ @success = true if (options == 'bar')
33
+ end
34
+ def self.success
35
+ @success
36
+ end
37
+ end
33
38
 
39
+ #------------------------------------------------------------------------------
40
+ it 'plugin' do
34
41
  md = MarkdownIt::Parser.new
35
-
36
- md.use(plugin, 'foo')
37
- expect(@success).to eq false
38
- md.use(plugin, 'bar')
39
- expect(@success).to eq true
42
+ md.use(TestPlugin, 'foo')
43
+ expect(TestPlugin.success).to eq false
44
+ md.use(TestPlugin, 'bar')
45
+ expect(TestPlugin.success).to eq true
40
46
  end
41
47
 
42
48
  #------------------------------------------------------------------------------
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: 4.1.0.1
4
+ version: 4.1.0.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: 2015-04-01 00:00:00.000000000 Z
13
+ date: 2015-04-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mdurl-rb