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 +4 -4
- data/README.md +22 -3
- data/VERSION +1 -1
- data/lib/touch_up.rb +2 -2
- data/specs/0010-it-runs.rb +28 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0e8e7732cb168af2fcebc057b581d3624cca0dd
|
4
|
+
data.tar.gz: 7a840cc995e6894e3626f0423d0399b979b574a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d06a1c676356c0ac58ed6a1a00ab8117d730eec34db0a6fb922549ca2890e80a1adfb00b964e470118c2c8b6763ada0c1455f62958aba419e90c5224e154aef
|
7
|
+
data.tar.gz: 5b9ea08ad8b37e15819a4741719979789e5997b74e3d3f8f982b35daf2a89e168a2e7238bb56e087e6ab543dc34d772de1c66a123202e435dd1cc7efe6b33608
|
data/README.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
|
2
|
-
#
|
2
|
+
# Touch\_Up
|
3
3
|
|
4
|
-
|
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
|
-
|
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
|
+
2.0.0
|
data/lib/touch_up.rb
CHANGED
@@ -58,11 +58,11 @@ class Touch_Up
|
|
58
58
|
|
59
59
|
|
60
60
|
# "i", "del", "strong" tags
|
61
|
-
gsub(/(
|
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 == '
|
65
|
+
when $1 == '~~' && $3 == '~~'
|
66
66
|
"<del>#{$2}</del>"
|
67
67
|
when $1 == $3 && $1 == '*'
|
68
68
|
"<strong>#{$2}</strong>"
|
data/specs/0010-it-runs.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
describe '
|
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 "
|
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
|
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
|
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
|
54
|
+
end # === describe "strikethrough"
|
32
55
|
|
33
56
|
describe "linking" do
|
34
57
|
|