Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/env perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell # $Author$ Last modified: 14 Dec 2003 15:30:18 # Suggested name: "pmnodecomp-blockquoter" - shorten if wished. # Or better yet make a symlink or alias. use strict; BEGIN { use vars qw! $plugin !; $plugin = (eval { # Place your own home-brewed filter module below. # This is only a suggestive example / default. require PMntextFilter; # import PMnTextFilter "quazzle wrench bangbar"; }) ? 'extern' : 'intern'; } use warnings; use vars qw! $DeBug $acq $outfm $rcnt $pictstr !, qw! $amps $ltgt $sqbr !; use subs qw! bbegin bendin newblk filtermeta !; $DeBug = 0; use constant rCNT => 66; # arbitrary length for output lines. format EBLK = </blockquote> . format BBLK = <blockquote> . format NBLK = <br><br> . if ($plugin eq 'extern') { $amps = sub { PMntextFilter::amps(@_) }; $ltgt = sub { PMntextFilter::ltgt(@_) }; $sqbr = sub { PMntextFilter::sqbr(@_) }; } else { $amps = sub { my $amper = '&amp;'; my $para = shift; $para =~ s% \& %$amper%oxgm; return $para; }; $ltgt = sub { my ($lt,$gt) = ( '&lt;','&gt;' ); my $para = shift; $para =~ s% \< %$lt%oxgm; $para =~ s% \> %$gt%oxgm; print STDERR "\n$acq\n" if $DeBug; return $para; }; $sqbr = sub { my ($sqbro,$sqbrc) = ( '&#91;','&#93;' ); my $para = shift; $para =~ s% \[ %$sqbro%oxgm; $para =~ s% \] %$sqbrc%oxgm; print STDERR "\n$acq\n" if $DeBug; return $para; }; } $pictstr = q[^] . q[<] x rCNT; $outfm = qq[format STDOUT = ] .qq[\n $pictstr\n] . q[$acq] . qq[\n.\n]; eval $outfm; die "Bad perl format!: $@" if $@; my $splurt = sub { local $/ = qq[]; $acq = <STDIN> }; my $pc = 0; bbegin; while (&$splurt and $pc++ < 10000) { filtermeta $acq; write while $acq; newblk unless eof(STDIN); } bendin; exit 0; sub filtermeta { # Do what you want to here. Given is a minimal default. $acq=&$amps($acq); $acq=&$ltgt($acq); $acq=&$sqbr($acq); } sub newblk { local $~ = "NBLK"; write; } sub bbegin { local $~ = "BBLK"; write; } sub bendin { local $~ = "EBLK"; write; }

In reply to Simple tool for making HTML blockquotes from text selections by Intrepid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found