Though it doesn't appear to do all you want, http://search.cpan.org/~bpostle/MKDoc-Text-Structured-0.83/lib/MKDoc/Text/Structured.pm may provide a start. OTOH, a search for " text<" produced at least 8 pages of results, including the likes of http://search.cpan.org/~danberr/Text-Smart-1.0.2/lib/Text/Smart/HTML.pm.
Alternately, does this render as you wish?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:/
+/www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Blazar's Intent?</title>
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
.text {
width: 100em;
max-width: 100em;
color: black;
background-color: white;
}
.textshorter {
width: 80em;
max-width: 80em;
}
#art {
color: green;
background-color: white;
}
.table {
margin-left: 5em;
border: medium solid black;
font-style: italic;
width: 16em;
max-width: 40em;
}
-->
</style>
</head>
<body>
<p class="text">
Now is the time to convert this very long ascii text to html without c
+ontinuation lines. Note that this works only within whatever you defi
+ne as "reasonable" bounds for screen width or accept possibly-unaccep
+table horizontal scrolling in the enduser's browser.
</p>
<p class="textshorter">
This is enclosed by a <div class="textshorter> Now is the time t
+o convert this very long ascii text to html without continuation line
+s. Note that this works only within whatever you define as "reasonabl
+e" bounds for screen width or accept possibly-unacceptable horizontal
+ scrolling in the enduser's browser.
</p>
<p class="textshorter">
Next comes some ascii art:
</p>
<pre id="art">
*
^
/ \
*/ \
/ \*
/ \
*----|----
|
</pre>
<pre class="text">
And a table (less the inter-cell borders):
</pre>
<pre class="table">
Foo Bar Blivitz
1 0 1
0 1 0
379 4 2816
</pre>
</body>
</html>
If so, even though this ignores many edge cases and non-trivial issues, but it seems to me that writing a module to do (more or less) what this does would be unnecessary if your project can tolerate a requirement for some minimal markup or if one applies some fairly straightforward heuristics to templating the original text.
-
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.
|