-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b8a60d0
Showing
170 changed files
with
40,411 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.egg-info | ||
*.pyc | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright (c) 2012, Mike Yumatov <mike@yumatov.org> | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include LICENSE | ||
include README.rst | ||
|
||
include gears_handlebars/compiler.js | ||
recursive-include gears_handlebars/node_modules * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
update: | ||
rm -rf gears_handlebars/node_modules | ||
cd gears_handlebars && npm install handlebars | ||
rm -rf gears_handlebars/node_modules/.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
gears-handlebars | ||
================== | ||
|
||
Handlebars_ compiler for Gears_. This package already includes the Handlebars | ||
source code for you, so you don't need to worry about installing it yourself. | ||
|
||
Installation | ||
------------ | ||
|
||
Install ``gears-handlebars`` with pip:: | ||
|
||
$ pip install gears-handlebars | ||
|
||
|
||
Requirements | ||
------------ | ||
|
||
``gears-handlebars`` requires node.js_ to be installed in your system. | ||
|
||
|
||
Usage | ||
----- | ||
|
||
Add ``gears_handlebars.HandlebarsCompiler`` to ``environment``'s compilers | ||
registry:: | ||
|
||
from gears_handlebars import HandlebarsCompiler | ||
environment.compilers.register('.handlebars', HandlebarsCompiler.as_handler()) | ||
|
||
If you use Gears in your Django project, add this code to its settings:: | ||
|
||
GEARS_COMPILERS = { | ||
'.handlebars': 'gears_handlebars.HandlebarsCompiler', | ||
} | ||
|
||
.. _Handlebars: http://handlebarsjs.com/ | ||
.. _Gears: https://github.com/gears/gears | ||
.. _node.js: http://nodejs.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .compiler import HandlebarsCompiler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var handlebars = require('handlebars'), | ||
template = ''; | ||
|
||
process.stdin.resume(); | ||
process.stdin.setEncoding('utf8'); | ||
|
||
process.stdin.on('data', function(chunk) { | ||
template += chunk; | ||
}); | ||
|
||
process.stdin.on('end', function() { | ||
process.stdout.write(handlebars.precompile(template)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
from gears.compilers import ExecCompiler | ||
|
||
|
||
SOURCE = '\n'.join(( | ||
"(function() {", | ||
" var template = Handlebars.template,", | ||
" templates = Handlebars.templates = Handlebars.templates || {};", | ||
" templates['%(name)s'] = template(%(source)s);", | ||
"}).call(this);")) | ||
|
||
|
||
class HandlebarsCompiler(ExecCompiler): | ||
|
||
result_mimetype = 'application/javascript' | ||
executable = 'node' | ||
params = [os.path.join(os.path.dirname(__file__), 'compiler.js')] | ||
|
||
def __call__(self, asset): | ||
super(HandlebarsCompiler, self).__call__(asset) | ||
asset.processed_source = SOURCE % { | ||
'name': asset.attributes.path_without_suffix, | ||
'source': asset.processed_source, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.