Archive for the 'ecto' Category

ecto script: inter.rb

March 2, 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;

Ecto script: ABBR

March 1, 2007

Now I know, Mr Shinckel has already posted a python script to do some word replacements. And I don’t claim this is much of a help because ecto already provides spell-checking. But just in case you like using your own short forms for things, you could use this. It uses a dictionary file that [...]

Ecto script: URLIZE

March 1, 2007

Apart from the confusingly similar name, the only other difference in URLIZE and URLIFY is this that URLIZE does not require any tags in your post. It searches and replaces all keys with the corresponding value in the URL hash. It does this for only the first match, so that each occurrence of the word [...]

Ecto: URLIFY script

March 1, 2007

I have made two varieties of a script that will make hyperlinks from a favorites list.
The first uses the form of square brackets as in the following paragraph. Notice that I can use both [ruby] and [ruby|Ruby].
In the first case, “ruby” will be displayed; in the second case, “Ruby” will be displayed. In both [...]

Pretty Print Code script (hack)

March 1, 2007

The hack presented below has been developed on a MAC OS X. It uses the TOhtml function of the Vim Editor (i use Version 7.0). It runs in HTML Mode only.

f=$1vim -f +”syn on” +”run! syntax/2html.vim” +”wq” +”q” $f

sed -n ‘/<pre>/,/<\\/pre>/p’ $f.html | sed ’s~<pre>~<pre style=”margin: 1.5em 0px; padding: 10px 10px 10px 10px; [...]

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 [...]