title: Is it possible to use a Jinja2 template to reverse engineer the parameters from a document?
body: <p>The general workflow of Jinja2 is <strong>params + Jinja2 template = generated document</strong>.</p>
  
  <pre><code>from jinja2 import Template
  t = Template("Hello {{ something }}!")
  t.render(something="World")
  &gt;&gt;&gt; u'Hello World!'
  </code></pre>
  
  <p>Is it possible to use a Jinja2 template to reverse engineer the parameters from a document? In other words I am looking for the following : <strong>Jinja2 template + generated document = params</strong>.</p>
  
  <pre><code>from jinja2 import Template
  t = Template("Hello {{ something }}!")
  t.reverse("Hello World!")
  &gt;&gt;&gt; {"something" : "World"}
  </code></pre>
  
  <p>The json output is not a requirement, but it would be handy. </p>
  
  <p>If not what is a good approach to create logic like this?</p>
  
  <p>Context:
  <em>I use Jinja2 to generate Cisco Switch configuration files, and it would be a nice feature to be able to pull up documents generated in the past, and instead of showing the 1000+ line config scripts, I would like to list just the parameters. I know it can be solved by storing all params in a simple DB, but currently i don't have a DB set up, and I would avoid it, if possible.</em></p>