<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BDN Development</title>
	<atom:link href="http://dev.bangordailynews.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.bangordailynews.com</link>
	<description>Chronicling the BDN on WordPress</description>
	<lastBuildDate>Thu, 10 May 2012 15:37:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>New Beta version of Docs to WordPress</title>
		<link>http://dev.bangordailynews.com/2012/05/10/new-beta-version-of-docs-to-wordpress/</link>
		<comments>http://dev.bangordailynews.com/2012/05/10/new-beta-version-of-docs-to-wordpress/#comments</comments>
		<pubDate>Thu, 10 May 2012 15:19:06 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=109</guid>
		<description><![CDATA[I&#8217;m working on a new version of the Docs to WordPress plugin and would love it if a few people could field test it to make sure I didn&#8217;t screw anything up. There were mostly a few simple fixes, though &#8230; <a href="http://dev.bangordailynews.com/2012/05/10/new-beta-version-of-docs-to-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a new version of the Docs to WordPress plugin and would love it if a few people could field test it to make sure I didn&#8217;t screw anything up. There were mostly a few simple fixes, though I added a new extender that allows you to use a delimiter (by default a |) in your doc to set the headline. The plugin also uses the WordPress HTTP API instead of CURL. Please check it out at <a href="http://plugins.svn.wordpress.org/docs-to-wordpress/trunk/">http://plugins.svn.wordpress.org/docs-to-wordpress/trunk/</a></p>
<p>Still to come before the next full version: Image support and (hopefully) a better way to authenticate into Google.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2012/05/10/new-beta-version-of-docs-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updates to the Docs to WordPress plugin forthcoming. What would you like to see?</title>
		<link>http://dev.bangordailynews.com/2012/05/08/updates-to-the-docs-to-wordpress-plugin-forthcoming-what-would-you-like-to-see/</link>
		<comments>http://dev.bangordailynews.com/2012/05/08/updates-to-the-docs-to-wordpress-plugin-forthcoming-what-would-you-like-to-see/#comments</comments>
		<pubDate>Tue, 08 May 2012 15:08:33 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=104</guid>
		<description><![CDATA[I will be working shortly on some upgrades to the Docs to WordPress plugin and wanted to get some input on what people would like to see in the next version. There have been a lot of great ideas floated in &#8230; <a href="http://dev.bangordailynews.com/2012/05/08/updates-to-the-docs-to-wordpress-plugin-forthcoming-what-would-you-like-to-see/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I will be working shortly on some upgrades to the <a href="http://wordpress.org/extend/plugins/docs-to-wordpress/">Docs to WordPress plugin</a> and wanted to get some input on what people would like to see in the next version. There have been a lot of great ideas floated in the comments section on previous posts but I&#8217;d like to get them all in one place, if possible. Please leave your thoughts below.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2012/05/08/updates-to-the-docs-to-wordpress-plugin-forthcoming-what-would-you-like-to-see/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Knight News Challenge</title>
		<link>http://dev.bangordailynews.com/2012/04/12/knight-news-challenge/</link>
		<comments>http://dev.bangordailynews.com/2012/04/12/knight-news-challenge/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 02:13:28 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=101</guid>
		<description><![CDATA[Just a quick shoutout: The BDN is very honored that our submission to the Knight News Challenge made it to Round 2. Our proposal is to take what we&#8217;ve done at the BDN, rewrite the code now that we have &#8230; <a href="http://dev.bangordailynews.com/2012/04/12/knight-news-challenge/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just a quick shoutout: The BDN is very honored that <a href="http://newschallenge.tumblr.com/post/19483270689/docs-to-wordpress-to-indesign">our submission to the Knight News Challenge</a> made it to Round 2. Our proposal is to take what we&#8217;ve done at the BDN, rewrite the code now that we have a better idea of what we&#8217;re doing and package it for release so that other news orgs can really easily implement what we&#8217;ve done here. If you have a second please visit the KNC website and leave your comments on the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2012/04/12/knight-news-challenge/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Getting from WordPress to InDesign, part 1</title>
		<link>http://dev.bangordailynews.com/2012/02/02/getting-from-wordpress-to-indesign-part-1/</link>
		<comments>http://dev.bangordailynews.com/2012/02/02/getting-from-wordpress-to-indesign-part-1/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 22:28:59 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=87</guid>
		<description><![CDATA[This, I know, is the code a lot of people have been waiting for. It hasn&#8217;t been posted till now mostly because I&#8217;ve been trying to package everything to make it plug-and-play. At a certain point it was time to &#8230; <a href="http://dev.bangordailynews.com/2012/02/02/getting-from-wordpress-to-indesign-part-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This, I know, is the code a lot of people have been waiting for. It hasn&#8217;t been posted till now mostly because I&#8217;ve been trying to package everything to make it plug-and-play. At a certain point it was time to give up.</p>
<p>The code isn&#8217;t hard to grasp, but it will take some modification to get it to work.</p>
<p><span id="more-87"></span></p>
<p>The code is all <a href="https://github.com/bangordailynews/WordPress-to-InDesign">on Github</a>. Essentially it reads posts from WordPress via XMLRPC and creates InDesign Tagged Text files on a local drive.</p>
<p>I&#8217;ve written XMLRPC extenders for WordPress to go with this code. <a href="https://github.com/bangordailynews/WordPress-xmlrpc-extenders">It is also on Github</a>.</p>
<p>The XMLRPC extender simply allows us to query based on a lot more options and return a very full result. The real work is in the import script, and there you&#8217;ll have to do some modifications to make it work with your InDesign styles.</p>
<p>For us, this script is running on a server on our local network that everyone here has access to. We let it run every minute by setting up this simple cron job:</p>
<p><code><br />
*/1 * * * * curl localhost/import.php<br />
</code></p>
<p>You&#8217;ll need a folder to store all the files in. By default it&#8217;s a directory called files. You&#8217;ll need to make sure that has the proper permissions to be written to.</p>
<p>By default all the stories will be saved in that folder named id.txt. We use this to programmatically pull the stories into InDesign, but that plugin isn&#8217;t released yet. You might want to consider naming the files using the story title to make it more easily human readable.</p>
<p>The templating process isn&#8217;t quite as easy as WordPress&#8217;, but if you&#8217;re familiar at all with styles and PHP you should be able to figure things out. The code is pretty well documented, I think, but if you have questions please leave them as a comment on this post and I will do my best to respond to all of them.</p>
<ul>
<li><a href="https://github.com/bangordailynews/WordPress-to-InDesign">Export WordPress posts to InDesign Tagged Text</a></li>
<li><a href="https://github.com/bangordailynews/WordPress-xmlrpc-extenders">BDN WordPress XMLRPC extenders</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2012/02/02/getting-from-wordpress-to-indesign-part-1/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Setting the head of a post using a delimiter in your doc</title>
		<link>http://dev.bangordailynews.com/2011/12/22/setting-the-head-of-a-post-using-a-delimiter-in-your-doc/</link>
		<comments>http://dev.bangordailynews.com/2011/12/22/setting-the-head-of-a-post-using-a-delimiter-in-your-doc/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 19:56:24 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=96</guid>
		<description><![CDATA[I&#8217;ve gotten a lot of requests from people using our Docs to WordPress plugin on how to set a headline that&#8217;s different from the title of your Doc, such as we do at the BDN using a pipe. This isn&#8217;t a &#8230; <a href="http://dev.bangordailynews.com/2011/12/22/setting-the-head-of-a-post-using-a-delimiter-in-your-doc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve gotten a lot of requests from people using <a href="http://dev.bangordailynews.com/2011/08/31/updated-docs-to-wordpress-plugin-now-with-better-formatting/">our Docs to WordPress plugin</a> on how to set a headline that&#8217;s different from the title of your Doc, such as <a href="http://dev.bangordailynews.com/2011/06/16/marrying-google-docs-and-wordpress-or-really-any-cms/#p[WagWdt],h[WagWdt,1,2]">we do at the BDN using a pipe</a>.</p>
<p>This isn&#8217;t a standard feature of the plugin, but the plugin does include a few filters to modify how posts are formatted. One of these filters is pre_docs_to_wp_insert, and it can be leveraged as such:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/*
Plugin Name: Extend Docs to WP like so
*/

add_filter( 'pre_docs_to_wp_insert', 'bdn_split_post' );
function bdn_split_post( $post_array = array() ) {

	$exploded_fields = explode( '|', $post_array[ 'post_content' ] );
	
	//Sometimes people forget a pipe, and we don't want to put the entire post in the headline
	if( is_array( $exploded_fields ) &amp;&amp; count( $exploded_fields ) &gt;= 2 ) {

		//Save the old title in case you want to do something with it
		$old_title = $post_array[ 'post_title' ];

		//Set the title to the first occurance.
		$post_array[ 'post_title' ] = strip_tags( $exploded_fields[ 0 ] );
		
		//Unset the title
		unset( $exploded_fields[ 0 ] );
		
		//Now restore the post content and save it
		$post_array[ 'post_content' ] = implode( '|', $exploded_fields );
		
	}

	return $post_array;

}
</pre>
<p>I haven&#8217;t tested it but the above code should do the trick.</p>
<p>Coming soon: Details on moving stories from WordPress to InDesign!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2011/12/22/setting-the-head-of-a-post-using-a-delimiter-in-your-doc/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Update to Google Docs to WordPress plugin</title>
		<link>http://dev.bangordailynews.com/2011/10/20/update-to-google-docs-to-wordpress-plugin/</link>
		<comments>http://dev.bangordailynews.com/2011/10/20/update-to-google-docs-to-wordpress-plugin/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 04:22:55 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=83</guid>
		<description><![CDATA[A few weeks ago, unbeknownst to me, Google made a (wise) change to its APIs to require SSL for all API calls. This caused parts (but not all, apparently) of the Docs to WordPress plugin to stop working. This evening I released &#8230; <a href="http://dev.bangordailynews.com/2011/10/20/update-to-google-docs-to-wordpress-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago, unbeknownst to me, Google made a (wise) change to its APIs <a href="http://googlecode.blogspot.com/2011/03/improving-security-of-google-apis-with.html">to require SSL for all API calls</a>. This caused parts (but not all, apparently) of the Docs to WordPress plugin to stop working.</p>
<p>This evening I released an update to that plugin that should resolve any problems people had. In addition, I made a small change to make bold and italics come through more consistently.</p>
<p>As always, you can download the latest version in the <a href="http://wordpress.org/extend/plugins/docs-to-wordpress/">WordPress Plugin Repository</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2011/10/20/update-to-google-docs-to-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Media management in WordPress</title>
		<link>http://dev.bangordailynews.com/2011/09/29/media-management-in-wordpress/</link>
		<comments>http://dev.bangordailynews.com/2011/09/29/media-management-in-wordpress/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 23:44:07 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=76</guid>
		<description><![CDATA[Media management is, unfortunately, one of the weaker points of WordPress. There are some exciting changes coming for 3.3, but they don&#8217;t address some of the core deficiencies, such as the inability to attach a photo to multiple posts. At &#8230; <a href="http://dev.bangordailynews.com/2011/09/29/media-management-in-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Media management is, unfortunately, one of the weaker points of WordPress. There are some <a href="http://gsoc2011.wordpress.com/2011/08/29/file-uploader-project-screencast/">exciting changes coming for 3.3</a>, but they don&#8217;t address some of the core deficiencies, such as the inability to attach a photo to multiple posts.</p>
<p><span id="more-76"></span>At the BDN, we don&#8217;t actually insert images into posts, because we bring content directly from WordPress into InDesign and putting images in posts would almost certainly cause problems. We&#8217;ve developed <a href="https://github.com/bangordailynews/BDN-image-functions">a set of functions to instead query for the images attached to posts</a> and display those. They&#8217;re, of course, <a href="https://github.com/bangordailynews/BDN-image-functions">posted to Github</a>. You can use the code as a simple plugin.</p>
<p>We&#8217;ve also customized the image edit screen a bit. As I think I&#8217;ve mentioned before, we don&#8217;t use the alt tag field, for example, nor do we use the alignment or image size fields, since we don&#8217;t insert images. We also wanted the caption field, which our functions use to display the caption info, to be a textarea instead of a textbox. All this was incredibly easy to do:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
add_filter('attachment_fields_to_edit', 'bdn_do_image_things', 20, 2);
function bdn_do_image_things( $fields, $post ) {

	//Unset the fields we don't need
	unset( $fields[ 'image_alt' ] );
	unset( $fields[ 'image-size' ] );
	unset( $fields[ 'align' ] );

	//Turn the caption field into a textarea.
	$fields['post_excerpt']['input'] = 'textarea';

	return $fields;
}
</pre>
<p>It should be noted that changing the caption field from a text box to a textarea caused a problem with double-encoding of apostrophes and straight quotes. I&#8217;ve submitted <a href="http://core.trac.wordpress.org/ticket/18798">a ticket and a patch to core</a>, and hopefully this will be fixed in 3.3.</p>
<p>But this all didn&#8217;t solve the overall problem of having to reupload a photo every time we wanted to use it on a new post, even if it was in the system. We use a lot of file photos, so there was a lot of searching for the photo in WordPress, downloading it and promptly reuploading it. That was a lot of time wasted and a lot of aggravation. So today I whipped up <a href="http://wordpress.org/extend/plugins/duplicate-images/">a quick plugin</a> to solve this.</p>
<p><a href="http://wordpress.org/extend/plugins/duplicate-images/">Duplicate Images</a> adds a link when you&#8217;re browsing the image library from a post that will copy the attachment data and attach it to the current post you&#8217;re working on. It doesn&#8217;t copy the actual image — that isn&#8217;t necessary. Instead it copies all the metadata over and links back to the original image so that things don&#8217;t get messy. If you decide to crop the image, for example, the meta data for the new post will change but not for the original post. It&#8217;s a pretty lightweight way to allow for attaching images to multiple posts within WordPress.</p>
<p>There are a few other things we do to make handling media as simple as possible in WordPress. We use Scott Bressler&#8217;s excellent <a href="http://wordpress.org/extend/plugins/media-credit/">Media Credit plugin</a> to handle credits for images. We&#8217;ve extended it a bit to automatically bring in the photographer credit when uploading images (by default, it just uses whoever uploaded the photo). The code to do that, as well as to populate the caption from the Instructions field (a field we picked at random for the publishable caption) is also <a href="https://github.com/bangordailynews/BDN-extend-Media-Credit">available on Github</a>.</p>
<p>I&#8217;m very interested to hear thoughts on how everyone else manages images.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2011/09/29/media-management-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>On killing our MySQL servers with WP-Cron (updated)</title>
		<link>http://dev.bangordailynews.com/2011/09/07/on-killing-our-mysql-servers/</link>
		<comments>http://dev.bangordailynews.com/2011/09/07/on-killing-our-mysql-servers/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 17:16:26 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=69</guid>
		<description><![CDATA[We had a fun time killing our site in an unusual manner last night and again this morning. The setup We recently changed how we handle our sports games and scores on our website. When we started out, we used &#8230; <a href="http://dev.bangordailynews.com/2011/09/07/on-killing-our-mysql-servers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We had a fun time killing our site in an unusual manner last night and again this morning.</p>
<p><span id="more-69"></span></p>
<h3>The setup</h3>
<p>We recently changed how we handle our sports games and scores on our website. When we started out, we used the <a href="http://wordpress.org/extend/plugins/pods/" target="_blank">Pods CMS Framework</a> to create some new tables to store schools, teams and games. What we found is that this added a lot of overhead to every page load, it required a lot of maintenance and the value wasn&#8217;t there, so we regrouped.</p>
<p>Now, we have a custom post type Games and custom taxonomies Schools and Sports. Each game comes in as a post with the relevant schools and sport attached. Then it becomes pretty easy to build a <a href="http://bangordailynews.com/sports/scores/">page of scores for the day</a> or <a href="http://bangordailynews.com/game/bangor-at-waterville/">display a game</a> without any extra queries or database tables. Yay custom post types.</p>
<p>We built everything as a plugin and tested it as a proof of concept. It worked pretty well so we went ahead and imported all 2,400 high school sports games scheduled this season.</p>
<h3>The trouble starts</h3>
<p>Last night, just as I was dozing off, our site crashed. After a few frantic minutes of everyone trying to figure out what was going on, our sysadmin diagnosed the problem: We were out of disc space on our master database server. He also found a 10 GB test file, which we promptly deleted, and everything came back. This morning, though, the site went down again just as I was coming into work. Again, we were out of disc space on the master db server. And so we started to try and diagnose how we used 10 GB of file space while we were all asleep and almost nothing was being posted to the website.</p>
<h3>The reveal</h3>
<p>The problem ended up being our binlogs, which are filling up at an astronomical rate. And the reason was because almost all of the 2,400 games we imported into WordPress are marked as future posts and [for each of them, the Disqus plugin] spawned a one-off WP-Cron job, which is saved in the *_options table. Each time WP-Cron runs, which is sometimes multiple times a minute for us, the array of cron jobs is actually saved back to the *_options table, and each time our master db is updated the command is written to a binlog so it will propagate to our slave databases. Each time WP-Cron runs, we were adding almost 33 KB to the bin file.</p>
<h3>The fix (see below for the real fix)</h3>
<p>Well, we don&#8217;t have a permanent one yet. First, we disabled WP-Cron in favor of true cron jobs to make sure we&#8217;re not running things more than once a minute. One option is to remove all the future posts out of cron, or to change them to a different status such as To Be Played that doesn&#8217;t trigger a cron job. I think a better solution, though, is to patch WordPress so each new post doesn&#8217;t trigger a new cron job. My proposed solution is to search for stories with a status of future and a publish date less than or equal to now. There can also be a flag set every time a post is set to have a future date and then turned off when that post is actually published so that the query doesn&#8217;t turn up nothing. This would help avoid clogging up the cron job list with one-offs and would also help avoid cases where cron fails to run correctly and future posts don&#8217;t get published.</p>
<h3>The true fix</h3>
<p>At first we thought that WordPress spawned a new cron job for every future post. The culprit actually turned out to be Disqus, which was creating a new cron job to sync the comments on thousands of posts. The simple solution: In the Disqus settings page, disable comment sync.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2011/09/07/on-killing-our-mysql-servers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Updated Docs to WordPress plugin: Now with better formatting</title>
		<link>http://dev.bangordailynews.com/2011/08/31/updated-docs-to-wordpress-plugin-now-with-better-formatting/</link>
		<comments>http://dev.bangordailynews.com/2011/08/31/updated-docs-to-wordpress-plugin-now-with-better-formatting/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 17:26:54 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=67</guid>
		<description><![CDATA[Version 0.3-beta of our Docs to WordPress plugin has been released. It&#8217;s a fairly minor release, and only affects people using the cleaner extension, but we just rolled it out internally this morning at the BDN and it&#8217;s exciting for us, &#8230; <a href="http://dev.bangordailynews.com/2011/08/31/updated-docs-to-wordpress-plugin-now-with-better-formatting/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Version 0.3-beta of our <a href="http://wordpress.org/extend/plugins/docs-to-wordpress/">Docs to WordPress plugin</a> has been released. It&#8217;s a fairly minor release, and only affects people using the cleaner extension, but we just rolled it out internally this morning at the BDN and it&#8217;s exciting for us, so I wanted to pass it on to the public.</p>
<p>The newest version of the cleaner extension passes correctly parses bold and italic text and headings, such as &lt;h4&gt;. It also strips out span tags to avoid a few instances where they would cause an extra line break.</p>
<p>In an earlier version of Docs, bold and italic text were surrounded by &lt;em&gt; and &lt;strong&gt; tags, as would be expected. It made it very easy to handle stylized text.</p>
<p>In the newest version of Docs, however, text formatting is done completely via CSS. So the header of each of the HTML versions of the Doc contains a stylesheet, where bold and italic text is given an arbitrary class name.</p>
<p>To carry that through to WordPress, I use preg_match to find the correct class name from the stylesheet and then preg_replace to convert span tags to &lt;em&gt; and &lt;strong&gt;. Thanks much to Andrew Nacin, Rob Flaherty Bill, who replied to my <a href="http://dev.bangordailynews.com/2011/08/31/appeal-for-help-because-im-terrible-at-regex/">cry for help</a>.</p>
<p>As always, the Docs to WordPress plugin can be found <a href="http://wordpress.org/extend/plugins/docs-to-wordpress/">in the WordPress Plugin Repository</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2011/08/31/updated-docs-to-wordpress-plugin-now-with-better-formatting/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Appeal for help, because I&#8217;m terrible at regex</title>
		<link>http://dev.bangordailynews.com/2011/08/31/appeal-for-help-because-im-terrible-at-regex/</link>
		<comments>http://dev.bangordailynews.com/2011/08/31/appeal-for-help-because-im-terrible-at-regex/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 14:01:15 +0000</pubDate>
		<dc:creator>William P. Davis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dev.bangordailynews.com/?p=62</guid>
		<description><![CDATA[One of the most annoying things about using Google Docs is that none of the styles are inline. It used to be that bold text was wrapped in a &#60;strong&#62; tag and italic text was wrapped in am &#60;em&#62; tag. &#8230; <a href="http://dev.bangordailynews.com/2011/08/31/appeal-for-help-because-im-terrible-at-regex/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the most annoying things about using Google Docs is that none of the styles are inline. It used to be that bold text was wrapped in a &lt;strong&gt; tag and italic text was wrapped in am &lt;em&gt; tag. No longer. Now each style of text is wrapped in a span with a number of different classes applied to it. Those styles don&#8217;t carry through when we bring the text into WordPress and the names of the classes vary from article to article. This can be very annoying for <a href="http://bangordailynews.com/2011/08/16/living/down-home-feel-is-real-during-machias-wild-blueberry-festival-annual-musical-comedy/">columnists who bold names of subjects</a>, for example.</p>
<p>So, what I&#8217;m looking for is a regex expression to turn &lt;span class=&#8221;c0 c3&#8243;&gt;My text&lt;/span&gt; into &lt;span class=&#8221;c0 c3&#8243;&gt;&lt;strong&gt;My text&lt;/strong&gt;&lt;/span&gt; where class c3 is the bold class, for example.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.bangordailynews.com/2011/08/31/appeal-for-help-because-im-terrible-at-regex/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>