gyazz-markup 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/History.txt +4 -0
- data/README.md +1 -0
- data/lib/gyazz-markup/markup.rb +6 -0
- data/lib/gyazz-markup/version.rb +1 -1
- data/samples/sample.txt +1 -0
- data/test/test_gyazz-markup.rb +5 -0
- 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: 5289a380b8892bbcadbb80a9e362ac8e13747f46
|
4
|
+
data.tar.gz: 234041925dcab83752cd64b371d32c473b050994
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 060e6ac969ad1360659415c5c72267f3bbe3aab52e0e54de9a309446dcbc26905833aef9436994d2efab30491783ad9b8009eea9541b6c2b45c17257f5703f0c
|
7
|
+
data.tar.gz: b6e3c55232a071633173c4ea012de9eab98357f2a2c933fd28cf1934b0985692b683f9f82ce750a0752baf669f3cfb508d777529f14e48e6a75d1bd31480910c
|
data/.gitignore
CHANGED
data/History.txt
CHANGED
data/README.md
CHANGED
data/lib/gyazz-markup/markup.rb
CHANGED
@@ -26,6 +26,7 @@ module GyazzMarkup
|
|
26
26
|
line = markup_strong line
|
27
27
|
line = markup_url_with_title line
|
28
28
|
line = markup_url line
|
29
|
+
line = markup_wiki_link line
|
29
30
|
line = markup_inner_link line
|
30
31
|
end
|
31
32
|
end
|
@@ -45,6 +46,11 @@ module GyazzMarkup
|
|
45
46
|
str !~ pat ? str : str.gsub(pat, "<a href=\"#{options[:host]}/#{options[:wiki]}/#{$1}\">#{$1}</a>")
|
46
47
|
end
|
47
48
|
|
49
|
+
def markup_wiki_link(str)
|
50
|
+
pat = /\[{2}([^\/]+)::(.+)\]{2}/
|
51
|
+
str !~ pat ? str : str.gsub(pat, "<a href=\"#{options[:host]}/#{$1}/\">#{$1}</a>::<a href=\"#{options[:host]}/#{$1}/#{$2}\">#{$2}</a>")
|
52
|
+
end
|
53
|
+
|
48
54
|
def markup_strong(str)
|
49
55
|
pat = /\[{3}(.+)\]{3}/
|
50
56
|
str !~ pat ? str : str.gsub(pat, "<strong>#{$1}</strong>")
|
data/lib/gyazz-markup/version.rb
CHANGED
data/samples/sample.txt
CHANGED
data/test/test_gyazz-markup.rb
CHANGED
@@ -42,6 +42,11 @@ class TestGyazzMarkup < MiniTest::Unit::TestCase
|
|
42
42
|
assert gm.markup_inner_link("[[foo bar]]") == "<a href=\"http://mygyazz.com/shokai/foo bar\">foo bar</a>", "inner link with gyazz-name"
|
43
43
|
end
|
44
44
|
|
45
|
+
def test_markup_wiki_link
|
46
|
+
assert @gm.markup_wiki_link("[[WikiName::PageName]]") == "<a href=\"http://gyazz.com/WikiName/\">WikiName</a>::<a href=\"http://gyazz.com/WikiName/PageName\">PageName</a>"
|
47
|
+
assert @gm.markup_wiki_link("[[Wiki Name::Page Name]]") == "<a href=\"http://gyazz.com/Wiki Name/\">Wiki Name</a>::<a href=\"http://gyazz.com/Wiki Name/Page Name\">Page Name</a>"
|
48
|
+
end
|
49
|
+
|
45
50
|
def test_markup_strong
|
46
51
|
assert @gm.markup_strong("[[[foo]]]") == "<strong>foo</strong>", "strong"
|
47
52
|
assert @gm.markup_strong("[[[foo bar baz]]]") == "<strong>foo bar baz</strong>", "strong with space"
|