md_to_bbcode 1.1.1 → 1.1.2

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
  SHA256:
3
- metadata.gz: 882bfada1866cb31be09d565ddbdf8b7a4a76570e66c2f0618951ad7815888f7
4
- data.tar.gz: 70b7c9fb216b71575e56521104e3ccc23cbd807c0cfff63ac2791d3c0dc0d957
3
+ metadata.gz: 3879a85ee622be55cd4e43e0a882b2330478a552f0e5c239ade8fbf3bace621a
4
+ data.tar.gz: 5e5b9dfe539a0e38f6a1a70ea1cde9a4980a0292d24927d40c4ab2d2116ee24b
5
5
  SHA512:
6
- metadata.gz: 2aca2c89a8854d459a603d114dadb2fdb9afb3b002a5cb90b1744f352facee7d5a3784276473d09f6eee33753df59210383f66353f4b452162db1a11fd1e413c
7
- data.tar.gz: 40d70ca3254263bc8a0deb320b1845d1aa8b074a908de38465ae7ee1db28a68accd141d84a5e425c6e5da62f3cb7a5740576a1d160ba48b9f74731f6a1206161
6
+ metadata.gz: f732c4557d7ddc4b3d3662290ceb531f36ef50a8c18c20d7bdcee81d2313d7f2dd1d8bb5e8df2bbd4f079a3016c5d43b5fa72165b9f259c7db207dfba16e7a87
7
+ data.tar.gz: 4330680e4ab619d63b7c6b9698cf4ddee3d8e66f8466b60a8b559016b41447f7a58f69e77f917bad0e48bcc22f1221d28d1db0ee350b07449042670df9830174
@@ -62,14 +62,12 @@ module MdToBbcode
62
62
  else
63
63
  field.gsub!(/\*(\S.*?)\*/, '[i]\1[/i]')
64
64
  end
65
- if field =~ /.*\*.*/
66
- if in_italic_text
67
- field.gsub!(/(.*\S)\*(.*)/, '\1[/i]\2')
68
- in_italic_text = false
69
- else
70
- field.gsub!(/(.*)\*(\S.*)/, '\1[i]\2')
71
- in_italic_text = true
72
- end
65
+ if in_italic_text && field =~ /.*\S\*.*/
66
+ field.gsub!(/(.*\S)\*(.*)/, '\1[/i]\2')
67
+ in_italic_text = false
68
+ elsif !in_italic_text && field =~ /.*\*\S.*/
69
+ field.gsub!(/(.*)\*(\S.*)/, '\1[i]\2')
70
+ in_italic_text = true
73
71
  end
74
72
  field
75
73
  end
@@ -1,5 +1,5 @@
1
1
  module MdToBbcode
2
2
 
3
- VERSION = '1.1.1'
3
+ VERSION = '1.1.2'
4
4
 
5
5
  end
@@ -24,6 +24,19 @@ describe MdToBbcode do
24
24
  expect('*Italic text*'.md_to_bbcode).to eq '[i]Italic text[/i]'
25
25
  end
26
26
 
27
+ it 'converts italic text after a list' do
28
+ md = <<~EOS
29
+ * List item
30
+ *Italic text*
31
+ EOS
32
+ expect(md.md_to_bbcode).to eq(<<~EOS)
33
+ [list]
34
+ [*]List item
35
+ [/list]
36
+ [i]Italic text[/i]
37
+ EOS
38
+ end
39
+
27
40
  it 'converts italic and bold mixed text' do
28
41
  expect('*Italic and **bold** text* and then **bold and *italic* text**'.md_to_bbcode).to eq '[i]Italic and [b]bold[/b] text[/i] and then [b]bold and [i]italic[/i] text[/b]'
29
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md_to_bbcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan