How to pass object to partial in dot.js
<p>I am trying to pass a new created object to my dot.js partial snippet like this :</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>try {
  var tempFn = doT.template($('#myTpl').text());
  var resultText = tempFn({
    "foo": "this snippet"
  });
  $('#result').html(resultText);
} catch (e) {
  $('#error').show().html(e);
  throw e;
}</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>#error {
  font-weight: bold;
  border: 1px solid red;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/dot/1.0.3/doT.js"&gt;&lt;/script&gt;

&lt;!-- Template HERE --&gt;
&lt;script id="myTpl" type="template/doT.js"&gt;//&lt;![CDATA[
{{##def.snippet:obj:
  &lt;div&gt;How to use {{=obj.x}}&lt;/div&gt;
#}} 
{{#def.snippet:{"x":it.foo}}}
// ]]&gt;&lt;/script&gt;


&lt;div id="result"&gt;&lt;/div&gt;
&lt;div id="error" style="display: none;"&gt;&lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>But I get <code>Template has an error: SyntaxError: Unexpected token :</code>
So how can I create and pass object (or multiple params) to a defined partial ?</p>

<p>What's going wrong ?</p>

<p><strong>EDIT:</strong></p>

<p>I have a schedule structure that come from a REST webservice like that :</p>

<pre><code>"schedule": {
      "MONDAY": {
        "amOpenTime": {
          "hours": 8,
          "minutes": 30
        },
        "amCloseTime": null,
        "pmOpenTime": null,
        "pmCloseTime": {
          "hours": 17,
          "minutes": 0
        }
      },
      "TUESDAY": {
        "amOpenTime": {
          "hours": 8,
          "minutes": 31
        },
        "amCloseTime": null,
        "pmOpenTime": null,
        "pmCloseTime": {
          "hours": 17,
          "minutes": 40
        }
      },
      ....
}
</code></pre>

<p>I would to do not repeat my templating for each day because they must be processed in same way (DRY!)
So I consider using partial snippet to print each line of my schedule (morning open/close time and afternoon open/close time).
So as morning and afternoon div sould be threated in same way, I would like to create a second snippet to handle that. But for morning I need to pass only <em>am</em> prefixed data and <em>pm</em> prefixed data for afternoon like that :</p>

<pre><code>{{##def.scheduleHalfDay:fday:
// multiple condition that I ommited
&lt;div class="closed {{fday.type}}"&gt;{{fday.openTime.hours}}:{{fday.openTime.minutes}} - {{fday.closeTime.hours}}:{{fday.closeTime.minutes}}&lt;/div&gt;
#}}

{{##def.scheduleRow:hday:
{{? (typeof hday.amOpenTime === "undefined" || hday.amOpenTime === null) &amp;&amp; (typeof hday.pmCloseTime === "undefined" || hday.pmCloseTime == null) }}
&lt;div class="closed"&gt;Closed&lt;/div&gt;
{{??}}
{{#def.scheduleHalfDay:{"type": "morning", "openTime": hday.amOpenTime, "closeTime": hday.amCloseTime}}}--{{#def.scheduleHalfDay:{"type": "afternoon", "openTime": hday.pmOpenTime, "closeTime": hday.pmCloseTime}}}
{{?}}
#}}
&lt;div class="agency-schedules"&gt;
    &lt;div class="line"&gt;&lt;div class="agency-schedules-day"&gt;Monday&lt;/div&gt;{{#def.scheduleRow:it.horaires.MONDAY}}&lt;/div&gt;
    &lt;div class="line"&gt;&lt;div class="agency-schedules-day"&gt;Tuesday&lt;/div&gt;{{#def.scheduleRow:it.horaires.TUESDAY}}&lt;/div&gt;
    ...
&lt;/div&gt;
</code></pre>

<p>scheduleHalfDay are not working. So how can I pass my 3 parameters properly (without change data structure) ?</p>