javascript - Escape variable name with Mustache.js -


i have csv file i'm parsing json , sending mustache.js. problem of variable names not formed, end objects may this:

{     'num.': '1234',     'pass-through': 'yes' } 

so how use variables in mustache template? i've tried couple of different approaches.

<td>{{ num. }}</td> <td>{{ 'num.' }}</td> <td>{{ ['num.'] }}</td> 

but none of them work (i'd more surprised if did), , can't find in documentation on how escape variable name.

manual

overview: | interpolation tags used integrate dynamic content template.

the tag's content must non-whitespace character sequence not containing current closing delimiter.

this tag's content names data replace tag. single period (.) indicates item sitting atop context stack should used; otherwise, name resolution follows:

  1. split name on periods; first part name resolve, remaining parts should retained.
  2. walk context stack top bottom, finding first context a) hash containing name key or b) object responding method given name.
  3. if context hash, data value associated name.
  4. if context object, data value returned method given name.
  5. if name parts retained in step 1, each should resolved against context stack containing result former resolution. if part fails resolution, result should considered falsey, , should interpolate empty string.

data should coerced string (and escaped, if appropriate) before interpolation.

in short : can't have element name 'num.'.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -