touch_up 1.0.1 → 2.0.0

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: 1a3510239f264f68568fbf64a0de3153c57c68c7
4
- data.tar.gz: 14d61fb892f66a11ff3bddef5b75ff1fe1737d19
3
+ metadata.gz: d0e8e7732cb168af2fcebc057b581d3624cca0dd
4
+ data.tar.gz: 7a840cc995e6894e3626f0423d0399b979b574a9
5
5
  SHA512:
6
- metadata.gz: 1b499a73451c0bc5f18aa16b285137cd6c173a919d34601c3123406a6368f095b72e41a231cf98aa5606ba1d1b9f77559fb036947955b502b98a7932c28e5436
7
- data.tar.gz: d38cf1dc3ff43e5eba9f7ff8b286edf35c52e6a59173b6a5c6ab2b39123fb85439fa55fd51f307bad3e5d544bad1189f974b32f66a72af2b18f5b3292b900fc5
6
+ metadata.gz: 1d06a1c676356c0ac58ed6a1a00ab8117d730eec34db0a6fb922549ca2890e80a1adfb00b964e470118c2c8b6763ada0c1455f62958aba419e90c5224e154aef
7
+ data.tar.gz: 5b9ea08ad8b37e15819a4741719979789e5997b74e3d3f8f982b35daf2a89e168a2e7238bb56e087e6ab543dc34d772de1c66a123202e435dd1cc7efe6b33608
data/README.md CHANGED
@@ -1,7 +1,15 @@
1
1
 
2
- # Touch_Up
2
+ # Touch\_Up
3
3
 
4
- I have no idea.
4
+ My mini-alternative to [markdown](http://daringfireball.net/projects/markdown/syntax).
5
+ It uses `Regexp` (I know, I know)
6
+ and is most likely useless for your needs.
7
+
8
+ Most likely, I will stop using this and
9
+ just use [RedCarpet](https://github.com/vmg/redcarpet).
10
+
11
+ That is what you should do: don't use this.
12
+ Use [RedCarpet](https://github.com/vmg/redcarpet).
5
13
 
6
14
  ## Installation
7
15
 
@@ -9,4 +17,15 @@ I have no idea.
9
17
 
10
18
  ## Usage
11
19
 
12
- No coming any time soon.
20
+
21
+ ```ruby
22
+ require 'touch_up'
23
+
24
+ puts Touch_Up.new(<<-EOF).to_html
25
+ This is /slanted/.
26
+ This is *strong*.
27
+ This is ~~strike~~.
28
+ This is *my link* www.megauni.com.
29
+ This is lovefm.co.jp.
30
+ EOF
31
+ ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 2.0.0
@@ -58,11 +58,11 @@ class Touch_Up
58
58
 
59
59
 
60
60
  # "i", "del", "strong" tags
61
- gsub(/(?<=\s)([\*\/\-]{1,2})([^\1\<\>]+)(\1|\-\*)(?=\s)/) { |full, match|
61
+ gsub(/([\*\/\-\~]{1,2})([^\1\<\>]+)(\1)/) { |full, match|
62
62
  case
63
63
  when $1 == $3 && $1 == '/'
64
64
  "<i>#{$2}</i>"
65
- when $1 == '*-' && $3 == '-*'
65
+ when $1 == '~~' && $3 == '~~'
66
66
  "<del>#{$2}</del>"
67
67
  when $1 == $3 && $1 == '*'
68
68
  "<strong>#{$2}</strong>"
@@ -1,5 +1,5 @@
1
1
 
2
- describe 'it runs' do
2
+ describe 'italics' do
3
3
 
4
4
  it "turns slash-ed text into italics: /slash/ <i>slash</i>" do
5
5
  text = Touch_Up.new(<<-EOF)
@@ -10,6 +10,15 @@ describe 'it runs' do
10
10
  EOF
11
11
  end # === it turns slash-ed text into italics: /slash/ <i>slash</i>
12
12
 
13
+ it "leaves surrounding chars alone: I am super-/slanted/." do
14
+ Touch_Up.new("I am super-/slanted/.").
15
+ to_html.should == "I am super-<i>slanted</i>."
16
+ end
17
+
18
+ end # === describe 'italics'
19
+
20
+ describe "strong" do
21
+
13
22
  it "turns star-ed text to strong: *bold* <strong>bold</strong>" do
14
23
  text = Touch_Up.new(<<-EOF)
15
24
  This is my brave and *bold* text.
@@ -19,16 +28,30 @@ describe 'it runs' do
19
28
  EOF
20
29
  end # === it turns star-ed text to strong: *bold* <strong>bold</strong>
21
30
 
22
- it "turns star-dash-ed text to strong: *-del-* <del>del</del>" do
31
+ it "leaves surrounding chars alone: I am super-*strong*." do
32
+ Touch_Up.new("I am super*strong*.").
33
+ to_html.should == "I am super<strong>strong</strong>."
34
+ end
35
+
36
+ end # === describe "strong"
37
+
38
+ describe "strikethrough" do
39
+
40
+ it "turns strikethrough text to :del: ~~del~~ <del>del</del>" do
23
41
  text = Touch_Up.new(<<-EOF)
24
- This is my *-old-* text.
42
+ This is my ~~old~~ text.
25
43
  EOF
26
44
  text.to_html.strip.should == <<-EOF.strip
27
45
  This is my <del>old</del> text.
28
46
  EOF
29
- end # === it "turns star-dash-ed text to strong: *-del-* <del>del</del>" do
47
+ end # === it "turns strikethrough-ed text to strong: ~~del~~ <del>del</del>" do
48
+
49
+ it "leaves surrounding chars alone: I am re~~deleted~~ed." do
50
+ Touch_Up.new("I am re~~deleted~~ed.").
51
+ to_html.should == "I am re<del>deleted</del>ed."
52
+ end
30
53
 
31
- end # === describe 'it runs'
54
+ end # === describe "strikethrough"
32
55
 
33
56
  describe "linking" do
34
57
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: touch_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - da99