texta 0.2.0 → 0.2.1

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.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/texta.rb +41 -3
  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.2.0') do |p|
5
+ Echoe.new('texta', '0.2.1') 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
@@ -52,7 +52,7 @@ module Texta
52
52
 
53
53
  def process(node)
54
54
  case node.name
55
- when "meta", "link"
55
+ when "meta", "link", "style"
56
56
  ""
57
57
 
58
58
  # bold
@@ -71,6 +71,7 @@ module Texta
71
71
 
72
72
  # links
73
73
  when "a"
74
+ return ""
74
75
  return "" unless node["href"]
75
76
  "[" + children(node).join(" ") + "]" + "(" + node["href"] + ")"
76
77
 
@@ -291,8 +292,8 @@ HTML
291
292
 
292
293
  def test_link
293
294
  input = "<a href='http://google.com'>Link</a>"
294
- html = '<p><a href="http://google.com">Link</a></p>'
295
- text = "[Link](http://google.com)"
295
+ html = ''
296
+ text = ""
296
297
  assert_testa input, text, html
297
298
  end
298
299
 
@@ -307,4 +308,41 @@ HTML
307
308
  input = "<img src='http://x/y/z.jpg' />"
308
309
  assert_testa input, "", ""
309
310
  end
311
+
312
+ def test_complicated
313
+ input = <<-TEXT
314
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
315
+ <meta content="Word.Document" name="ProgId" />
316
+ <meta content="Microsoft Word 12" name="Generator" />
317
+ <meta content="Microsoft Word 12" name="Originator" />
318
+ <div style="TEXT-ALIGN: justify" align="justify">
319
+ <link href="file:///C:%5CUsers%5CStefan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List" />
320
+ <link href="file:///C:%5CUsers%5CStefan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData" />
321
+ <link href="file:///C:%5CUsers%5CStefan%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping" />
322
+ <style type="text/css"> <!-- /* Font Definitions */ @font-face {"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {"Arial Unicode MS"; panose-1:2 11 6 4 2 2 2 2 2 4;} @font-face { panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {"\@Arial Unicode MS"; panose-1:2 11 6 4 2 2 2 2 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal { mso-style-parent:""; margin-top:12.0pt; margin-right:0cm; margin-bottom:0cm; margin-left:0cm; margin-bottom:.0001pt; line-height:5%; font-size:11.0pt;"Calibri","sans-serif"; mso-bidi-"Times New Roman";} .MsoChpDefault { mso-bidi-"Times New Roman";} .MsoPapDefault { margin-top:12.0pt; line-height:5%;} @page Section1 {size:595.3pt 841.9pt; margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.Section1 {page:Section1;} --></style>
323
+ <span style="FONT-FAMILY: Arial">Das T-Shirt &bdquo;Che&ldquo; der Streetwear Marke Exact Science ist eine Hommage an den Revolution&auml;r Che Guevara. Tausende T-Shirts wurden bereits mit seinem Abbild gedruckt, doch keines traf bisher unseren Geschmack so wie das T-Shirt &bdquo;Che&ldquo; von Exact Science.Genauso revolution&auml;r wie Che&lsquo;s Unabh&auml;ngigkeitsbewegung, gestaltet auch Exact Science ihre Motive und gelten deshalb als Vorreiter der T-Shirt Zunft. Die Perfekte Kombination aus Kunst und Geschichte. urban-stylistics sagt: &bdquo;Danke&ldquo;</span> <br style="FONT-FAMILY: Arial" /><span style="FONT-FAMILY: Arial">Unser Model ist 184 cm gro&szlig; und tr&auml;gt die Gr&ouml;&szlig;e M.</span><br style="FONT-FAMILY: Arial" /></div>
324
+ <p align="justify"><span style="FONT-FAMILY: Arial">100 % Baumwolle</span><br /><br /><a href="http://www.urban-stylistics.com/Marken-Mann/Exact-Science:::47_37.html" target="_self"><img height="67" alt="" src="/images/Logos Marken/xs_logo.gif" width="67" /></a></p>
325
+ TEXT
326
+
327
+ text = <<-TEXT
328
+ Das T-Shirt „Che“ der Streetwear Marke Exact Science ist eine Hommage an den Revolutionär Che Guevara. Tausende T-Shirts wurden bereits mit seinem Abbild gedruckt, doch keines traf bisher unseren Geschmack so wie das T-Shirt „Che“ von Exact Science.Genauso revolutionär wie Che‘s Unabhängigkeitsbewegung, gestaltet auch Exact Science ihre Motive und gelten deshalb als Vorreiter der T-Shirt Zunft. Die Perfekte Kombination aus Kunst und Geschichte. urban-stylistics sagt: „Danke“
329
+ Unser Model ist 184 cm groß und trägt die Größe M.
330
+
331
+
332
+ 100 % Baumwolle
333
+
334
+
335
+ TEXT
336
+
337
+ html = <<-HTML
338
+ <pre><code>Das T-Shirt &amp;bdquo;Che&amp;ldquo; der Streetwear Marke Exact Science ist eine Hommage an den Revolution&amp;auml;r Che Guevara. Tausende T-Shirts wurden bereits mit seinem Abbild gedruckt, doch keines traf bisher unseren Geschmack so wie das T-Shirt &amp;bdquo;Che&amp;ldquo; von Exact Science.Genauso revolution&amp;auml;r wie Che&amp;lsquo;s Unabh&amp;auml;ngigkeitsbewegung, gestaltet auch Exact Science ihre Motive und gelten deshalb als Vorreiter der T-Shirt Zunft. Die Perfekte Kombination aus Kunst und Geschichte. urban-stylistics sagt: &amp;bdquo;Danke&amp;ldquo;
339
+ </code></pre>
340
+
341
+ <p> Unser Model ist 184 cm gro&szlig; und tr&auml;gt die Gr&ouml;&szlig;e M.</p>
342
+
343
+ <p>100 % Baumwolle</p>
344
+ HTML
345
+
346
+ assert_testa input, text, html
347
+ end
310
348
  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.2.0"
5
+ s.version = "0.2.1"
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pboy