My code is executing but the html tags get lost #348
Answered
by
welpdx
radha1990kumari
asked this question in
Help
-
<center> <h1>Lab Assignment
<%*
let re = new RegExp('Lab-(\\d+)_.*');
var myString = tp.file.title;
var match = re.exec(myString);
var an="0"
if(match!=null)
an=match[1]
tR=an
%>
</h1>
</center> |
Beta Was this translation helpful? Give feedback.
Answered by
welpdx
Sep 9, 2021
Replies: 1 comment 2 replies
-
That is because So, what you want to do is instead is to replace the line Hope that helps, |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
radha1990kumari
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That is because
tR
is the output of the script.When you directly assign
an
totR
, the resulting output is onlyan
and nothing else. It seemed like you lost your html tags, but what actually happened is you basically told the script to output onlyan
when you didtR=an
. You would lose any text before and after any script if you usedtR=an
anywhere in a Templater script.So, what you want to do is instead is to replace the line
tR=an
withtR+=an
. This wayan
is inserted between the text you added before and after.Hope that helps,
Welp