forked from Gozala/json-template
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 ea6b95d
Showing
4 changed files
with
72 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,18 @@ | ||
{ | ||
"name": "json-template", | ||
"description": "Minimal but powerful templating language implemented in multiple languages.", | ||
"keywords": [ | ||
"template", | ||
"json" | ||
], | ||
"author": "andychup (http://code.google.com/u/andychup/)", | ||
"contributors": [ | ||
"Irakli Gozalishvili (http://rfobic.wordpress.com/)" | ||
], | ||
"lib": "lib", | ||
"license": [ | ||
"Apache License 2.0", | ||
], | ||
"dependencies": [ | ||
] | ||
} |
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,27 @@ | ||
#!/bin/sh | ||
# | ||
# An example hook script for the post-receive event | ||
# | ||
# This script is run after receive-pack has accepted a pack and the | ||
# repository has been updated. It is passed arguments in through stdin | ||
# in the form | ||
# <oldrev> <newrev> <refname> | ||
# For example: | ||
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master | ||
# | ||
# see contrib/hooks/ for an sample, or uncomment the next line (on debian) | ||
# | ||
|
||
|
||
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email | ||
ref=$(<.git/HEAD) | ||
branch=${ref##ref: refs/heads/} | ||
|
||
if [ $branch == "hg" ]; then | ||
origin=$(pwd) | ||
root=$origin; while [ ! -d "$root/.git" ]; do root="$root/.."; done | ||
file=$root/lib/json-template/json-template.js | ||
wget -qO- http://json-template.googlecode.com/hg/javascript/json-template.js > $file; | ||
git add $file | ||
git commit -m $(wget -qO- http://code.google.com/feeds/p/json-template/hgchanges/basic | grep -E "(<title>|<title>)" -m "2" -) | ||
fi; |
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 @@ | ||
exports["test - json-template"] = require("./json-template-tests"); | ||
if (require.main === module.id) | ||
require("os").exit(require("test/runner").run(exports)); | ||
|
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,23 @@ | ||
var assert = require("test/assert"), | ||
Template = require("json-template/json-template").Template; | ||
|
||
exports["test - sample"] = function() { | ||
var src = '<html xmlns="http://www.w3.org/1999/xhtml" xmlns:st="http://hyperstruct.net/seethrough#js">' | ||
+ '<head><title st:content="site.title"/></head>' | ||
+ '<body><h1>Welcome to <span st:replace="site.title"/>!</h1></body>' | ||
+ '</html>'; | ||
var data = { | ||
site: { | ||
title: 'FooBar' | ||
} | ||
}; | ||
var result = '<html xmlns="http://www.w3.org/1999/xhtml" xmlns:st="http://hyperstruct.net/seethrough#js">' | ||
+ '<head><title>FooBar</title></head>' | ||
+ '<body><h1>Welcome to FooBar!</h1></body>' | ||
+ '</html>'; | ||
assert.isEqual(new Template(src).expand(data), result); | ||
}; | ||
|
||
if (module.id == require.main) | ||
require('os').exit(require('test/runner').run(exports)); | ||
|