DOAJ Export WordPress Plugin

Today I converted Eric Lease Morgan‘s c4lj2doaj.cgi into a WordPress plugin.

What is the DOAJ?

The Directory of Open Access Journals is an avenue for readers to discover and access the contents of thousands of open access journals (i.e., journals that don’t charge for access to the full text of their articles).

Publishers of said journals can provide article-level data to the DOAJ, opening those articles up to discovery through the DOAJ interface. One can provide this data to the DOAJ through a form (entering the title, authors, abstract, keywords, etc., for each article, one at a time) or by uploading data that conforms to the DOAJ acticle XML schema.

Enter the DOAJ Export plugin

Eric built a Perl module to grab the necessary info from the Code4Lib Journal‘s database and present it in this format. This functionality seemed to belong in a WordPress plugin, so I set out to convert Eric’s script into the plugin before you today.

Since this is just presenting the data for each issue in yet another XML format, similar to all the feeds WordPress already creates, I thought it appropriate to make the data accessible as another feed, using the add_feed function I’ve mentioned before.

By going to an issue of the journal and appending /feed/doaj to the URL, you’ll get the contents of that issue in the DOAJ XML format. E.g., http://journal.code4lib.org/issues/issue4/feed/doaj for the latest issue.

You can download the DOAJ Export plugin from the WordPress Plugin Directory.

Issue Manager WordPress Plugin

Since we started the Code4Lib Journal, we’ve had a persistent problem of editors accidentally publishing articles early (i.e., before the issue was officially published). Our first workaround for that was to remove the ‘publish_posts’ capability from the editor role. With that capability removed, only the administrator (i.e., me) could publish articles.

That worked, but it was a hassle, as it required me to do what should have been the coordinating editor’s job of publishing each article when it came time to publish a new issue. For that matter, even if permissions weren’t an issue, the publication process would still be cumbersome: open every article in the issue, change its status to “Published”, and save it, doing them all as fast as you can so people didn’t find a half-published issue when they came to the website.

It was to fix these and other problems that I created the Issue Manager WordPress plugin. It connects the publication status of an article to the category it’s in. You can designate a category as “Unpublished”, so that no articles in that category can be published. If you try to publish an article, it’s status changes to “Pending Review”. When it’s time to publish an issue, you change its category’s status to “Published”, which publishes all the “Pending Review” articles in that category. Continue reading “Issue Manager WordPress Plugin”

The Code4Lib Journal, Issue 2

The Code4Lib Journal published its second issue today. Much thanks to all the editors and authors, especially Eric Lease Morgan, coordinating editor this time around.

It’s been exciting, these last few months, watching the Journal really get going. We’ve had a large number of impressive submissions for this and future issues, a good amount of word-of-mouth advertising, and nearly 15,000 visitors to the site since the launch of the first issue.

I still haven’t gotten around to blogging about many of the hacks we’ve made to WordPress to make all this happened, nor have I created all the plugins that I need to create to ease our workflow and enhance our presentation. Eventually…

Save My <pre> WordPress Plugin, or, WTF-8 My Whitespace

If you’ve tried to use code samples in WordPress, you might have noticed unexpected behavior from the WYSIWYG editor. It will edit the whitespace inside of <pre> tags, leaving you with some poorly formatted, hard-to-read code. Today, I set out to stop that.

What causes this?

Whenever the WYSIWYG editor opens, it sends the content of the post through a few filters. You can find most of these in wp-includes/formatting.php. The culprit here is the function wpautop. This function runs a long list of regular expressions to make your content a little prettier and better formatted. But we don’t want that to happen to our <pre> tags; they’re pre-formatted. We want those left alone. To do that, I had to find a way to keep the content of the <pre> element from going through that filter.

WordPress’s plugin system allows you to change its behavior without altering the core code, so you don’t have to re-alter it every time you upgrade. As easy as it would have been, in the short-term, to just edit wpautop to make it behave properly, I wanted a longer-term solution that would be easier to share with other WordPress users. Therefore, a plugin. Continue reading “Save My <pre> WordPress Plugin, or, WTF-8 My Whitespace”

Announcing the Code4Lib Journal, Issue 1

The Code4Lib Journal released its first issue today. There’s articles on a variety of topics: catalogs, LCSH, digital repositories…. Much praise is due to Jonathan Rochkind, the other members of the editorial committee, the authors, and everyone who offered their input over the last eight months that we’ve been putting this together.

For this first issue, I’ve been playing the role of web developer for the Journal. We’re using WordPress as our CMS, with a custom template and a few hacks/plugins to make everything run smoothly. As time permits, I’ll try to blog about some of the work we did to make the website happen.