Kaynağa Gözat

Merge remote-tracking branch 'janl/master'

Conflicts:
	mustache.js
tags/0.4.0
Ben Cherry 14 yıl önce
ebeveyn
işleme
a0979ab796
8 değiştirilmiş dosya ile 70 ekleme ve 5 silme
  1. +2
    -0
      LICENSE
  2. +3
    -3
      Rakefile
  3. +54
    -0
      TESTS_HELP.md
  4. +3
    -0
      examples/keys_with_questionmarks.html
  5. +5
    -0
      examples/keys_with_questionmarks.js
  6. +1
    -0
      examples/keys_with_questionmarks.txt
  7. +0
    -0
      foo
  8. +2
    -2
      mustache.js

+ 2
- 0
LICENSE Dosyayı Görüntüle

@@ -1,3 +1,5 @@
The MIT License

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



+ 3
- 3
Rakefile Dosyayı Görüntüle

@@ -1,11 +1,11 @@
require 'rake'
require 'spec/rake/spectask'
require 'rspec/core/rake_task'

task :default => :spec

Spec::Rake::SpecTask.new(:spec) do |t|
RSpec::Core::RakeTask.new(:spec) do |t|
#t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['test/*_spec.rb']
t.pattern = 'test/*_spec.rb'
end

desc "Run all specs"


+ 54
- 0
TESTS_HELP.md Dosyayı Görüntüle

@@ -0,0 +1,54 @@
## How to run the tests

To run the test, you need ruby and the following gems installed : rake, rspec (>=2), json

### How to install ruby and the required gems from source

Make sure you have the required tools to compile it

# apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev

Download ruby source and extract the source

$ cd ~/
$ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
$ tar xvzf stable-snapshot.tar.gz

Install it

$ ./configure && make
# make install

download the last version of RubyGems from here
http://rubyforge.org/frs/?group_id=126

Extract the source

$ tar xzvf rubygems-1.8.4.tgz

Install it

$ cd rubygems-1.8.4
# ruby setup.rb

If you want to update RubyGems

# gem update --system

Install the required gems

# gem install rake rspec json

That's it!

### How to run the tests

$ rake

### How to create a test

- Create a template file `somename.html`
- Create a javascript file with data and functions `somename.js`
- Create a file the expected result `somename.txt`

Done!

+ 3
- 0
examples/keys_with_questionmarks.html Dosyayı Görüntüle

@@ -0,0 +1,3 @@
{{#person?}}
Hi {{name}}!
{{/person?}}

+ 5
- 0
examples/keys_with_questionmarks.js Dosyayı Görüntüle

@@ -0,0 +1,5 @@
var keys_with_questionmarks = {
"person?": {
name: "Jon"
}
}

+ 1
- 0
examples/keys_with_questionmarks.txt Dosyayı Görüntüle

@@ -0,0 +1 @@
Hi Jon!

+ 0
- 0
foo Dosyayı Görüntüle


+ 2
- 2
mustache.js Dosyayı Görüntüle

@@ -57,7 +57,7 @@ var Mustache = function() {
Sends parsed lines
*/
send: function(line) {
if(line != "") {
if(line !== "") {
this.buffer.push(line);
}
},
@@ -82,7 +82,7 @@ var Mustache = function() {

var that = this;
var regex = this.getCachedRegex("render_pragmas", function(otag, ctag) {
return new RegExp(otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + ctag);
return new RegExp(otag + "%([\\w-]+) ?([\\w]+=[\\w]+)?" + ctag, "g");
});

return template.replace(regex, function(match, pragma, options) {


Yükleniyor…
İptal
Kaydet