ソースを参照

Merge pull request #129 from wittemann/master

Add qooxdoo wrapper. Use `make qooxdoo`.
tags/0.4.0
Jan Lehnardt 14年前
コミット
d87d274d4c
4個のファイルの変更140行の追加1行の削除
  1. +3
    -1
      README.md
  2. +1
    -0
      Rakefile
  3. +9
    -0
      mustache-qooxdoo/qooxdoo.mustache.js.tpl.post
  4. +127
    -0
      mustache-qooxdoo/qooxdoo.mustache.js.tpl.pre

+ 3
- 1
README.md ファイルの表示

@@ -285,7 +285,7 @@ Or just install it as a RubyGem:
[couchdb]: http://couchdb.apache.org [couchdb]: http://couchdb.apache.org




## Plugins for jQuery, Dojo, Yui, CommonJS
## Plugins for jQuery, Dojo, Yui, CommonJS, qooxdoo


This repository lets you build modules for [jQuery][], [Dojo][], [Yui][] and This repository lets you build modules for [jQuery][], [Dojo][], [Yui][] and
[CommonJS][] / [Node.js][] with the help of `rake`. You may need to install [CommonJS][] / [Node.js][] with the help of `rake`. You may need to install
@@ -303,6 +303,8 @@ directory.
Run `rake commonjs` to get a CommonJS compatible plugin file in the Run `rake commonjs` to get a CommonJS compatible plugin file in the
`mustache-commonjs/` directory which you can also use with [Node.js][]. `mustache-commonjs/` directory which you can also use with [Node.js][].


Run `rake qooxdoo` to get a qooxdoo compatible file named `qooxdoo.mustache.js`.

## Testing ## Testing


To run the mustache.js test suite, run `rake spec`. All specs will be run first with JavaScriptCore (using `jsc`) To run the mustache.js test suite, run `rake spec`. All specs will be run first with JavaScriptCore (using `jsc`)


+ 1
- 0
Rakefile ファイルの表示

@@ -42,6 +42,7 @@ end


templated_build "CommonJS", :location => "lib", :extra => "package.json" templated_build "CommonJS", :location => "lib", :extra => "package.json"
templated_build "jQuery" templated_build "jQuery"
templated_build "qooxdoo"
templated_build "Dojo", :location => "dojox/string" templated_build "Dojo", :location => "dojox/string"
templated_build "YUI3", :location => "yui3/mustache" templated_build "YUI3", :location => "yui3/mustache"
templated_build "requirejs" templated_build "requirejs"


+ 9
- 0
mustache-qooxdoo/qooxdoo.mustache.js.tpl.post ファイルの表示

@@ -0,0 +1,9 @@
/**
* Above is the original mustache code.
*/

// EXPOSE qooxdoo variant
qx.bom.Template.version = Mustache.version;
qx.bom.Template.toHtml = Mustache.to_html;

})();

+ 127
- 0
mustache-qooxdoo/qooxdoo.mustache.js.tpl.pre ファイルの表示

@@ -0,0 +1,127 @@
/* ************************************************************************

qooxdoo - the new era of web development

http://qooxdoo.org

Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de

License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.

Authors:
* Martin Wittemann (martinwittemann)

======================================================================

This class contains code based on the following work:

* Mustache.js version 0.4.0-dev

Code:
https://github.com/janl/mustache.js

Copyright:
(c) 2009 Chris Wanstrath (Ruby)
(c) 2010 Jan Lehnardt (JavaScript)

License:
MIT: http://www.opensource.org/licenses/mit-license.php

----------------------------------------------------------------------

Copyright (c) 2009 Chris Wanstrath (Ruby)
Copyright (c) 2010 Jan Lehnardt (JavaScript)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

************************************************************************ */

/**
* The is a template class which can be used for HTML templating. In fact,
* this is a wrapper for mustache.js which is a "framework-agnostic way to
* render logic-free views".
*
* Here is a basic example how to use it:
* Template:
* <pre>
* var template = "Hi, my name is {{name}}!";
* var view = {name: "qooxdoo"};
* qx.bom.Template.toHtml(template, view);
* // return "Hi, my name is qooxdoo!"
* </pre>
*
* For further details, please visit the mustache.js documentation here:
* https://github.com/janl/mustache.js/blob/master/README.md
*/
qx.Class.define("qx.bom.Template", {
statics : {
/** Contains the mustache.js version. */
version: null,

/**
* Original and only template method of mustache.js. For further
* documentation, please visit https://github.com/janl/mustache.js
*
* @signature function(template, view, partials, send_fun)
* @param template {String} The String containing the template.
* @param view {Object} The object holding the data to render.
* @param partials {Object} Object holding parts of a template.
* @param send_fun {Function?} Callback function for streaming.
* @return {String} The parsed template.
*/
toHtml: null,


/**
* Helper method which provides you with a direct access to templates
* stored as HTML in the DOM. The DOM node with the given ID will be reated
* as a template, parsed and a new DOM node will be returned containing the
* parsed data.
*
* @param id {String} The id of the HTML template in the DOM.
* @param view {Object} The object holding the data to render.
* @param partials {Object} Object holding parts of a template.
* @return {DomNode} A DOM element holding the parsed template data.
*/
get : function(id, view, partials) {
var template = document.getElementById(id);
var inner = template.innerHTML;

inner = this.toHtml(inner, view, partials);

var helper = qx.bom.Element.create("div");
helper.innerHTML = inner;
return helper.children[0];
}
}
});

(function() {

/**
* Below is the original mustache.js code. Snapshot date is mentioned in
* the head of this file.
*/

読み込み中…
キャンセル
保存