<?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>Sérgio's blog &#187; Wordpress</title>
	<atom:link href="http://www.smachado.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.smachado.com</link>
	<description>About computers, software, gadgets, programming and more....</description>
	<lastBuildDate>Sun, 16 May 2010 20:40:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WP-Syntax tryout</title>
		<link>http://www.smachado.com/2009/05/wp-syntax-tryout/</link>
		<comments>http://www.smachado.com/2009/05/wp-syntax-tryout/#comments</comments>
		<pubDate>Sun, 31 May 2009 18:50:35 +0000</pubDate>
		<dc:creator>smachado</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.smachado.com/?p=68</guid>
		<description><![CDATA[Following last post on WordPress Code Snippet plugin this post will be the tryout of WP-Syntax &#8211; a code format plugin that uses GeSHi supporting a wide range of languages. That includes Perl, one of the languages I frequently use.
Unfortunately there&#8217;s no interface to easily add a code snippet. It is necessary to change to [...]]]></description>
			<content:encoded><![CDATA[<p>Following last post on WordPress Code Snippet plugin this post will be the tryout of <a href="http://wordpress.org/extend/plugins/wp-syntax/" target="_blank" title="WP-Syntax">WP-Syntax</a> &#8211; a code format plugin that uses <a title="GeSHi" href="http://qbnz.com/highlighter/" target="_blank">GeSHi</a> supporting a wide range of languages. That includes Perl, one of the languages I frequently use.</p>
<p>Unfortunately there&#8217;s no interface to easily add a code snippet. It is necessary to change to post HTML view and add HTML pre tags with attributes lang and line.</p>
<p>Below you can see how does a Perl piece of code looks like. Unfortunately when I change from HTML back to Visual the attribute line=&#8221;1&#8243; is removed by WordPress.<br />
Another problem are some characters that need be replaced by HTML entities for example less than and greater than characters. I had to manually check if the code was correctly copied and fix some of the lines.<br />
On the positive side, this plugin allows you to have many snippet blocks within the text.</p>
<pre lang="perl" line="1">
#!/usr/bin/perl -w

use MP3::Info;
use MP4::Info;
use strict;
use Getopt::Long;
use Encode qw(from_to);
use bytes;

###############
sub process {
###############
    my ($src) = shift;

    $src .= "/" if $src !~ /\/$/;
    print "Opening $src\n";
    opendir(my $dir, $src) or die "can't opendir $src: $!";
    while( defined(my $file = readdir($dir))) {
        next if $file =~ /^\.\.?$/;
        my $fileabs = "$src$file";
        if ( -d $fileabs ) {
            process( $fileabs );
            next;
        }
        next if $file !~ /mp3$|m4a$|mp4$/;
        my $func=\&amp;get_mp3tag;
        if ( $file =~/m4a$|mp4$/ ) {
           $func=\&amp;get_mp4tag;
        }
         my $tag = $func-&gt;($fileabs) or die "No tag info";
         print "File $file|$tag-&gt;{ARTIST}|$tag-&gt;{ALBUM}|$tag-&gt;{TITLE}\n";
         my ($artist,$album,$title) = ($tag-&gt;{ARTIST},$tag-&gt;{ALBUM},$tag-&gt;{TITLE});
         #foreach my $k ( keys %$tag ) {
         #    print "$k: $tag-&gt;{$k}\n";
         #}
         if ( $artist =~ // || $title =~ // ) {
            print "SKIPPING\n";
            next;
         }
         my ($ext) = $file =~ /\.([^\.]+)$/;
         my $newname = "$artist - $title.$ext";
         #if ( $album !~ // ) {
         #   $newname = "$artist - $album - $title.$ext";
         #}
         $newname =~ s/\*|\\|\///g;
         $newname =~ s/ /_/g;
         $newname =~ s/&amp;/n/g;
         $newname = $src . $newname;
         print "$newname\n";
         #from_to($newname, "utf-8", "cp1250");
         #print "$newname\n";
         #from_to($fileabs, "utf-8", "cp1250");
         rename( $fileabs, $newname ) or warn("Unable to rename $fileabs to $newname: $!\n");
    }
    closedir($dir);
}

my $usage = &lt;&lt;END
        Usage: $0 --src=&lt;source-directory&gt;

END
;

die($usage) if @ARGV != 1;

my $src;
GetOptions (
	"src=s" =&gt; \$src,
);

if ( ! -d $src ) {
    die($usage);
}

process( $src );</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.smachado.com/2009/05/wp-syntax-tryout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress Code Snippet plugin tryout</title>
		<link>http://www.smachado.com/2009/05/wordpress-code-snippet-plugin-tryout/</link>
		<comments>http://www.smachado.com/2009/05/wordpress-code-snippet-plugin-tryout/#comments</comments>
		<pubDate>Sun, 31 May 2009 18:12:52 +0000</pubDate>
		<dc:creator>smachado</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.smachado.com/?p=63</guid>
		<description><![CDATA[Code displayed on web pages need formatting to ease reading. This post is my tryout of WordPress Code Snippet plugin.
After installation the plugin adds a code snippet box at the bottom of the Add/Edit post window and a drop down box with languages. You can select one from the following languages: HTML/XML, CSS, Javascript, PHP, [...]]]></description>
			<content:encoded><![CDATA[<p>Code displayed on web pages need formatting to ease reading. This post is my tryout of <a title="WordPress Code Snippet" href="http://www.allancollins.net/wordpress-code-snippet/" target="_blank">WordPress Code Snippet</a> plugin.</p>
<p>After installation the plugin adds a code snippet box at the bottom of the Add/Edit post window and a drop down box with languages. You can select one from the following languages: HTML/XML, CSS, Javascript, PHP, SQL, C#, VB, C++, Java, Python, Ruby, Delphi.</p>
<p>I copy pasted some ancient C++ code and the formatting is really nice and has great syntax hightlighting.</p>
<p>The only problem seems to be that you can only have one snippet per post and not within text.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.smachado.com/2009/05/wordpress-code-snippet-plugin-tryout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
