Skip to content

Commit

Permalink
fix: The Abe tags not included in html attributes part of a {{#each s…
Browse files Browse the repository at this point in the history
…tatement where not modifiable on the frontend anymore
  • Loading branch information
gregorybesson committed Dec 17, 2016
1 parent e264029 commit 4d02252
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/cli/cms/templates/prepare.js
Expand Up @@ -17,8 +17,18 @@ import {
*/
export function addAbeDataAttrForHtmlTag(template) {
var match
var key
var getattr

while (match = cmsData.regex.abePattern.exec(template)) {
var getattr = cmsData.regex.getAttr(match, 'key').replace(/\./g, '-')
key = cmsData.regex.getAttr(match, 'key')

if (cmsData.regex.isSingleAbe(match, template)) {
getattr = key.replace(/\./g, '-')
} else {
getattr = key.replace('.', '[index].')
}

template = template.replace(
cmsData.regex.escapeTextToRegex(match[0], 'g'),
' data-abe-' + cmsData.regex.validDataAbe(getattr) + '="' + getattr + '" ' + match[0]
Expand Down Expand Up @@ -263,7 +273,6 @@ export function indexEachBlocks(template, onlyHtml) {

// Pour chaque tag Abe
while (match = cmsData.regex.abeTag.exec(block)) {
// template = cmsTemplates.prepare.insertAbeEach(template, match, key, cmsData.regex.eachBlockPattern.lastIndex - block.length, onlyHtml)
template = cmsTemplates.prepare.addAbeDictionnary(template, match[0], key)
}
})
Expand Down Expand Up @@ -295,4 +304,4 @@ export function addAbeDictionnary(template, match, key) {
}

return template
}
}

0 comments on commit 4d02252

Please sign in to comment.