wraptext 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/lib/wraptext/parser.rb +3 -1
- data/spec/wraptext/parser_spec.rb +16 -0
- data/wraptext.gemspec +6 -3
- metadata +7 -6
data/lib/wraptext/parser.rb
CHANGED
@@ -21,7 +21,9 @@ module Wraptext
|
|
21
21
|
@doc = if text_or_nokogiri_doc.is_a? Nokogiri::XML::Document
|
22
22
|
text_or_nokogiri_doc
|
23
23
|
elsif text_or_nokogiri_doc.is_a? String
|
24
|
-
Nokogiri
|
24
|
+
# We add the empty paragraph tag, as Nokogiri assumes that leading script
|
25
|
+
# tags belong in the document head otherwise.
|
26
|
+
Nokogiri::HTML "<p></p>" + text_or_nokogiri_doc
|
25
27
|
else
|
26
28
|
raise "#initialize requires a string or Nokogiri document"
|
27
29
|
end
|
@@ -165,4 +165,20 @@ EOF
|
|
165
165
|
Wraptext::Parser.new(article).to_html.should match("</em> <a")
|
166
166
|
end
|
167
167
|
end
|
168
|
+
|
169
|
+
it "should not strip leading script tags" do
|
170
|
+
doc = <<-EOF
|
171
|
+
<script type='text/javascript' src='http://WTXF.images.worldnow.com/interface/js/WNVideo.js?rnd=543235;hostDomain=www.myfoxphilly.com;playerWidth=645;playerHeight=362;isShowIcon=true;clipId=8157027;flvUri=;partnerclipid=;adTag=Morning%2520Show;advertisingZone=;enableAds=true;landingPage=;islandingPageoverride=false;playerType=STANDARD_EMBEDDEDscript;controlsType=overlay'></script><a href="http://www.myfoxphilly.com" title="Philadelphia News, Weather and Sports from WTXF FOX 29">Philadelphia News, Weather and Sports from WTXF FOX 29</a>
|
172
|
+
|
173
|
+
Viewers of <em>Good Day Philadelphia</em> got a surprise Wednesday morning when Mark Wahlberg stopped by to do the weather and traffic.
|
174
|
+
|
175
|
+
Wahlberg, who is promoting his upcoming movie <em>Broken City</em>, delivered the impromptu report on Fox affiliate WTXF. Looking ahead to the seven-day forecast, Wahlberg, joined by <em>Broken City</em> Director Allen Hughes, pronounced Wednesday's 54 degrees "perfect golf weather." Wahlberg then slipped into a Philly accent for the traffic report: "Look at this congestion here. We're expecting 40- to 45-minute delays if you're coming east bound on the 676 here. You're going to have some serious problems. Why don't you stop and get yourself a hoagie?"
|
176
|
+
|
177
|
+
Wahlberg goofs amiably but he's a long way from topping Sacha Baron Cohen's local news cameo in <em>Borat</em> below.
|
178
|
+
|
179
|
+
|
180
|
+
<iframe width="640" height="360" src="http://www.youtube.com/embed/KlXd9cooOhE" frameborder="0" allowfullscreen></iframe>
|
181
|
+
EOF
|
182
|
+
Wraptext::Parser.new(doc).to_html.should match("<script")
|
183
|
+
end
|
168
184
|
end
|
data/wraptext.gemspec
CHANGED
@@ -2,16 +2,19 @@
|
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.authors = ["Chris Heald"]
|
4
4
|
gem.email = ["cheald@gmail.com"]
|
5
|
-
gem.description = %q{
|
5
|
+
gem.description = %q{
|
6
|
+
Performs Wordpress-style conversion of single and double newlines to <p> and <br /> tags. Produces well-formed HTML and intelligently ignores unbreakable
|
7
|
+
sections like <script> and <pre> tags. Conveniently turns Wordpress post content into valid HTML.
|
8
|
+
}
|
6
9
|
gem.summary = %q{Wraps bare text nodes from an HTML document in <p> tags and splits text nodes on double newlines.}
|
7
|
-
gem.homepage = ""
|
10
|
+
gem.homepage = "http://github.com/cheald/wraptext"
|
8
11
|
|
9
12
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
10
13
|
gem.files = `git ls-files`.split("\n")
|
11
14
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
12
15
|
gem.name = "wraptext"
|
13
16
|
gem.require_paths = ["lib"]
|
14
|
-
gem.version = "0.1.
|
17
|
+
gem.version = "0.1.5"
|
15
18
|
|
16
19
|
gem.add_dependency('nokogiri')
|
17
20
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: wraptext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Chris Heald
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
type: :runtime
|
@@ -27,9 +27,10 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
name: nokogiri
|
30
|
-
description:
|
31
|
-
|
32
|
-
|
30
|
+
description: ! "\n Performs Wordpress-style conversion of single and double newlines
|
31
|
+
to <p> and <br /> tags. Produces well-formed HTML and intelligently ignores unbreakable\n
|
32
|
+
\ sections like <script> and <pre> tags. Conveniently turns Wordpress post content
|
33
|
+
into valid HTML.\n "
|
33
34
|
email:
|
34
35
|
- cheald@gmail.com
|
35
36
|
executables: []
|
@@ -58,7 +59,7 @@ files:
|
|
58
59
|
- spec/spec_helper.rb
|
59
60
|
- spec/wraptext/parser_spec.rb
|
60
61
|
- wraptext.gemspec
|
61
|
-
homepage:
|
62
|
+
homepage: http://github.com/cheald/wraptext
|
62
63
|
licenses: []
|
63
64
|
post_install_message:
|
64
65
|
rdoc_options: []
|