texta 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/texta.rb +13 -1
  3. data/texta.gemspec +1 -1
  4. metadata +1 -1
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('texta', '0.1.4') do |p|
5
+ Echoe.new('texta', '0.1.5') do |p|
6
6
  p.description = "texta: heuristic text formatting"
7
7
  p.url = "http://github.com/pboy/texta"
8
8
  p.author = "pboy"
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{texta}
5
- s.version = "0.1.4"
5
+ s.version = "0.1.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["pboy"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - pboy