MEH-Design / frix

A CMS based on atomic design principles.
MIT License
2 stars 1 forks source link

loops without name not possible #58

Open MiniXC opened 7 years ago

MiniXC commented 7 years ago

Loops should also be allowed to be without name when the only element of a module.

Example (comments == old syntax that could be ommited)

<div>
  <loop <!--name="items"--> types="sometype">
    <target/>
  </loop>
</div>
"someelement": //{
      /*"items":*/ [
        {
          "type": "sometype",
          "data": {
            //...
          }
        },
        {
          "type": "sometype",
          "data": {
            //...
          }
        }
      ]
    //}
MiniXC commented 7 years ago

I get the following error message when trying to use the array syntax:

TypeError: Cannot read property 'length' of undefined
    at Object.$.each (D:\node\dialogus\node_modules\frix\lib\html-creator.js:73:35)
    at exports.each (D:\node\dialogus\node_modules\cheerio\lib\api\traversing.js:300:24)
    at HTMLCreator.resolveElements (D:\node\dialogus\node_modules\frix\lib\html-creator.js:70:15)
    at promises.push.access.readElement.then (D:\node\dialogus\node_modules\frix\lib\html-creator.js:121:23)
    at tryCallOne (D:\node\dialogus\node_modules\promise\lib\core.js:37:12)
    at D:\node\dialogus\node_modules\promise\lib\core.js:123:15
    at flush (D:\node\dialogus\node_modules\asap\raw.js:50:29)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)