Skip to content

Commit

Permalink
'function(' replaced with 'function (' everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
dimsmol committed Nov 2, 2012
1 parent cbd1d33 commit f2dbdb4
Show file tree
Hide file tree
Showing 75 changed files with 515 additions and 520 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ Blocks can be nested. If block is nested corresponding method call will be place

will be translated into something like

TemplateClass.prototype.appendBlockA = function() {
TemplateClass.prototype.appendBlockA = function () {
this.append('a');
this.appendBlockB();
};

TemplateClass.prototype.appendBlockB = function() {
TemplateClass.prototype.appendBlockB = function () {
this.append('b');
};

Expand All @@ -98,13 +98,13 @@ Note, that nested blocks haven't access to local variables of nesting block, bec

This examples will be translated into something like this:

TemplateClass.prototype.appendBlockA = function() {
TemplateClass.prototype.appendBlockA = function () {
for (var i=0; i<10; i++) {
this.appendBlockB();
}
};

TemplateClass.prototype.appendBlockB = function() {
TemplateClass.prototype.appendBlockB = function () {
this.append(i);
};

Expand Down
2 changes: 1 addition & 1 deletion bin/ojster
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if (argv.ext) {
options.ext = argv.ext;
}

ojster.compilePath(srcPath, dstPath, options, function(err, results) {
ojster.compilePath(srcPath, dstPath, options, function (err, results) {
if (err) {
process.exit(1);
}
Expand Down
34 changes: 17 additions & 17 deletions client/goog/ojster.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ goog.require('goog.dom.TagName');
/**
* @constructor
*/
ojster.StringWriter = function() {
ojster.StringWriter = function () {
this.buff = [];
};

ojster.StringWriter.prototype.write = function() {
ojster.StringWriter.prototype.write = function () {
this.buff.push.apply(this.buff, arguments);
};

/**
* @return {string}
*/
ojster.StringWriter.prototype.done = function() {
ojster.StringWriter.prototype.done = function () {
return this.buff.join('');
};

Expand All @@ -33,7 +33,7 @@ ojster.DefaultWriterClass = ojster.StringWriter;
* @param {Object=} opt_writer
* @constructor
*/
ojster.Template = function(opt_data, opt_ctx, opt_writer) {
ojster.Template = function (opt_data, opt_ctx, opt_writer) {
/** @type {Object} */
this.data = opt_data || null;
/** @type {Object} */
Expand All @@ -48,43 +48,43 @@ ojster.Template = function(opt_data, opt_ctx, opt_writer) {
this.init();
};

ojster.Template.prototype.init = function() {
ojster.Template.prototype.init = function () {
};

/**
* @param {function(ojster.Template)} props
* @param {function (ojster.Template)} props
*/
ojster.Template.prototype.setup = function(setupFunc) {
ojster.Template.prototype.setup = function (setupFunc) {
setupFunc.call(this);
return this;
};

/**
* @return {?string}
*/
ojster.Template.prototype.getBaseCssName = function(setupFunc) {
ojster.Template.prototype.getBaseCssName = function (setupFunc) {
return this.baseCssName;
};

/**
* @param {?string} baseCssName
*/
ojster.Template.prototype.setBaseCssName = function(baseCssName) {
ojster.Template.prototype.setBaseCssName = function (baseCssName) {
this.baseCssName = baseCssName;
};

/**
* @param {string} str
* @return {string}
*/
ojster.Template.prototype.escape = function(str) {
ojster.Template.prototype.escape = function (str) {
return ojster.escape(str);
};

/**
* @return {string}
*/
ojster.Template.prototype.render = function() {
ojster.Template.prototype.render = function () {
// ensure we have a writer
if (this.writer == null) {
this.writer = new ojster.DefaultWriterClass();
Expand All @@ -98,12 +98,12 @@ ojster.Template.prototype.render = function() {
/**
* @param {ojster.Template} template
*/
ojster.Template.prototype.renderTo = function(template) {
ojster.Template.prototype.renderTo = function (template) {
this.writer = template.writer;
this.renderBlockMain();
};

ojster.Template.prototype.renderBlockMain = function() {
ojster.Template.prototype.renderBlockMain = function () {
throw new Error('Not implemented');
};

Expand All @@ -118,7 +118,7 @@ ojster.Template.prototype.renderBlockMain = function() {
*     characters to occur in your strings, such as if you are escaping HTML.
* @return {string}
*/
ojster.escape = function(str, opt_isLikelyToContainHtmlChars) {
ojster.escape = function (str, opt_isLikelyToContainHtmlChars) {
if (str != null) {
str = goog.string.htmlEscape(str, opt_isLikelyToContainHtmlChars);
}
Expand All @@ -130,7 +130,7 @@ ojster.escape = function(str, opt_isLikelyToContainHtmlChars) {
* @param {ojster.Template} template
* @return {Element}
*/
ojster.fillElement = function(element, template) {
ojster.fillElement = function (element, template) {
element.innerHTML = template.render();
return element;
};
Expand All @@ -140,7 +140,7 @@ ojster.fillElement = function(element, template) {
* @param {goog.dom.DomHelper=} opt_domHelper
* @return {Element}
*/
ojster.createElement = function(template, opt_domHelper) {
ojster.createElement = function (template, opt_domHelper) {
/** @type {goog.dom.DomHelper} */
var dom = opt_domHelper || goog.dom.getDomHelper();
/** @type {Element} */
Expand All @@ -164,7 +164,7 @@ ojster.createElement = function(template, opt_domHelper) {
* @param {goog.dom.DomHelper=} opt_domHelper
* @return {Node}
*/
ojster.createFragment = function(template, opt_domHelper) {
ojster.createFragment = function (template, opt_domHelper) {
var dom = opt_domHelper || goog.dom.getDomHelper();
return dom.htmlToDocumentFragment(template.render());
};
34 changes: 17 additions & 17 deletions client/universal/ojster.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
}(this, function () {
"use strict";

var StringWriter = function() {
var StringWriter = function () {
this.buff = [];
};

StringWriter.prototype.write = function() {
StringWriter.prototype.write = function () {
this.buff.push.apply(this.buff, arguments);
};

StringWriter.prototype.done = function() {
StringWriter.prototype.done = function () {
return this.buff.join('');
};


var Template = function(opt_data, opt_ctx, opt_writer) {
var Template = function (opt_data, opt_ctx, opt_writer) {
this.data = opt_data || null;
this.ctx = opt_ctx || null;
this.writer = opt_writer || null;
Expand All @@ -42,31 +42,31 @@ var Template = function(opt_data, opt_ctx, opt_writer) {
this.init();
};

Template.prototype.init = function() {
Template.prototype.init = function () {
};

Template.prototype.setup = function(setupFunc) {
Template.prototype.setup = function (setupFunc) {
setupFunc.call(this);
return this;
};

Template.prototype.getBaseCssName = function(setupFunc) {
Template.prototype.getBaseCssName = function (setupFunc) {
return this.baseCssName;
};

Template.prototype.setBaseCssName = function(baseCssName) {
Template.prototype.setBaseCssName = function (baseCssName) {
this.baseCssName = baseCssName;
};

Template.prototype.escape = function(str) {
Template.prototype.escape = function (str) {
return Template.escape(str);
};

Template.prototype.createWriter = function() {
Template.prototype.createWriter = function () {
return new StringWriter();
};

Template.prototype.render = function() {
Template.prototype.render = function () {
// ensure we have a writer
if (this.writer == null) {
this.writer = this.createWriter();
Expand All @@ -77,12 +77,12 @@ Template.prototype.render = function() {
return this.writer.done();
};

Template.prototype.renderTo = function(template) {
Template.prototype.renderTo = function (template) {
this.writer = template.writer;
this.renderBlockMain();
};

Template.prototype.renderBlockMain = function() {
Template.prototype.renderBlockMain = function () {
throw new Error('Not implemented');
};

Expand All @@ -95,7 +95,7 @@ var gtRe = />/g;
var dqRe = /"/g;
var needEscRe = /[&<>"]/;

var escape = function(str, opt_isLikelyToContainHtmlChars) {
var escape = function (str, opt_isLikelyToContainHtmlChars) {
if (str != null) {
if (opt_isLikelyToContainHtmlChars) {
str = (str+'')
Expand All @@ -121,12 +121,12 @@ var escape = function(str, opt_isLikelyToContainHtmlChars) {
return str;
};

var fillElement = function(element, template) {
var fillElement = function (element, template) {
element.innerHTML = template.render();
return element;
};

var createElement = function(template) {
var createElement = function (template) {
var wrapper = document.createElement('div');
wrapper.innerHTML = (template.constructor === String ? template : template.render());

Expand All @@ -141,7 +141,7 @@ var createElement = function(template) {
return wrapper;
};

var createFragment = function(template, opt_skipIeWorkaround) {
var createFragment = function (template, opt_skipIeWorkaround) {
var htmlString = (template.constructor === String ? template : template.render());
var tempDiv = document.createElement('div');
if (!opt_skipIeWorkaround) {
Expand Down
4 changes: 2 additions & 2 deletions examples/client/compiled/amd/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function abc() {


// @template and @inherits need alias only
var Base = function(opt_data, opt_ctx, opt_writer) {
var Base = function (opt_data, opt_ctx, opt_writer) {
ojster.Template.call(this, opt_data, opt_ctx, opt_writer);
};
inherits(Base, ojster.Template);
Expand All @@ -28,7 +28,7 @@ inherits(Base, ojster.Template);
var tmp1 = Base.prototype;


Base.prototype.renderBlockMain = function() { // @25:1
Base.prototype.renderBlockMain = function () { // @25:1
var self = this;
var d = this.data, vars = this.vars;
};
Expand Down
4 changes: 2 additions & 2 deletions examples/client/compiled/browserglobals/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function abc() {


// @template and @inherits need alias only
var Base = function(opt_data, opt_ctx, opt_writer) {
var Base = function (opt_data, opt_ctx, opt_writer) {
ojster.Template.call(this, opt_data, opt_ctx, opt_writer);
};
inherits(Base, ojster.Template);
Expand All @@ -31,7 +31,7 @@ inherits(Base, ojster.Template);
var tmp1 = Base.prototype;


Base.prototype.renderBlockMain = function() { // @25:1
Base.prototype.renderBlockMain = function () { // @25:1
var self = this;
var d = this.data, vars = this.vars;
};
Expand Down
4 changes: 2 additions & 2 deletions examples/client/compiled/universal/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function abc() {


// @template and @inherits need alias only
var Base = function(opt_data, opt_ctx, opt_writer) {
var Base = function (opt_data, opt_ctx, opt_writer) {
ojster.Template.call(this, opt_data, opt_ctx, opt_writer);
};
inherits(Base, ojster.Template);
Expand All @@ -37,7 +37,7 @@ inherits(Base, ojster.Template);
var tmp1 = Base.prototype;


Base.prototype.renderBlockMain = function() { // @25:1
Base.prototype.renderBlockMain = function () { // @25:1
var self = this;
var d = this.data, vars = this.vars;
};
Expand Down
4 changes: 2 additions & 2 deletions examples/goog/templates/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ goog.require('ojster.example.templates.Tools.SomeTool');
* @constructor
* @extends {ojster.Template}
*/
ojster.example.templates.Base = function(opt_data, opt_ctx, opt_writer) {
ojster.example.templates.Base = function (opt_data, opt_ctx, opt_writer) {
goog.base(this, opt_data, opt_ctx, opt_writer);
};
goog.inherits(ojster.example.templates.Base, ojster.Template);
Expand All @@ -28,7 +28,7 @@ ojster.example.templates.Base.twistScore = function(value) {
};


ojster.example.templates.Base.prototype.renderBlockMain = function() { // @18:1
ojster.example.templates.Base.prototype.renderBlockMain = function () { // @18:1
var self = this;
var d = this.data, vars = this.vars;

Expand Down
6 changes: 3 additions & 3 deletions examples/goog_scope/templates/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ goog.require('ojster.examples.somemodule');
// any aliases defined above can be used within scope,
// because they will be explicitly defined

goog.scope(function() {
goog.scope(function () {
"use strict";

var SomeClass = ojster.examples.somemodule.sub.SomeClass;
Expand All @@ -22,7 +22,7 @@ var SomeClass = ojster.examples.somemodule.sub.SomeClass;
* @constructor
* @extends {ojster.Template}
*/
ojster.example.templates.Base = function(opt_data, opt_ctx, opt_writer) {
ojster.example.templates.Base = function (opt_data, opt_ctx, opt_writer) {
goog.base(this, opt_data, opt_ctx, opt_writer);
};
var Base = ojster.example.templates.Base;
Expand All @@ -36,7 +36,7 @@ var tmp = Base.prototype; // using alias
var tmp1 = ojster.example.templates.Base; // fully qualified names can be used as well


Base.prototype.renderBlockMain = function() { // @20:1
Base.prototype.renderBlockMain = function () { // @20:1
var self = this;
var d = this.data, vars = this.vars;

Expand Down
Loading

0 comments on commit f2dbdb4

Please sign in to comment.