On Tue, Aug 28, 2007 at 04:52:26PM +0100, [EMAIL PROTECTED] wrote:
> Tim Bunce wrote:
> > I was hoping that it would output an html file. One that would include the
> > TiddlyWiki code.
> >
> > If you'd rather not add a 272KB file to your distribution (which I'd
> > fully understand) then perhaps the best approach would be a separate
> > distribution containing a Pod::Simple::Wiki::TiddlywikiHTML module.
> > That would subclass Pod::Simple::Wiki::Tiddlywiki and add the
> > TiddlyWiki code.
> >
> Hi,
>
> Maybe converting to a tiddler for importing into the TiddlyWiki might be
> a better approach, see below. I may add it as an additional pod2wiki
> commandline option combined with some documentation.
>
> I browsed the TiddlyWiki Google group and saw that the TiddlyWiki app
> expects to import another TiddlyWiki html file.
> From that I created a quick and dirty filter to convert from the wiki
> text format to a self contained Tiddler, see below.
That's a useful step forward but imports the entire pod as a single tiddler,
which kind'a missing the whole point, and power, of TiddlyWiki.
I've appended a modified version that puts each part into a diffeent tiddler.
That's much better, but it's still lacking a table of contents and the
ability to drill-down into sections of interest. (That needs each
section to end with a kind of mini-ToC listing any subsections).
But it has helped clarify what's needed and, while it's not hard,
it is non-trivial.
I'll work on a patch sometime.
Thanks John.
Tim.
#!/usr/bin/perl -w
use strict;
use HTML::Entities;
use Getopt::Long;
my $author = 'pod2wiki';
GetOptions('author|a=s' => \$author);
my ($sec,$min,$hour,$mday,$mon,$year) = localtime();
my $date = sprintf "%d%02d%02d%02d%02d", 1900 + $year, $mon + 1, $mday, $hour,
$min;
print qq{<div id="storeArea">\n};
my $in_tiddler;
while (<>) {
if (m/^(!+)(.*)/) {
print "</div>\n" if $in_tiddler;
my ($level, $title) = ($1, $2);
$title =~ s/(?: {{{ | }}} )//xg;
$title = encode_entities($title);
print qq{<div title="$title" modifier="$author" created="$date"
tags="">\n};
print qq{<pre>\n\n};
$in_tiddler = $title;
next;
}
print encode_entities($_);
}
print "</pre></div>\n" if $in_tiddler;
print qq{</div>\n};
__END__