I'm trying out TT, and I've run into a problem. I have a variable called script which, if present, will cause a javascript section to be added to my HTML output. I've really got two problems, but one is more severe than the other.

In this particular javascript, I have a couple REs that test user data, but when it gets processed

var reg1 = /^\d{4}$/; morphs into var reg1 = /^d{4}/;

I tried backslashing the characters that get removed, but those get removed. This is my first stab at TT, so I may be doing bad things. I do need the script variable to be parsed because I have some possible runtime configurations that change in the javascript. But that also brings up my other problem. When I specify that I want to test $script_var.value, I mean that I want $script_var to be replaced with the real value of the variable and when the javascript is run, it will test user_name.value. Instead, the process engine complains that it doesn't know what to do with $script_var.value. Is there a way for me to signify to the parser that I want $script_var placed there so that it still reads user_name.value once it's processed?

ALL HAIL BRAK!!!


In reply to Template Toolkit parses out my backslash by PsychoSpunk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.