Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Monday, March 07, 2005

Convert your syntax-coloured XEmacs buffer to HTML using HTMLize

Found a great XEmacs package today called HTMLize. It takes your XEmacs buffer...



... and converts it to HTML ...



This is going to be great for putting syntax-coloured code on the web. XEmacs syntax-colours a lot of different programming languages, so no longer will I have to hunt on the web for an online (Language X) to HTML converter. Hooray!

(Tip: Set it to "font" mode instead of "css" mode, to make the output easier to paste into your blog).


require 'net/http'

class Delicious
def all_link_checksums
all_link_checksums = []
# Change "all" to "recent" for a quicker test [Jon Aquino 2005-03-07]
get('/api/posts/all').each {|line|
next if not line =~ /hash/
all_link_checksums << checksum(line)
}
all_link_checksums
end
def tags(link_checksum)
tags = []
get('/url/'+link_checksum).each {|line|
next if not line =~ /^\s*<.*delNav.*>(.*)</
tags << $1
}
tags.uniq
end

0 Comments:

Post a Comment

<< Home