For what it's worth, I think tye's post sets out a plausible road map for dealing with this issue:
- The new functionality remains inactive if the text of a post contains anything that looks like tagged markup. (This could be a conservative test, such as /\<\w+/.)
- The auto-markup process should be paragraph oriented rather than line oriented, except that indented lines should get code treatment. (Similar to POD.)
- Rather than round-trip conversions, the function be applied in one direction, at the time the message is being edited. On the preview page, if the post doesn't seem to contain any tags, show an auto-markup version on the bottom of the page, and give the user an "Auto-Markup" button that applies the markup and shows the preview again.
Am I sweeping too many details under the carpet, or might this only require a handful of lines of new code?
# In site init code somewhere
use HTML::FromText;
my %text2html_options = map ($_=>1) qw(paras blockcode urls email);
...
# In preview form command handler
if ( $op = "auto-format" ) {
$doctext = text2html( $doctext, %text2html_options );
}
...
# At bottom of preview page
if ( $doctext !~ /\<\w+/ ) {
my $markup = text2html( $doctext, %text2html_options );
if ( $doctext ne $markup ) {
print "<hr>If the automatic formatting below looks correct, you ca
+n apply it with <input type="submit" name="op" value="auto-format" />
+. <p>$markup";
}
}
...
-
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.
|