wraptext 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,18 +44,14 @@ module Wraptext
44
44
  private
45
45
 
46
46
  def strip_empty_paragraphs!
47
- @root.xpath("//p").each do |node|
48
- if node.text.strip == ''
49
- empty = true
50
- node.children.each do |child|
51
- if child.name != "text"
52
- empty = false
53
- break
54
- end
55
- end
56
- node.remove if empty
47
+ @root.xpath("//p").each do |n|
48
+ if n.inner_html.strip == ''
49
+ n.remove
50
+ elsif n.content.strip == ''
51
+ n.parent.add_child n.children
52
+ n.remove
57
53
  end
58
- end
54
+ end
59
55
  end
60
56
 
61
57
  # This traverses the entire document, and where it finds double newlines in text,
@@ -110,7 +106,8 @@ module Wraptext
110
106
  if top.name == "p"
111
107
  top.add_child node.clone
112
108
  else
113
- p = @root.create_element "p", text
109
+ p = @root.create_element "p"
110
+ p.add_child node.clone
114
111
  top.add_child p
115
112
  top = p
116
113
  end
@@ -0,0 +1,11 @@
1
+ <?
2
+ require('wordpress_autop.php');
3
+ $dp = opendir("./in");
4
+ while (false !== ($entry = readdir($dp))) {
5
+ $data = file_get_contents("in/" . $entry);
6
+ $out = wpautop($data, 0);
7
+ $fp = fopen("out/" . $entry, "w");
8
+ fwrite($fp, $out);
9
+ fclose($fp);
10
+ }
11
+ fclose($dp);
@@ -0,0 +1,48 @@
1
+ <p><img src="http://mashable.com/wp-content/uploads/2010/09/mash-awards-small.jpg" class="alignleft" alt="Mashable Awards Image"><em>As part of the ongoing <a href="http://mashable.com/awards/pages/about" target="_blank">Mashable Awards</a>, we're taking a closer look at each of the <a href="http://mashable.com/awards/categories" target="_blank">nomination categories</a>. This is "<a href="http://mashable.com/awards/votes/category/49?c=49" target="_blank">Most Influential Social Good Champion</a>" supported by Yahoo!. Be sure to <a href="http://mashable.com/awards/votes" target="_blank">nominate</a> your favorites and join us for the <a href="http://mashable.com/awards/pages/event" target="-blank">Gala in Las Vegas</a>!</em></p>
2
+ <p>
3
+ <img src="http://mashable.com/wp-content/uploads/2010/11/225champ.jpg" alt="social good champion" title="225champ" width="225" height="225" class="alignright size-full wp-image-450493">Social Good is a brand new form of online giving that draws both from small non-profits and large brand cause-marketing campaigns. But like any burgeoning movement, social good requires champions to bring it to the public and promote its growth.</p>
4
+ <p>While "social good" and "influence" may not have absolutely concrete definitions (is influence based on Twitter followers? Raising the most money?), it is easy to see when an individual has taken on the cause of social good to create some real change. </p>
5
+ <p>Even though the exact parameters are a subjective call, we scoured the web for three social good activists who are using their skills to create change. We've highlighted three individuals who are utilizing social media and online campaigns to <a href="http://mashable.com/2010/10/09/social-media-activism/">shape the way that we think about activism</a>. </p>
6
+ <hr>
7
+ <h2>1. The Free Agent</h2>
8
+ <hr>
9
+ <p>Beth Kanter and Allison Fine defined the concept of the "free agent" this year in their book, <a href="http://www.amazon.com/Networked-Nonprofit-Connecting-Social-Change/dp/0470547979" target="_blank"><em>The Networked Nonprofit</em></a>. A "free agent," as they <a href="http://www.bethkanter.org/lightbulb-fortress-freeagent/" target="_Blank"> defined it</a>, is a "person who is passionate about a social cause, but is working outside of a nonprofit organization to organize, mobilize, raise money, and engage with others." Using social media tools, free agents are able to make an impact that was once only capable within the infrastructure of an organization.</p>
10
+ <p>We've covered a number of <a href="http://mashable.com/2010/10/05/youtube-projects-social-good/">free agents</a> who had influence this year. Individuals like <a href="http://uncultured.com/" target="_blank">Shawn Ahmed</a>, who posts <a href="http://mashable.com/category/youtube/">YouTube</a> videos about poverty in Bangladesh; Mark Horvath, who gives homelessness a voice through his <a href="http://wearevisible.com/" target="_blank">We Are Visible</a> and <a href="http://invisiblepeople.tv/blog/" target="_blank">Invisible People</a> projects; and even Dan Savage, who launched the <a href="http://mashable.com/2010/09/21/dan-savage-youtube/">It Gets Better Project</a> in September to support gay teens who face adversity.</p>
11
+ <p>Kanter, a free agent <a href="http://beth.typepad.com/beths_blog/2009/01/birthday-campaign-reflection-creating-a-culture-of-giving-in-your-network.html" target="_blank">herself</a>, has played an influential role in helping non-profit organizations accept and cooperate with these social media-powered activists. Among her efforts, she <a href="http://www.bethkanter.org/techatstate/" target="_blank">facilitated a conversation at the State Department's </a><a href="http://techatstate.eventbrite.com/" target="_blank">Tech@State Civil Society 2.0</a> event about how non-profits and free agents can work together.</p>
12
+ <hr>
13
+ <h2>2. Ben Rattray, Founder and CEO of Change.org</h2>
14
+ <hr>
15
+ <p>There are two hurdles that almost every cause campaign struggles with. The first is making the complexities and realities of its cause understood. The second is mobilizing people effectively. <a href="http://www.change.org" target="_blank">Change.org</a>, which was founded by Ben Rattray in 2006, helps solve both. </p>
16
+ <p>The site has more than 100 writers who contribute in-depth reporting on 15 different causes. When people come to the site to read about a cause they're passionate about, they also have the opportunity to take action toward that cause by signing petitions. While these cumulative actions lack the drama of a protest, mobilizing a large network toward one specific action has proved a lot more effective than a hodgepodge of independent actions. </p>
17
+ <p>Change.org has partnered with thousands of non-profits, and together the community has accomplished more than <a href="http://www.change.org/petitions?order=victories" target="_blank">100 "victories,"</a> in which they've changed an unjust practice, law or policy. The organization connects activists with similar passions, and by doing so it gives them power as a cohort that they would never have as individuals.</p>
18
+ <hr>
19
+ <h2>3. Scott Harrison, Founder of Charity: Water</h2>
20
+ <hr>
21
+ <p>Charity: water uses 100% of public donations to fund water projects and is transparent about how donations are used. Both of these qualities make it somewhat of an oddball in the non-profit world -- which might be exactly what the non-profit world needs.</p>
22
+ <p>When people donate money to most organizations, they're not sure what happens to their donation or how efficiently it was used. When they give to charity: water, they can <a href="http://www.charitywater.org/projects/map/" target="_blank">look up a picture and GPS coordinates</a> of the project they contributed to. Since the organization relies on private donors for the money that makes it run, there's no doubt about whether your donation ended up paying for somebody's flight instead of funding a water project. The organization even covers its PayPal fees on donations. </p>
23
+ <p>This model of transparency and accountability has created trust and helped raise more than $20 million for 3,196 projects in the past four years. We hope that its success will influence other non-profits to do the same.</p>
24
+ <hr>
25
+ <h2>
26
+ What&acirc;&euro;&trade;s Your Pick?
27
+ </h2>
28
+ <hr>
29
+ <p>
30
+ Who were your social good champions this year? Let us know in the comments or nominate them for a Mashable Awards.</p>
31
+ <hr>
32
+ <h3>
33
+ The Mashable Awards Gala at Cirque du Soleil Zumanity (Vegas)
34
+ </h3>
35
+ <hr>
36
+ <p>In partnership with Cirque du Soleil, The Mashable Awards Gala event will bring together the winners and nominees, the Mashable community, partners, media, the marketing community, consumer electronics and technology brands and attendees from the 2011 International CES Convention to Las Vegas on Thursday, January 6, 2011. Together, we will celebrate the winners and the community of the Mashable Awards at the Cirque du Soleil Zumanity stage in the beautiful New York New York Hotel. The event will include acts and performances from our partner Cirque du Soleil Zumanity. In addition, there will be special guest presenters and appearances.</p>
37
+ <p>
38
+ <strong>Date</strong>: Thursday, January 6th, 2011 (during International CES Convention week)
39
+ <strong>Time</strong>: 7:00 &acirc;&euro;&ldquo; 10:00 p.m. PT
40
+ <strong>Location</strong>: Cirque du Soleil Zumanity, New York New York Hotel, Las Vegas
41
+ <strong>Agenda</strong>: Networking, Open Bars, Acts, Surprises and the Mashable Awards Gala presentations
42
+ <strong>Socialize</strong>: <a href="http://www.facebook.com/event.php?eid=123960060989680&amp;ref=ts" target="_blank">Facebook</a>, <a href="http://foursquare.com/venue/8822146" target="_blank">Foursquare</a>, <a href="http://www.meetup.com/mashable/22947/" target="_blank">Meetup</a>, <a href="http://plancast.com/p/27by" target="_blank">Plancast</a>, <a href="http://search.twitter.com/search?q=%23mashableawards" target="_blank">Twitter</a> (Hashtag: #MashableAwards)</p>
43
+ <p>
44
+ <strong><em>Mashable Awards Category Sponsor:</em></strong></p>
45
+ <p>
46
+ <a href="http://ycorpblog.com/"><img src="http://mashable.com/wp-content/uploads/2010/11/yahoo_logo-200x1001.jpg" alt="" title="yahoo_logo-200x100" width="200" height="100" class="alignleft size-full wp-image-442741"></a>Yahoo! is an innovative technology company that operates the largest digital media, content, and communications business in the world. Yahoo! keeps more than half a billion consumers worldwide connected to what matters to them most, and delivers powerful audience solutions to advertisers through its unique combination of Science + Art + Scale. Yahoo! is headquartered in Sunnyvale, California. For more information, visit the company&acirc;&euro;&trade;s blog, <a href="http://ycorpblog.com/" target="_blank">Yodel Anecdotal</a>.</p>
47
+ <p>
48
+ <em>Image courtesy of <a rel="nofollow" href="http://www.istockphoto.com/mashableoffer.php">iStockphoto</a>, <a rel="nofollow" href="http://www.istockphoto.com/user_view.php?id=550207">RichVintage</a></em></p>
@@ -0,0 +1,22 @@
1
+ <p><img src="http://ec.mashable.com/wp-content/uploads/2009/01/bizspark2.gif" alt="" align="left"><em>The <a href="http://mashable.com/tag/bizspark">Spark of Genius Series</a> highlights a unique feature of startups and is made possible by <a rel="nofollow" href="http://www.microsoftstartupzone.com/BizSpark/Pages/At_a_Glance.aspx?WT.mc_id=MSZ_Mashable_posts">Microsoft BizSpark</a>. If you would like to have your startup considered for inclusion, please see the details <a href="http://mashable.com/bizspark/">here</a>.</em></p>
2
+ <p>
3
+ <img src="http://mashable.com/wp-content/uploads/2010/11/networking.jpg" alt="" title="networking" width="225" height="225" class="alignright"><strong>Name:</strong> <a href="http://www.hashable.com/" target="_blank">Hashable</a></p>
4
+ <p>
5
+ <strong>Quick Pitch:</strong> Track and share all your social and professional interactions and discover who else is out there to connect with.</p>
6
+ <p>
7
+ <strong>Genius Idea:</strong> Networking is an important activity for most of us. In the age of social media, tools like <a href="http://mashable.com/category/twitter">Twitter</a> and <a href="http://mashable.com/tag/linkedin">LinkedIn</a> help us extend offline networking online, but private beta startup Hashable seeks to both simplify and better track our personal and professional interactions.</p>
8
+ <p>Hashable helps you document real-world connections with friends and professional contacts by using hashtags to describe interactions. Hashable tracks actions, connections, salutations, props and any other type of hashtag you can dream up.</p>
9
+ <p>With introductions, for instance, a Hashable user can introduce any two Twitter users or e-mail contacts using the "Make an #intro" feature. Hashable publicly (or privately) notifies both parties via Twitter or e-mail and follows up to verify a connection was made. </p>
10
+ <p>The "Post a connection" feature lets you specify a hashtag and the e-mail addresses or Twitter names of the people you have connected with offline. With this feature, you can use the system to quickly document all types of exchanges with hashtags such as #justmet, #meeting, #breakfast, #lunch, #dinner, #drinks, #coffee, #golf, #tennis, #brunch and #thanks.</p>
11
+ <p>Hashable supports Twitter and e-mail and will soon support iPhone-app connections. The service employs game mechanics to inspire user engagement, rewarding users with points in the form of "Hashcred" for making introductions and receiving connections; super users are highlighted on the "top connectors" leader boards.</p>
12
+ <p>The ultimate aim is to create a new data set around person-to-person interactions. The premise is that people already share their breakfast meetings and coffee get-togethers on Twitter, so Hashable wants to capture that information and structure the data for individual user and global insight. It's the social graph concept that Facebook is working to build around friends, but with relationships and specific interactions in focus.</p>
13
+ <p>The startup just closed a $4 million round of funding led by Union Square Ventures, giving the company a rumored $30 million valuation, according to <a href="http://mediamemo.allthingsd.com/20101122/meet-hashable-which-wants-to-make-money-by-introducing-you/" target="_blank"><em>All Things D</em></a>. That's not too shabby, considering the startup pivoted from a financial data site to focus on this idea not too long ago.</p>
14
+ <p>Hashable is currently in private beta, but the first 1,000 <em>Mashable</em> readers to follow the <a href="http://twitter.com/hashable" target="_blank">Hashable Twitter account</a> will receive invites to the site.</p>
15
+ <p>
16
+ <em>Image courtesy of Flickr, <a href="http://www.flickr.com/photos/tedxsf/" target="_blank">Tedx SF</a></em></p>
17
+ <hr>
18
+ <p><strong>Series Supported by Microsoft BizSpark</strong>
19
+ </p>
20
+ <hr>
21
+ <p>
22
+ <em>The <a href="http://mashable.com/tag/bizspark">Spark of Genius Series</a> highlights a unique feature of startups and is made possible by <a rel="nofollow" href="http://www.microsoftstartupzone.com/BizSpark/Pages/At_a_Glance.aspx?WT.mc_id=MSZ_Mashable_posts">Microsoft BizSpark</a>, a startup program that gives you three-year access to the latest Microsoft development tools, as well as connecting you to a nationwide network of investors and incubators. There are no upfront costs, so if your business is privately owned, less than three years old, and generates less than U.S.$1 million in annual revenue, you can <a href="http://mashable.com/bizspark">sign up today</a>.</em></p>
@@ -0,0 +1,3 @@
1
+ <p>U.S. citizens: If you don't have a Great Aunt Ida from which to glean family recipes, never you worry -- today's Google Doodle features a sumptuous feast and a bevy of recipes from the <em>Barefoot Contessa</em>'s Ina Garten.</p>
2
+ <p>Simply surf on over to the <a href="http://www.google.com/">Google</a> homepage today and click on the Doodle -- which depicts a tasty-looking meal -- to reveal <a href="http://www.google.com/landing/thanksgiving/#turkey">six recipes</a> from The Food Network star, including roast turkey with herb and apple stuffing, popovers and smashed sweet potatoes.</p>
3
+ <p>Google has its hands in pretty much <a href="http://mashable.com/2010/11/17/google-boutiques/">every other sector of our lives</a>, it might as well dig into dinner as well -- just not literally, because that would be gross.</p>
@@ -0,0 +1,48 @@
1
+ <p><img src="http://mashable.com/wp-content/uploads/2010/09/mash-awards-small.jpg" class="alignleft" alt="Mashable Awards Image"><em>As part of the ongoing <a href="http://mashable.com/awards/pages/about" target="_blank">Mashable Awards</a>, we're taking a closer look at each of the <a href="http://mashable.com/awards/categories" target="_blank">nomination categories</a>. This is "<a href="http://mashable.com/awards/votes/category/49?c=49" target="_blank">Most Influential Social Good Champion</a>" supported by Yahoo!. Be sure to <a href="http://mashable.com/awards/votes" target="_blank">nominate</a> your favorites and join us for the <a href="http://mashable.com/awards/pages/event" target="-blank">Gala in Las Vegas</a>!</em></p>
2
+ <p>
3
+ <img src="http://mashable.com/wp-content/uploads/2010/11/225champ.jpg" alt="social good champion" title="225champ" width="225" height="225" class="alignright size-full wp-image-450493">Social Good is a brand new form of online giving that draws both from small non-profits and large brand cause-marketing campaigns. But like any burgeoning movement, social good requires champions to bring it to the public and promote its growth.</p>
4
+ <p>While "social good" and "influence" may not have absolutely concrete definitions (is influence based on Twitter followers? Raising the most money?), it is easy to see when an individual has taken on the cause of social good to create some real change. </p>
5
+ <p>Even though the exact parameters are a subjective call, we scoured the web for three social good activists who are using their skills to create change. We've highlighted three individuals who are utilizing social media and online campaigns to <a href="http://mashable.com/2010/10/09/social-media-activism/">shape the way that we think about activism</a>. </p>
6
+ <hr>
7
+ <h2>1. The Free Agent</h2>
8
+ <hr>
9
+ <p>Beth Kanter and Allison Fine defined the concept of the "free agent" this year in their book, <a href="http://www.amazon.com/Networked-Nonprofit-Connecting-Social-Change/dp/0470547979" target="_blank"><em>The Networked Nonprofit</em></a>. A "free agent," as they <a href="http://www.bethkanter.org/lightbulb-fortress-freeagent/" target="_Blank"> defined it</a>, is a "person who is passionate about a social cause, but is working outside of a nonprofit organization to organize, mobilize, raise money, and engage with others." Using social media tools, free agents are able to make an impact that was once only capable within the infrastructure of an organization.</p>
10
+ <p>We've covered a number of <a href="http://mashable.com/2010/10/05/youtube-projects-social-good/">free agents</a> who had influence this year. Individuals like <a href="http://uncultured.com/" target="_blank">Shawn Ahmed</a>, who posts <a href="http://mashable.com/category/youtube/">YouTube</a> videos about poverty in Bangladesh; Mark Horvath, who gives homelessness a voice through his <a href="http://wearevisible.com/" target="_blank">We Are Visible</a> and <a href="http://invisiblepeople.tv/blog/" target="_blank">Invisible People</a> projects; and even Dan Savage, who launched the <a href="http://mashable.com/2010/09/21/dan-savage-youtube/">It Gets Better Project</a> in September to support gay teens who face adversity.</p>
11
+ <p>Kanter, a free agent <a href="http://beth.typepad.com/beths_blog/2009/01/birthday-campaign-reflection-creating-a-culture-of-giving-in-your-network.html" target="_blank">herself</a>, has played an influential role in helping non-profit organizations accept and cooperate with these social media-powered activists. Among her efforts, she <a href="http://www.bethkanter.org/techatstate/" target="_blank">facilitated a conversation at the State Department's </a><a href="http://techatstate.eventbrite.com/" target="_blank">Tech@State Civil Society 2.0</a> event about how non-profits and free agents can work together.</p>
12
+ <hr>
13
+ <h2>2. Ben Rattray, Founder and CEO of Change.org</h2>
14
+ <hr>
15
+ <p>There are two hurdles that almost every cause campaign struggles with. The first is making the complexities and realities of its cause understood. The second is mobilizing people effectively. <a href="http://www.change.org" target="_blank">Change.org</a>, which was founded by Ben Rattray in 2006, helps solve both. </p>
16
+ <p>The site has more than 100 writers who contribute in-depth reporting on 15 different causes. When people come to the site to read about a cause they're passionate about, they also have the opportunity to take action toward that cause by signing petitions. While these cumulative actions lack the drama of a protest, mobilizing a large network toward one specific action has proved a lot more effective than a hodgepodge of independent actions. </p>
17
+ <p>Change.org has partnered with thousands of non-profits, and together the community has accomplished more than <a href="http://www.change.org/petitions?order=victories" target="_blank">100 "victories,"</a> in which they've changed an unjust practice, law or policy. The organization connects activists with similar passions, and by doing so it gives them power as a cohort that they would never have as individuals.</p>
18
+ <hr>
19
+ <h2>3. Scott Harrison, Founder of Charity: Water</h2>
20
+ <hr>
21
+ <p>Charity: water uses 100% of public donations to fund water projects and is transparent about how donations are used. Both of these qualities make it somewhat of an oddball in the non-profit world -- which might be exactly what the non-profit world needs.</p>
22
+ <p>When people donate money to most organizations, they're not sure what happens to their donation or how efficiently it was used. When they give to charity: water, they can <a href="http://www.charitywater.org/projects/map/" target="_blank">look up a picture and GPS coordinates</a> of the project they contributed to. Since the organization relies on private donors for the money that makes it run, there's no doubt about whether your donation ended up paying for somebody's flight instead of funding a water project. The organization even covers its PayPal fees on donations. </p>
23
+ <p>This model of transparency and accountability has created trust and helped raise more than $20 million for 3,196 projects in the past four years. We hope that its success will influence other non-profits to do the same.</p>
24
+ <hr>
25
+ <h2>
26
+ What&acirc;&euro;&trade;s Your Pick?
27
+ </h2>
28
+ <hr>
29
+ <p>
30
+ Who were your social good champions this year? Let us know in the comments or nominate them for a Mashable Awards.</p>
31
+ <hr>
32
+ <h3>
33
+ The Mashable Awards Gala at Cirque du Soleil Zumanity (Vegas)
34
+ </h3>
35
+ <hr>
36
+ <p>In partnership with Cirque du Soleil, The Mashable Awards Gala event will bring together the winners and nominees, the Mashable community, partners, media, the marketing community, consumer electronics and technology brands and attendees from the 2011 International CES Convention to Las Vegas on Thursday, January 6, 2011. Together, we will celebrate the winners and the community of the Mashable Awards at the Cirque du Soleil Zumanity stage in the beautiful New York New York Hotel. The event will include acts and performances from our partner Cirque du Soleil Zumanity. In addition, there will be special guest presenters and appearances.</p>
37
+ <p>
38
+ <strong>Date</strong>: Thursday, January 6th, 2011 (during International CES Convention week)
39
+ <strong>Time</strong>: 7:00 &acirc;&euro;&ldquo; 10:00 p.m. PT
40
+ <strong>Location</strong>: Cirque du Soleil Zumanity, New York New York Hotel, Las Vegas
41
+ <strong>Agenda</strong>: Networking, Open Bars, Acts, Surprises and the Mashable Awards Gala presentations
42
+ <strong>Socialize</strong>: <a href="http://www.facebook.com/event.php?eid=123960060989680&amp;ref=ts" target="_blank">Facebook</a>, <a href="http://foursquare.com/venue/8822146" target="_blank">Foursquare</a>, <a href="http://www.meetup.com/mashable/22947/" target="_blank">Meetup</a>, <a href="http://plancast.com/p/27by" target="_blank">Plancast</a>, <a href="http://search.twitter.com/search?q=%23mashableawards" target="_blank">Twitter</a> (Hashtag: #MashableAwards)</p>
43
+ <p>
44
+ <strong><em>Mashable Awards Category Sponsor:</em></strong></p>
45
+ <p>
46
+ <a href="http://ycorpblog.com/"><img src="http://mashable.com/wp-content/uploads/2010/11/yahoo_logo-200x1001.jpg" alt="" title="yahoo_logo-200x100" width="200" height="100" class="alignleft size-full wp-image-442741"></a>Yahoo! is an innovative technology company that operates the largest digital media, content, and communications business in the world. Yahoo! keeps more than half a billion consumers worldwide connected to what matters to them most, and delivers powerful audience solutions to advertisers through its unique combination of Science + Art + Scale. Yahoo! is headquartered in Sunnyvale, California. For more information, visit the company&acirc;&euro;&trade;s blog, <a href="http://ycorpblog.com/" target="_blank">Yodel Anecdotal</a>.</p>
47
+ <p>
48
+ <em>Image courtesy of <a rel="nofollow" href="http://www.istockphoto.com/mashableoffer.php">iStockphoto</a>, <a rel="nofollow" href="http://www.istockphoto.com/user_view.php?id=550207">RichVintage</a></em></p>
@@ -0,0 +1,22 @@
1
+ <p><img src="http://ec.mashable.com/wp-content/uploads/2009/01/bizspark2.gif" alt="" align="left"><em>The <a href="http://mashable.com/tag/bizspark">Spark of Genius Series</a> highlights a unique feature of startups and is made possible by <a rel="nofollow" href="http://www.microsoftstartupzone.com/BizSpark/Pages/At_a_Glance.aspx?WT.mc_id=MSZ_Mashable_posts">Microsoft BizSpark</a>. If you would like to have your startup considered for inclusion, please see the details <a href="http://mashable.com/bizspark/">here</a>.</em></p>
2
+ <p>
3
+ <img src="http://mashable.com/wp-content/uploads/2010/11/networking.jpg" alt="" title="networking" width="225" height="225" class="alignright"><strong>Name:</strong> <a href="http://www.hashable.com/" target="_blank">Hashable</a></p>
4
+ <p>
5
+ <strong>Quick Pitch:</strong> Track and share all your social and professional interactions and discover who else is out there to connect with.</p>
6
+ <p>
7
+ <strong>Genius Idea:</strong> Networking is an important activity for most of us. In the age of social media, tools like <a href="http://mashable.com/category/twitter">Twitter</a> and <a href="http://mashable.com/tag/linkedin">LinkedIn</a> help us extend offline networking online, but private beta startup Hashable seeks to both simplify and better track our personal and professional interactions.</p>
8
+ <p>Hashable helps you document real-world connections with friends and professional contacts by using hashtags to describe interactions. Hashable tracks actions, connections, salutations, props and any other type of hashtag you can dream up.</p>
9
+ <p>With introductions, for instance, a Hashable user can introduce any two Twitter users or e-mail contacts using the "Make an #intro" feature. Hashable publicly (or privately) notifies both parties via Twitter or e-mail and follows up to verify a connection was made. </p>
10
+ <p>The "Post a connection" feature lets you specify a hashtag and the e-mail addresses or Twitter names of the people you have connected with offline. With this feature, you can use the system to quickly document all types of exchanges with hashtags such as #justmet, #meeting, #breakfast, #lunch, #dinner, #drinks, #coffee, #golf, #tennis, #brunch and #thanks.</p>
11
+ <p>Hashable supports Twitter and e-mail and will soon support iPhone-app connections. The service employs game mechanics to inspire user engagement, rewarding users with points in the form of "Hashcred" for making introductions and receiving connections; super users are highlighted on the "top connectors" leader boards.</p>
12
+ <p>The ultimate aim is to create a new data set around person-to-person interactions. The premise is that people already share their breakfast meetings and coffee get-togethers on Twitter, so Hashable wants to capture that information and structure the data for individual user and global insight. It's the social graph concept that Facebook is working to build around friends, but with relationships and specific interactions in focus.</p>
13
+ <p>The startup just closed a $4 million round of funding led by Union Square Ventures, giving the company a rumored $30 million valuation, according to <a href="http://mediamemo.allthingsd.com/20101122/meet-hashable-which-wants-to-make-money-by-introducing-you/" target="_blank"><em>All Things D</em></a>. That's not too shabby, considering the startup pivoted from a financial data site to focus on this idea not too long ago.</p>
14
+ <p>Hashable is currently in private beta, but the first 1,000 <em>Mashable</em> readers to follow the <a href="http://twitter.com/hashable" target="_blank">Hashable Twitter account</a> will receive invites to the site.</p>
15
+ <p>
16
+ <em>Image courtesy of Flickr, <a href="http://www.flickr.com/photos/tedxsf/" target="_blank">Tedx SF</a></em></p>
17
+ <hr>
18
+ <p><strong>Series Supported by Microsoft BizSpark</strong>
19
+ </p>
20
+ <hr>
21
+ <p>
22
+ <em>The <a href="http://mashable.com/tag/bizspark">Spark of Genius Series</a> highlights a unique feature of startups and is made possible by <a rel="nofollow" href="http://www.microsoftstartupzone.com/BizSpark/Pages/At_a_Glance.aspx?WT.mc_id=MSZ_Mashable_posts">Microsoft BizSpark</a>, a startup program that gives you three-year access to the latest Microsoft development tools, as well as connecting you to a nationwide network of investors and incubators. There are no upfront costs, so if your business is privately owned, less than three years old, and generates less than U.S.$1 million in annual revenue, you can <a href="http://mashable.com/bizspark">sign up today</a>.</em></p>
@@ -0,0 +1,3 @@
1
+ <p>U.S. citizens: If you don't have a Great Aunt Ida from which to glean family recipes, never you worry -- today's Google Doodle features a sumptuous feast and a bevy of recipes from the <em>Barefoot Contessa</em>'s Ina Garten.</p>
2
+ <p>Simply surf on over to the <a href="http://www.google.com/">Google</a> homepage today and click on the Doodle -- which depicts a tasty-looking meal -- to reveal <a href="http://www.google.com/landing/thanksgiving/#turkey">six recipes</a> from The Food Network star, including roast turkey with herb and apple stuffing, popovers and smashed sweet potatoes.</p>
3
+ <p>Google has its hands in pretty much <a href="http://mashable.com/2010/11/17/google-boutiques/">every other sector of our lives</a>, it might as well dig into dinner as well -- just not literally, because that would be gross.</p>
@@ -0,0 +1,94 @@
1
+ <?
2
+
3
+ /**
4
+ * Accepts matches array from preg_replace_callback in wpautop() or a string.
5
+ *
6
+ * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not
7
+ * converted into paragraphs or line-breaks.
8
+ *
9
+ * @since 1.2.0
10
+ *
11
+ * @param array|string $matches The array or string
12
+ * @return string The pre block without paragraph/line-break conversion.
13
+ */
14
+ function clean_pre($matches) {
15
+ if ( is_array($matches) )
16
+ $text = $matches[1] . $matches[2] . "</pre>";
17
+ else
18
+ $text = $matches;
19
+
20
+ $text = str_replace('<br />', '', $text);
21
+ $text = str_replace('<p>', "\n", $text);
22
+ $text = str_replace('</p>', '', $text);
23
+
24
+ return $text;
25
+ }
26
+
27
+ /**
28
+ * Replaces double line-breaks with paragraph elements.
29
+ *
30
+ * A group of regex replaces used to identify text formatted with newlines and
31
+ * replace double line-breaks with HTML paragraph tags. The remaining
32
+ * line-breaks after conversion become <<br />> tags, unless $br is set to '0'
33
+ * or 'false'.
34
+ *
35
+ * @since 0.71
36
+ *
37
+ * @param string $pee The text which has to be formatted.
38
+ * @param int|bool $br Optional. If set, this will convert all remaining line-breaks after paragraphing. Default true.
39
+ * @return string Text which has been converted into correct paragraph tags.
40
+ */
41
+ function wpautop($pee, $br = 1) {
42
+
43
+ if ( trim($pee) === '' )
44
+ return '';
45
+ $pee = $pee . "\n"; // just to make things a little easier, pad the end
46
+ $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
47
+ // Space things out a little
48
+ $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
49
+ $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
50
+ $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
51
+ $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
52
+ if ( strpos($pee, '<object') !== false ) {
53
+ $pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed
54
+ $pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);
55
+ }
56
+ $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
57
+ // make paragraphs, including one at the end
58
+ $pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY);
59
+ $pee = '';
60
+ foreach ( $pees as $tinkle )
61
+ $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n";
62
+ $pee = preg_replace('|<p>\s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
63
+ $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
64
+ $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
65
+ $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
66
+ $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
67
+ $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
68
+ $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
69
+ $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
70
+ if ($br) {
71
+ $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
72
+ $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
73
+ $pee = str_replace('<WPPreserveNewline />', "\n", $pee);
74
+ }
75
+ $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
76
+ $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
77
+ if (strpos($pee, '<pre') !== false)
78
+ $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
79
+ $pee = preg_replace( "|\n</p>$|", '</p>', $pee );
80
+
81
+ return $pee;
82
+ }
83
+
84
+ /**
85
+ * Newline preservation help function for wpautop
86
+ *
87
+ * @since 3.1.0
88
+ * @access private
89
+ * @param array $matches preg_replace_callback matches array
90
+ * @returns string
91
+ */
92
+ function _autop_newline_preservation_helper( $matches ) {
93
+ return str_replace("\n", "<WPPreserveNewline />", $matches[0]);
94
+ }
@@ -113,4 +113,24 @@ EOF
113
113
  Wraptext::Parser.new(doc).to_html.should == expects.strip
114
114
  end
115
115
  end
116
+
117
+ context "given Wordpress datasets" do
118
+ before :all do
119
+ @in = File.expand_path(File.join(__FILE__, "..", "..", "data", "in"))
120
+ @out = File.expand_path(File.join(__FILE__, "..", "..", "data", "out"))
121
+ end
122
+
123
+ def test_datafile(file)
124
+ data_in = File.read(file)
125
+ control = File.read(File.join(@out, File.basename(file)))
126
+ out = Wraptext::Parser.new(data_in).to_html
127
+ out.strip.gsub(/\s+/, " ").gsub(/>/, ">\n").should == control.strip.gsub(/\s+/, " ").gsub(/>/, ">\n")
128
+ end
129
+
130
+ Dir.glob( File.expand_path(File.join(__FILE__, "..", "..", "data", "in", "*")) ).each do |file|
131
+ it "should generate equivalent HTML for #{File.basename(file)}" do
132
+ test_datafile file
133
+ end
134
+ end
135
+ end
116
136
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
12
  gem.name = "wraptext"
13
13
  gem.require_paths = ["lib"]
14
- gem.version = "0.1"
14
+ gem.version = "0.1.1"
15
15
 
16
16
  gem.add_dependency('nokogiri')
17
17
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wraptext
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- version: "0.1"
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Chris Heald
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2012-01-29 00:00:00 Z
18
+ date: 2012-01-30 00:00:00 Z
18
19
  dependencies:
19
20
  - !ruby/object:Gem::Dependency
20
21
  name: nokogiri
@@ -47,6 +48,14 @@ files:
47
48
  - Rakefile
48
49
  - lib/wraptext.rb
49
50
  - lib/wraptext/parser.rb
51
+ - spec/data/convert.php
52
+ - spec/data/in/4ced9bc198db7477220005c3.txt
53
+ - spec/data/in/4ced9bf198db7477220006f1.txt
54
+ - spec/data/in/4ced9bf798db74772200070f.txt
55
+ - spec/data/out/4ced9bc198db7477220005c3.txt
56
+ - spec/data/out/4ced9bf198db7477220006f1.txt
57
+ - spec/data/out/4ced9bf798db74772200070f.txt
58
+ - spec/data/wordpress_autop.php
50
59
  - spec/spec_helper.rb
51
60
  - spec/wraptext/parser_spec.rb
52
61
  - wraptext.gemspec
@@ -84,6 +93,14 @@ signing_key:
84
93
  specification_version: 3
85
94
  summary: Wraps bare text nodes from an HTML document in <p> tags and splits text nodes on double newlines.
86
95
  test_files:
96
+ - spec/data/convert.php
97
+ - spec/data/in/4ced9bc198db7477220005c3.txt
98
+ - spec/data/in/4ced9bf198db7477220006f1.txt
99
+ - spec/data/in/4ced9bf798db74772200070f.txt
100
+ - spec/data/out/4ced9bc198db7477220005c3.txt
101
+ - spec/data/out/4ced9bf198db7477220006f1.txt
102
+ - spec/data/out/4ced9bf798db74772200070f.txt
103
+ - spec/data/wordpress_autop.php
87
104
  - spec/spec_helper.rb
88
105
  - spec/wraptext/parser_spec.rb
89
106
  has_rdoc: