Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Added "subtemplating" for lack of a better work #18

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.gem
.DS_Store
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org"

# Specify your gem's dependencies in cookie_store.gemspec
gemspec
33 changes: 33 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
PATH
remote: .
specs:
ruby-ejs (1.1.0)

GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
builder (3.2.2)
execjs (2.7.0)
minitest (5.11.3)
minitest-reporters (1.2.0)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
rake (12.3.1)
ruby-progressbar (1.9.0)

PLATFORMS
ruby

DEPENDENCIES
bundler
execjs
minitest
minitest-reporters
rake
ruby-ejs!

BUNDLED WITH
1.16.0
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EJS (Embedded JavaScript) template compiler for Ruby
EJS (Embedded JavaScript) template compiler for Ruby [![Circle CI](https://circleci.com/gh/malomalo/ruby-ejs.svg?style=svg)](https://circleci.com/gh/malomalo/ruby-ejs)
====================================================

EJS templates embed JavaScript code inside `<% ... %>` tags, much like
Expand All @@ -25,6 +25,25 @@ The EJS tag syntax is as follows:
its string value into the template output.
* `<%- ... %>` behaves like `<%= ... %>` but HTML-escapes its output.

If a evalation tag (`<%=`) ends with an open function, the function
return a compiled template. For example:

```erb
<% formTag = function(template) { return '<form>\n'+template()+'\n</form>'; } %>

<%= formTag(function () { %>
<input type="submit" />
<% }) %>
```

generates:

```html
<form>
<input type="submit" />
</form>
```

If you have the [ExecJS](https://github.com/sstephenson/execjs/)
library and a suitable JavaScript runtime installed, you can pass a
template and an optional hash of local variables to `EJS.evaluate`:
Expand Down
6 changes: 4 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'bundler/setup'
require "bundler/gem_tasks"
require "rake/testtask"

task :default => :test

Rake::TestTask.new do |t|
t.libs << "test"
t.warning = true
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
end
14 changes: 0 additions & 14 deletions ejs.gemspec

This file was deleted.

Loading