Skip to content

Commit

Permalink
refactoring: version + linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Oct 9, 2016
1 parent d951416 commit 722e658
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -75,7 +75,7 @@
"prompt": "^1.0.0",
"qs": "^6.0.1",
"request": "^2.69.0",
"watch": "^0.19.2",
"watch": "^1.0.1",
"xss": "^0.2.10"
},
"devDependencies": {
Expand Down
14 changes: 5 additions & 9 deletions src/cli/cms/Page.js
Expand Up @@ -94,17 +94,15 @@ export default class Page {

var patAttrSource = new RegExp(' ([A-Za-z0-9\-\_]+)=["|\'].*?({{' + keys[i] + '}}).*?["|\']', 'g')
var patAttrSourceMatch = this.template.match(patAttrSource)
var patAttrSourceInside = null
var patAttrSourceCheck = null
var checkEscaped = null

if(patAttrSourceMatch != null) {
patAttrSourceInside = new RegExp('(\\S+)=["\']?((?:.(?!["\']?\\s+(?:\\S+)=|[>"\']))+.)["\']?({{' + keys[i] + '}}).*?["|\']', 'g')
let checkEscapedRegex = /["|'](.*?)["|']/
let patAttrSourceInside = new RegExp('(\\S+)=["\']?((?:.(?!["\']?\\s+(?:\\S+)=|[>"\']))+.)["\']?({{' + keys[i] + '}}).*?["|\']', 'g')
Array.prototype.forEach.call(patAttrSourceMatch, (pat) => {
patAttrSourceCheck = patAttrSourceInside.exec(pat)
let patAttrSourceCheck = patAttrSourceInside.exec(pat)
if(patAttrSourceCheck != null) {
var checkEscaped = /["|'](.*?)["|']/
checkEscaped = checkEscaped.exec(patAttrSourceCheck[0])

let checkEscaped = checkEscapedRegex.exec(patAttrSourceCheck[0])
if(checkEscaped != null && checkEscaped.length > 0) {
checkEscaped = escape(checkEscaped[1])
this.template = this.template.replace(
Expand Down Expand Up @@ -199,7 +197,6 @@ export default class Page {
Array.prototype.forEach.call(blocks, (block) => {
var key = block.match(/#each (.*)\}\}/)
key = key[1]
let util = new cmsEditor.form()
var match

if(!this._onlyHTML) {
Expand Down Expand Up @@ -269,7 +266,6 @@ export default class Page {

/**
* add <abe> tag around html tag
* @param {String} text html string
*/
_removeHidden() {
this.template = this.template.replace(/(\{\{abe.*visible=[\'|\"]false.*\}\})/g, '')
Expand Down
20 changes: 0 additions & 20 deletions src/server/helpers/abe-locale.js

This file was deleted.

11 changes: 5 additions & 6 deletions src/server/helpers/page.js
Expand Up @@ -42,14 +42,13 @@ var page = function (req, res, next) {

let meta = config.meta.name

var template = ''
if(typeof json[meta] !== 'undefined' && json[meta] !== null && json[meta] !== ''
&& json[meta].template !== 'undefined' && json[meta].template !== null && json[meta].template !== '') {
template = json[meta].template
var templateId = ''
if(json[meta] && json[meta].template) {
templateId = json[meta].template
}else {
template = req.params[0]
templateId = req.params[0]
}
var text = cmsTemplates.template.getTemplate(template)
var text = cmsTemplates.template.getTemplate(templateId)

if (!editor) {

Expand Down

0 comments on commit 722e658

Please sign in to comment.