[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

IRC Transcripts in Instiki and Markdown

Levander Thomas

6/23/2007 5:16:00 PM

I haven't found a way to easily markup IRC transcripts in Markdown on
my Instiki install yet. Hopefully this isn't a reason to go through
all my wiki pages and switch to Textile.

For an IRC transcript like this:

<johnsu01> M P r marks all the articles in the region with #
<johnsu01> M-& makes the next command apply to all marked articles
<johnsu01> M-U removes all marks (like the read mark)
<johnsu01> in gnus you can mark articles with # when you want commands
to
apply to more than one article
<johnsu01> the mark will disappear after the command is executed

The best markup I've found is to simple wrap the text in <pre>, </pre>
tags. However, the usernames between the <, >'s always disappear when
rendered in HTML. Is the only way to get the usernames not to
disappear is in HTML is to replace the <, >'s with &lt;, &gt;'s? Can
I get Markdown do that for me?

3 Answers

rking

6/23/2007 7:38:00 PM

0

On Jun 23, 10:15 am, levander <levander...@gmail.com> wrote:
> Is the only way to get the usernames not to disappear is in HTML is to replace the <, >'s with &lt;, &gt;'s?

You definitely need to escape them one way or another.

If you want to do it all in ruby, this will do it:
require 'cgi'
CGI::escapeHTML(irc_log)

> Can I get Markdown do that for me?

According to http://daringfireball.net/projects/markdown/synt...
you can start each line with a tab to get both <pre> text and HTML
escaping. From ruby do irc_log.gsub(/^/,"\t")

Does either solution work for you?

Levander Thomas

6/23/2007 10:27:00 PM

0

Thanks rking. Indenting every line 4 space in the IRC transcript did
work. Guess I just didn't want to do it that way because I wanted to
be able to copy and paste the whole transcript in without any
formatting.

Guess I'll just have to use a fully-featured text editor to indent it,
then copy and paste it into instiki from there.

rking

6/24/2007 1:28:00 AM

0

On Jun 23, 3:27 pm, levander <levander...@gmail.com> wrote:
> Thanks rking. Indenting every line 4 space in the IRC transcript did
> work. Guess I just didn't want to do it that way because I wanted to
> be able to copy and paste the whole transcript in without any
> formatting.
>
> Guess I'll just have to use a fully-featured text editor to indent it,
> then copy and paste it into instiki from there.

Not to plug my own war3z, but it was exactly things like that that
moved me to write `clipfilter`, which is distributed with Clipboard.pm
(which I vaguely intend on rubifying). Available at:
http://search.cpan.org/~king/Clipb... (it should work using
native calls in Windows and OSX, and use the `xclip` program under
Unices)

If you create a script like this:
#!/bin/sh
ruby -pe 'sub(/^/, " "*4)'

and put it in $PATH with a name of, say, 4spaces, you can then run:

clipfilter 4spaces

This will pipe the current clipboard contents to the listed program
and then take the output to be the new clipboard contents.

You might want to speed the access to this, such as an alias (like
"c4"), bind it to a keyboard shortcut, or maybe make a launcher/icon
thing.