diff --git a/src/js/parser/javascript/any_character.js b/src/js/parser/javascript/any_character.js index b0751d1..b1275e2 100644 --- a/src/js/parser/javascript/any_character.js +++ b/src/js/parser/javascript/any_character.js @@ -7,6 +7,6 @@ export default _.extend({}, Base, { render() { this.container.addClass('any-character'); - this.label = this.render_label(this.container, 'any character'); + this.label = this.renderLabel(this.container, 'any character'); } }); diff --git a/src/js/parser/javascript/base.js b/src/js/parser/javascript/base.js index 2218009..0cad1ac 100644 --- a/src/js/parser/javascript/base.js +++ b/src/js/parser/javascript/base.js @@ -1,5 +1,5 @@ export default { - render_label(container, text) { + renderLabel(container, text) { var group = container.group(); group.rect(); @@ -11,7 +11,7 @@ export default { return group; }, - position_label(group) { + positionLabel(group) { var text = group.select('text'), rect = group.select('rect'), box = text.getBBox(), @@ -36,7 +36,7 @@ export default { this.container.addClass('placeholder'); - this.label = this.render_label(this.container, this.textValue); + this.label = this.renderLabel(this.container, this.textValue); this.label.select('rect').attr({ rx: 10, @@ -45,6 +45,6 @@ export default { }, position() { - this.position_label(this.label); + this.positionLabel(this.label); } }; diff --git a/src/js/parser/javascript/escape.js b/src/js/parser/javascript/escape.js index 0b82d8e..74b5f38 100644 --- a/src/js/parser/javascript/escape.js +++ b/src/js/parser/javascript/escape.js @@ -15,7 +15,7 @@ export default _.extend({}, Base, { render() { this.container.addClass('escape'); - this.label = this.render_label(this.container, _.result(this, this.code())); + this.label = this.renderLabel(this.container, _.result(this, this.code())); this.label.select('rect').attr({ rx: 3, diff --git a/src/js/parser/javascript/literal.js b/src/js/parser/javascript/literal.js index 798cd7c..4c01a1f 100644 --- a/src/js/parser/javascript/literal.js +++ b/src/js/parser/javascript/literal.js @@ -7,7 +7,7 @@ export default _.extend({}, Base, { render() { this.container.addClass('literal'); - this.label = this.render_label(this.container, '"' + this.literal.textValue + '"'); + this.label = this.renderLabel(this.container, '"' + this.literal.textValue + '"'); this.label.select('rect').attr({ rx: 3, diff --git a/src/js/parser/javascript/match.js b/src/js/parser/javascript/match.js index 8d0d329..32d0de7 100644 --- a/src/js/parser/javascript/match.js +++ b/src/js/parser/javascript/match.js @@ -9,8 +9,8 @@ export default _.extend({}, Base, { this.contents = {}; - if (this.anchor_start()) { - this.contents.anchor_start = this.render_label(this.container, 'Start of line') + if (this.anchorStart()) { + this.contents.anchor_start = this.renderLabel(this.container, 'Start of line') .addClass('anchor'); } @@ -20,8 +20,8 @@ export default _.extend({}, Base, { return part; }); - if (this.anchor_end()) { - this.contents.anchor_end = this.render_label(this.container, 'End of line') + if (this.anchorEnd()) { + this.contents.anchor_end = this.renderLabel(this.container, 'End of line') .addClass('anchor'); } }, @@ -30,8 +30,8 @@ export default _.extend({}, Base, { var offset = 0, path = []; - if (this.anchor_start()) { - this.position_label(this.contents.anchor_start); + if (this.anchorStart()) { + this.positionLabel(this.contents.anchor_start); offset += this.contents.anchor_start.getBBox().width + 10; path.push(Snap.format('M{x2},{cy}h10', this.contents.anchor_start.getBBox())); } @@ -44,8 +44,8 @@ export default _.extend({}, Base, { path.push(Snap.format('M{x2},{cy}h10', part.container.getBBox())); }); - if (this.anchor_end()) { - this.position_label(this.contents.anchor_end); + if (this.anchorEnd()) { + this.positionLabel(this.contents.anchor_end); this.contents.anchor_end.transform(Snap.matrix() .translate(offset, 0)); } else { @@ -57,11 +57,11 @@ export default _.extend({}, Base, { ); }, - anchor_start() { + anchorStart() { return this._anchor_start.textValue !== ''; }, - anchor_end() { + anchorEnd() { return this._anchor_end.textValue !== ''; }, diff --git a/src/js/parser/javascript/match_fragment.js b/src/js/parser/javascript/match_fragment.js index e78588b..233543b 100644 --- a/src/js/parser/javascript/match_fragment.js +++ b/src/js/parser/javascript/match_fragment.js @@ -15,24 +15,24 @@ export default _.extend({}, Base, { this._content.position(); if (this._repeat.textValue !== '') { - this._content.container.transform(this._repeat.content_position()); + this._content.container.transform(this._repeat.contentPosition()); box = this._content.container.getBBox(); - if (this._repeat.has_skip()) { + if (this._repeat.hasSkip()) { paths.push(Snap.format('M0,{cy}q10,0 10,-10v-{vert}q0,-10 10,-10h{horiz}q10,0 10,10v{vert}q0,10 10,10', _.extend({ vert: box.height / 2 - 10, horiz: box.width - 10 }, box))); } - if (this._repeat.has_loop()) { + if (this._repeat.hasLoop()) { paths.push(Snap.format('M{x},{cy}q-10,0 -10,10v{vert}q0,10 10,10h{width}q10,0 10,-10v-{vert}q0,-10 -10,-10', _.extend({ vert: box.height / 2 - 10 }, box))); } - if (this._repeat.has_loop() || this._repeat.has_skip()) { + if (this._repeat.hasLoop() || this._repeat.hasSkip()) { paths.push(Snap.format('M0,{cy}h15M{x2},{cy}h15', box)); } diff --git a/src/js/parser/javascript/repeat.js b/src/js/parser/javascript/repeat.js index 7f96891..277c4a4 100644 --- a/src/js/parser/javascript/repeat.js +++ b/src/js/parser/javascript/repeat.js @@ -11,22 +11,22 @@ export default { return (this._greedy.textValue !== ''); }, - has_skip() { + hasSkip() { return this.minimum() === 0; }, - has_loop() { + hasLoop() { return this.maximum() === -1 || this.maximum() > 1; }, - content_position() { + contentPosition() { var x = 0, y = 0; - if (this.has_skip()) { + if (this.hasSkip()) { y = 10; } - if (this.has_skip() || this.has_loop()) { + if (this.hasSkip() || this.hasLoop()) { x = 15; }