0

I have output of parsed template, is there any way i get data model extracted from parsed template based on template with placeholders?

template.html

<html>
<head>
  <title>Welcome!</title>
</head>
<body>
<h1>Welcome ${user}!</h1>
<p>Our latest product:
  <a href="${latestProduct.url}">${latestProduct.name}</a>!
</p>
</body>
</html>

parsed template

<html>
<head>
  <title>Welcome!</title>
</head>
<body>
<h1>Welcome Big Joe!</h1>
<p>Our latest product:
  <a href="products/greenmouse.html">green mouse</a>!
</p>
</body>
</html>

so is there any way to get data model for the template?

template + data model = output will give parsed template so is there something like

template - output = data model ?

1 Answer 1

0

There isn't, as it's fundamentally an one-way process. If you just have <#if someCondition>${x}<#else>${y}</#if>, which is a fairly trivial template, it's already impossible to tell if what you have in the output is the value of x or y.

1
  • Thanks for response but i have already realized that it can not be done.
    – pjsagar
    Jun 20, 2022 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.