texta 0.1.4 → 0.1.5
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.
- data/Rakefile +1 -1
- data/lib/texta.rb +13 -1
- data/texta.gemspec +1 -1
- metadata +1 -1
data/Rakefile
CHANGED
data/lib/texta.rb
CHANGED
@@ -13,7 +13,7 @@ module Texta
|
|
13
13
|
def self.is_html?(text)
|
14
14
|
return true if text =~ /&([a-z]+)|(#[0-9]+);/
|
15
15
|
|
16
|
-
text =~ /<(ul|a|p|br|li|b|i)\b(.*?)>/
|
16
|
+
text =~ /<(ul|a|p|br|li|img|b|i)\b(.*?)>/
|
17
17
|
end
|
18
18
|
|
19
19
|
module StringAdapter
|
@@ -79,6 +79,13 @@ module Texta
|
|
79
79
|
when /h([1-6])/
|
80
80
|
"#" * $1.to_i + " " + children(node).join(" ") + "\n\n"
|
81
81
|
|
82
|
+
# images
|
83
|
+
|
84
|
+
when "img"
|
85
|
+
if alt = node["alt"] || node["title"]
|
86
|
+
"[#{alt}]"
|
87
|
+
end
|
88
|
+
|
82
89
|
# text nodes
|
83
90
|
|
84
91
|
when "text"
|
@@ -285,4 +292,9 @@ HTML
|
|
285
292
|
text = "\nho!"
|
286
293
|
assert_testa input, text, html
|
287
294
|
end
|
295
|
+
|
296
|
+
def test_img
|
297
|
+
input = "<img src='http://x/y/z.jpg' />"
|
298
|
+
assert_testa input, "", ""
|
299
|
+
end
|
288
300
|
end
|
data/texta.gemspec
CHANGED