IRC Transcripts in Instiki and Markdown

L

levander

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?
 
R

rking

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/syntax#precode
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?
 
L

levander

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.
 
R

rking

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/Clipboard-0.09/ (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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top