Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Underscore's <code>_.template</code> doesn't do anything to whitespace so you have to arrange the whitespace in your template to match the output you need. Something like this:</p> <pre><code>&lt;a&gt;NAME&lt;/a&gt;&lt;% if(some_condition) { %&gt; yours &lt;% } else { %&gt; &lt;a class="name" href="/kkk/&lt;%- ID %&gt;"&gt;&lt;%= NAME %&gt;&lt;/a&gt; &lt;% }%&gt; </code></pre> <p>Demo (look in your console): <a href="http://jsfiddle.net/ambiguous/gbx3M/" rel="nofollow">http://jsfiddle.net/ambiguous/gbx3M/</a></p> <p>Or the more readable:</p> <pre><code>&lt;a&gt;NAME&lt;/a&gt;&lt;% if(some_condition) { %&gt; yours &lt;% } else { %&gt; &lt;a class="name" href="/kkk/&lt;%- ID %&gt;"&gt;&lt;%= NAME %&gt;&lt;/a&gt; &lt;% } %&gt; </code></pre> <p>Demo (look in your console): <a href="http://jsfiddle.net/ambiguous/xuxLQ/" rel="nofollow">http://jsfiddle.net/ambiguous/xuxLQ/</a></p> <p>If you really need no space between the tags at all then I think you're stuck with this:</p> <pre><code>&lt;% if(some_condition) { %&gt;&lt;a&gt;NAME&lt;/a&gt;yours&lt;% } else { %&gt;&lt;a&gt;NAME&lt;a class="name" href="/kkk/&lt;%- ID %&gt;"&gt;&lt;%= NAME %&gt;&lt;/a&gt;&lt;% } %&gt; </code></pre> <p>and manually stripping off leading/trailing whitespace: <a href="http://jsfiddle.net/ambiguous/LN7eU/" rel="nofollow">http://jsfiddle.net/ambiguous/LN7eU/</a></p> <p>Another option is to use CSS to float and position the elements so that the whitespace becomes irrelevant.</p> <p>If none of those options are good enough then Underscore's (intentionally) simple and minimal templates might not be for you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload