Archive for February, 2007

some more testing of a script that will do the code formatting

February 28, 2007

I have hacked a script which converts the selected text in Ecto to the following formatted text.

while (<>) {
$text .= $_;
}
# procedural usage
my $html = textile($text);
#print $html; <—- this would get printed in a dialog box
open ( FILE, “>$entryfile” ) or die;
print FILE $html;
close FILE;
[Update: If you look carefully, syntax highliting done by the [...]

Automatic hyperlinking to wikipedia and others using ecto scripting

February 28, 2007

Ecto is a feature-rich desktop blogging client for Mac OS X and Windows, supporting a wide range of weblog systems, such as Drupal. It allows me to plug-in my own scripts writing in programming languages such as ruby, perl, Bash and i suppose python also.

This feature allows for some nifty stuff such as filtering the [...]

where can one comment on ecto

February 28, 2007

Now that i have begun to write some scripts for ecto, i would like to start sharing them on the ecto site. But i cant find any place on the ecto site to leave a comment. Could someone help me by giving me a link.

Publishing code on this blog through Ecto

February 28, 2007

Background: All attempts to publish some simple source code on this blog failed. Be it directly on WP or through Ecto. PRE and CODE tags made no difference. How many tags I might have to manually change, i do not know. But < and \ we certainly disappearing !
And so now, I run the [...]

ecto and Markdown

February 28, 2007

#!/usr/bin/env ruby
# Markdown’ise things.
# Take Markdown markup on STDIN, and output HTML to STDOUT
require ‘rubygems’
require ‘bluecloth’
#print (BlueCloth.new STDIN.read).to_html
file = ARGV[0];
text = File.open(file,”r”).readlines.join;
html = (BlueCloth.new text).to_html
File.open(file, “w”).puts html;

I must first admit that since ecto supports a WYSIWYG editor therefore a script that does textile or markdown filtering does not make much sense. Also, there is the [...]

ecto script: inter.rb

February 28, 2007

To learn how to do hyperlinking with inter.rb see this.

#!/usr/bin/env ruby
file = ARGV[0];
text = File.open(file,”r”).readlines.join;
urlmap = {“w” => “http://en.wikipedia.org/wiki/%s”,
“g” => “http://google.com/search?q=%s”,
“dict” => “http://m-w.com/dictionary/%s”,
“http” => “http:%s”,
“th” => “http://thesaurus.reference.com/search?q=%s”
}
text.gsub!(/\[\[(\w+?):(.+?)\]\]/) { |match|
path=urlmap[$1]
if path == nil then
puts “%s not found in urlmap” % $1
match
else
str = $2.split(‘|’)
if str.size == 1 then
str %s’) % [str[0], str[1]]
end
}
#puts text
File.open(file, “w”).puts text;

Source of inter.rb [...]

testing ecto scripts – ruby, perl and bash

February 28, 2007

Today, i decided to be a little geeky. decided to play a little with ecto’s scripting abilities . Or rather its ability to plug in existing scripts. I do have scripts that textile-ize a file or STDIN and return the output to STDOUT. The first thing is that sadly one cannot run bash or [...]

The Northern Lights

February 28, 2007

After a long break from life (read: the illusion called life), I have opened Phillip Pullman’s The Northern Lights. This is the first of the Dark Materials trilogy and promises to be a fun and interesting read, like the second and third parts.

Vim and Ruby

February 28, 2007

Have been doing some work of late using my favorite editor VIM. A life-changing article or series of tips is this page. Using Vim with and a programming language like Ruby, makes a very powerful combination.
So I do part of my work in Vim itself, using its powerful regular expressions and other features. Once [...]

The Illusion called Life

February 27, 2007

At night we dream. The mind shows us a world. We believe we are seeing with our eyes and hearing with our ears, and that the world that we see is real and logical.
Then we wake up and declare that what we saw was false, and that this now is real. We argue that what [...]