WP-Text-Hatena 0.01 Released!

December 23th, 2008

Download: WP-Text-Hatena 0.01

This plugin allows you to write post in Hatena Formatting Style.

It uses mayokara's Text_Hatena.php, which is a port to PHP of original Perl extension Text::Hatena written by Junya Kondo.

example:

[http://5ivestar.org/blog/:title=link]

-list item
-list item
-list item

|*header|*header|
|cell|cell|
|cell|cell|

This is formatted into:

link

  • list item
  • list item
  • list item
header header
cell cell
cell cell

In addtion, it supports code highlighting using GeSHi.

>|ruby|
require 'matrix'
 
def fib(n)
  m = Matrix[[1,1], [1,0]]
  (m ** n)[0,1]
end

puts fib(100)
||<

is displayed like this:

require 'matrix'
 
def fib(n)
  m = Matrix[[1,1], [1,0]]
  (m ** n)[0,1]
end

puts fib(100)

plugin source:

<?php
/*
Plugin Name: WP-Text-Hatena
Plugin URI: http://5ivestar.org/blog/2008/12/wp-text-hatena-001-released/
Description: Allows you to write post with <a href="http://search.cpan.org/~jkondo/Text-Hatena-0.20/lib/Text/Hatena.pm#Text::Hatena_Syntax">Hatena Formatting Style</a>
Author: Fuse Yasuhiro
Version: 0.0.1
Author URI: http://5ivestar.org/
*/

include_once("Text_Hatena.php");

function wp_text_hatena($content) {
	$parser = new Text_Hatena();
	return $parser->parse($content);
}

remove_filter('the_content', 'wptexturize');
remove_filter('the_content', 'wpautop');
add_filter('the_content', 'wp_text_hatena', 6);

?>

I cut corrners, so it may well have some problems.

No comments

Leave a Reply

コメントを投稿する場合は下記の認証サービスのいずれかを経由してログインして下さい。

但し、認証を行うにはそのサービスのアカウントが必要です。