On Apr 16, 3:03*am, Scott Bryce <sbr...@scottbryce.comwrote:
Quote:
Dr J R Stockton wrote:
>
Quote:
One could easily be written, e.g. by yourself. *A TEXTAREA for input,
a BUTTON, a TEXTAREA for output, and a series of RegExps, acting on
the content of the first area and writing to the second.
>
If you are going to go that route, write it in Perl and take advantage
of the HTML::Entities module. No need to write all those regexen.
Then do it yourself <g.
IMHO, it's much easier to do it in JavaScript, the natural language
for the OP's request of a "site", than it would be to learn Perl. And
it turns out that there's no need to write RegExps as such, if one
provides an input area for the user to define the conversions.
The following includes self-test :
<form class=TRY action="#">
<textarea name=T0 cols=69 rows=4>
Replace first field by second field
¿ &#191; Comment follows second TAB
q Q Paste new content into this box
</textarea>
<textarea name=T1 cols=69 rows=4>
Text input
¿que?</textarea>
<br><input type=button value="->" onClick="TextConv(this.form)"><br>
<textarea name=T2 cols=69 rows=4></textarea>
</form>
function TextConv(F) { var St, XX, J
XX = F.T0.value.split(/[\r\n]+/)
St = F.T1.value
for (J=0 ; J<XX.length ; J++) {
XX[J] = XX[J].split("\t")
if (XX[J].length==1) XX[J][1] = ""
XX[J][0] = new RegExp(XX[J][0], "g") }
for (J=0 ; J<XX.length ; J++) St = St.replace(XX[J][0], XX[J][1])
F.T2.value = St }
I did it in my js-misc1.htm#TS; but I'll not be leaving it there if
signs of excessive use appear - take a COPY. RSVP if bugs are found;
tested in IE7 FF2 Op9 Sf3. FF2 has a mini-bug : the testareas appear
to be 5 rows.
BTW, my newsreader did in fact show the accented í, about one pixel
different from a normal one at normal size, but good at 20 pt.
--
(c) John Stockton, near London, UK. Posting with Google.
Mail: J.R.""""""""@physics.org or (better) via Home Page at
Web: <URL:http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ...