On Tue, Dec 20, 2005 at 09:48:15PM +0100, Gerald Richter wrote:
> >
> > What I want to be able to do, is for Embperl to be able to
> > read in plain text files and convert them to HTML. But I
> > don't want to reinvent the wheel, since there are perfectly
> > good perl modules which have already been written to do that
> > (such as HTML::TextToHTML).
> >
>
> Unfortunately there are a few lines of C code missing to get this done. It
> was always my intention to make such a usage possible, but I didn't got
> around until now to implement the last piece :-(
Ah. Does this mean that you have now done it? (Sorry, I notice that
German-speakers tend to have problems with using the word "until"
correctly)
> So one possiblilty is that somebody writes this C code.
Ah, so you haven't done it yet.
> The other one is to create a syntax module, which uses HTML::TextToHTML for
> the actual work.
>
> To do so, just make a copy of Embperl/Syntax/Perl.pm, then in the call to
> AddInitCode you would pass some code like:
>
> q{
>
> use HTML::TextToHTML ;
>
> {
> local $/ = undef ;
> my $text = <DATA> ;
>
> my $html = HTML::TextToHTML::<whatever you want to do> ($text) ;
> print OUT $html ;
> }
>
> __DATA__
>
> }
Ah, so this would make the rest-of-the-file the __DATA__ to be read
and processed. Interesting! I'm not entirely sure whether this would
work, since HTML::TextToHTML already makes use of the DATA handle to
read in its own configuration -- I can't remember what happens with
multiple __DATA__ sections in different files.
Still, it certainly can't hurt to try.
Kathryn Andersen
--
_--_|\ | Kathryn Andersen <http://www.katspace.com>
/ \ |
\_.--.*/ | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
v |
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha! | -> Earth -> Sol -> Milky Way Galaxy -> Universe
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]