pug-ruby 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.travis.yml +20 -0
- data/Gemfile +3 -0
- data/README.md +50 -0
- data/Rakefile +9 -0
- data/lib/jade-ruby/compile.rb +69 -0
- data/lib/jade-ruby/config.rb +49 -0
- data/lib/pug-ruby.rb +5 -0
- data/lib/pug-ruby/compile.rb +76 -0
- data/lib/pug-ruby/config.rb +50 -0
- data/pug-ruby.gemspec +19 -0
- data/test/jade/extends/index.jade +8 -0
- data/test/jade/extends/layout.jade +9 -0
- data/test/jade/includes/includes/footer.jade +3 -0
- data/test/jade/includes/includes/header.jade +4 -0
- data/test/jade/includes/index.jade +10 -0
- data/test/jade/index.jade +16 -0
- data/test/pug/extends/index.pug +8 -0
- data/test/pug/extends/layout.pug +9 -0
- data/test/pug/includes/includes/footer.pug +3 -0
- data/test/pug/includes/includes/header.pug +4 -0
- data/test/pug/includes/index.pug +10 -0
- data/test/pug/index.pug +16 -0
- data/test/test-jade.rb +70 -0
- data/test/test-pug.rb +70 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: be027b8c14e9788bac1f212ef1f2b75c275f2334
|
4
|
+
data.tar.gz: f67f06fb7e0f3c50fe5bd9bcc45c93a9f0ebb396
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 64a162f930c8f41dca937990fc11c5d808cc6fdb48b50059218d8bde5503c9d40f0e32b0b06e9d70ace036585789c526f2684b48b177de06bf43252766741b55
|
7
|
+
data.tar.gz: 1a8f9c0edb89455693a40e3d2f1de5db1c0450f6ce17a9ce5fae9484a2eb294d228042d0783c7ba108ae239fe34e7905610290e3cc8ff62b965e404f9cae8163
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
## Ruby wrapper for the Pug/Jade template engine
|
2
|
+
|
3
|
+
## About
|
4
|
+
This gem is wrapper for Pug/Jade command line interface. You can compile both Jade templates ([version 1.x](https://github.com/pugjs/pug/tree/v1.x.x)) and Pug ([version 2.x](https://github.com/pugjs/pug)).
|
5
|
+
<br>
|
6
|
+
```ruby
|
7
|
+
Jade.compile(source, options)
|
8
|
+
Pug.compile(source, options)
|
9
|
+
```
|
10
|
+
|
11
|
+
## Installing gem
|
12
|
+
Run `gem install pug-ruby -v '~> 1.0'`. Add `require 'pug-ruby'` to your code.
|
13
|
+
|
14
|
+
|
15
|
+
**If you are using bundler.**
|
16
|
+
<br>
|
17
|
+
Add to your Gemfile:
|
18
|
+
```ruby
|
19
|
+
gem 'pug-ruby', '~> 1.0'
|
20
|
+
```
|
21
|
+
|
22
|
+
## Installing Jade
|
23
|
+
Install Jade globally via npm:
|
24
|
+
```bash
|
25
|
+
npm install -g jade
|
26
|
+
```
|
27
|
+
|
28
|
+
## Installing Pug
|
29
|
+
Install Pug globally via npm:
|
30
|
+
```bash
|
31
|
+
npm install -g pug-cli
|
32
|
+
```
|
33
|
+
|
34
|
+
## Configuring Pug and Jade
|
35
|
+
Access Pug and Jade configurations:
|
36
|
+
```ruby
|
37
|
+
Jade.config.compile_debug = false
|
38
|
+
Pug.config.compile_debug = false
|
39
|
+
```
|
40
|
+
|
41
|
+
Refer to official website for configuration options meaning:
|
42
|
+
<br>
|
43
|
+
[pugjs.org](https://pugjs.org)
|
44
|
+
<br>
|
45
|
+
[jade-lang.com (sorry, webarchive only)](http://web.archive.org/web/*/jade-lang.com)
|
46
|
+
|
47
|
+
## Running Tests
|
48
|
+
1. Install both Pug and Jade
|
49
|
+
2. Install gem dependencies: `bundle install`
|
50
|
+
3. Finally run tests: `bundle exec rake test`
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'open3'
|
3
|
+
require 'json'
|
4
|
+
require 'shellwords'
|
5
|
+
|
6
|
+
module Jade
|
7
|
+
class << self
|
8
|
+
def compile(source, options = {})
|
9
|
+
check_executable!
|
10
|
+
|
11
|
+
source = source.read if source.respond_to?(:read)
|
12
|
+
options = config.to_hash.merge(options)
|
13
|
+
|
14
|
+
# http://web.archive.org/web/*/http://jade-lang.com/command-line/
|
15
|
+
cmd = ['jade']
|
16
|
+
|
17
|
+
options[:compileDebug] = options[:compile_debug]
|
18
|
+
options[:nameAfterFile] = options[:name_after_file]
|
19
|
+
|
20
|
+
options.respond_to?(:compact) ? options.compact : options.delete_if { |k, v| v.nil? }
|
21
|
+
|
22
|
+
# Command line arguments take precedence over json options
|
23
|
+
# https://github.com/jadejs/jade/blob/master/bin/jade.js
|
24
|
+
cmd.push('--obj', JSON.generate(options))
|
25
|
+
|
26
|
+
cmd.push('--out', escape(options[:out])) if options[:out]
|
27
|
+
cmd.push('--path', escape(options[:filename])) if options[:filename]
|
28
|
+
cmd.push('--basedir', escape(options[:basedir])) if options[:basedir]
|
29
|
+
cmd.push('--pretty') if options[:pretty]
|
30
|
+
cmd.push('--client') if options[:client]
|
31
|
+
cmd.push('--name', escape(options[:name])) if options[:name]
|
32
|
+
cmd.push('--no-debug') unless options[:compile_debug]
|
33
|
+
cmd.push('--extension', escape(options[:extension])) if options[:extension]
|
34
|
+
cmd.push('--hierarchy', escape(options[:hierarchy])) if options[:hierarchy]
|
35
|
+
cmd.push('--name-after-file', escape(options[:name_after_file])) if options[:name_after_file]
|
36
|
+
cmd.push('--doctype', escape(options[:doctype])) if options[:doctype]
|
37
|
+
|
38
|
+
stdout, stderr, exit_status = Open3.capture3(*cmd, stdin_data: source)
|
39
|
+
raise CompileError.new(stderr) unless exit_status.success?
|
40
|
+
|
41
|
+
if options[:client]
|
42
|
+
%{ (function(jade) { #{stdout}; return #{options[:name]}; }).call(this, jade); }
|
43
|
+
else
|
44
|
+
stdout
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def check_executable!
|
49
|
+
unless @executable_checked
|
50
|
+
`jade --version`
|
51
|
+
unless $?.success?
|
52
|
+
raise ExecutableError, 'No jade executable found in your system. Did you forget to "npm install -g jade"?'
|
53
|
+
end
|
54
|
+
@executable_checked = true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
def escape(string)
|
60
|
+
Shellwords.escape(string)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class CompileError < StandardError
|
65
|
+
end
|
66
|
+
|
67
|
+
class ExecutableError < StandardError
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Jade
|
3
|
+
class Config
|
4
|
+
# http://web.archive.org/web/20160404025722/http://jade-lang.com/api/
|
5
|
+
# http://web.archive.org/web/20160618141847/http://jade-lang.com/command-line/
|
6
|
+
attr_accessor :filename
|
7
|
+
attr_accessor :doctype
|
8
|
+
attr_accessor :pretty
|
9
|
+
attr_accessor :self
|
10
|
+
attr_accessor :debug
|
11
|
+
attr_accessor :compile_debug
|
12
|
+
attr_accessor :cache
|
13
|
+
attr_accessor :globals
|
14
|
+
attr_accessor :client
|
15
|
+
attr_accessor :name
|
16
|
+
attr_accessor :name_after_file
|
17
|
+
attr_accessor :out
|
18
|
+
attr_accessor :extension
|
19
|
+
attr_accessor :hierarchy
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
@filename = nil
|
23
|
+
@doctype = nil
|
24
|
+
@pretty = false
|
25
|
+
@self = false
|
26
|
+
@debug = false
|
27
|
+
@compile_debug = false
|
28
|
+
@cache = false
|
29
|
+
@globals = []
|
30
|
+
@client = false
|
31
|
+
@name = 'template'
|
32
|
+
@name_after_file = nil
|
33
|
+
@out = nil
|
34
|
+
@extension = nil
|
35
|
+
@hierarchy = false
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_hash
|
39
|
+
%i( filename doctype pretty
|
40
|
+
self debug compile_debug
|
41
|
+
cache globals client
|
42
|
+
name name_after_file out
|
43
|
+
extension hierarchy ).each_with_object({}) { |x, y| y[x] = send(x) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class << self; attr_accessor :config; end
|
48
|
+
self.config = Config.new
|
49
|
+
end
|
data/lib/pug-ruby.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'open3'
|
3
|
+
require 'json'
|
4
|
+
require 'shellwords'
|
5
|
+
|
6
|
+
module Pug
|
7
|
+
class << self
|
8
|
+
def compile(source, options = {})
|
9
|
+
check_executable!
|
10
|
+
|
11
|
+
source = source.read if source.respond_to?(:read)
|
12
|
+
options = config.to_hash.merge(options)
|
13
|
+
|
14
|
+
# https://github.com/pugjs/pug-cli
|
15
|
+
cmd = ['pug']
|
16
|
+
|
17
|
+
options[:compileDebug] = options[:compile_debug]
|
18
|
+
options[:nameAfterFile] = options[:name_after_file]
|
19
|
+
options[:inlineRuntimeFunctions] = options[:inline_runtime_functions]
|
20
|
+
|
21
|
+
options.respond_to?(:compact) ? options.compact : options.delete_if { |k, v| v.nil? }
|
22
|
+
|
23
|
+
# Command line arguments take precedence over json options
|
24
|
+
# https://github.com/pugjs/pug-cli/blob/master/index.js
|
25
|
+
cmd.push('--obj', JSON.generate(options))
|
26
|
+
|
27
|
+
cmd.push('--out', escape(options[:out])) if options[:out]
|
28
|
+
cmd.push('--path', escape(options[:filename])) if options[:filename]
|
29
|
+
cmd.push('--basedir', escape(options[:basedir])) if options[:basedir]
|
30
|
+
cmd.push('--pretty') if options[:pretty]
|
31
|
+
cmd.push('--client') if options[:client]
|
32
|
+
cmd.push('--name', escape(options[:name])) if options[:name]
|
33
|
+
cmd.push('--no-debug') unless options[:compile_debug]
|
34
|
+
cmd.push('--extension', escape(options[:extension])) if options[:extension]
|
35
|
+
cmd.push('--silent') if options[:silent]
|
36
|
+
cmd.push('--name-after-file', escape(options[:name_after_file])) if options[:name_after_file]
|
37
|
+
cmd.push('--doctype', escape(options[:doctype])) if options[:doctype]
|
38
|
+
|
39
|
+
stdout, stderr, exit_status = Open3.capture3(*cmd, stdin_data: source)
|
40
|
+
|
41
|
+
raise CompileError.new(stderr) unless exit_status.success?
|
42
|
+
|
43
|
+
if options[:client]
|
44
|
+
if options[:inline_runtime_functions]
|
45
|
+
%{ (function() { #{stdout}; return #{options[:name]}; }).call(this); }
|
46
|
+
else
|
47
|
+
%{ (function(pug) { #{stdout}; return #{options[:name]}; }).call(this, pug); }
|
48
|
+
end
|
49
|
+
else
|
50
|
+
stdout
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def check_executable!
|
55
|
+
unless @executable_checked
|
56
|
+
`pug --version`
|
57
|
+
unless $?.success?
|
58
|
+
raise ExecutableError, 'No pug executable found in your system. Did you forget to "npm install -g pug-cli"?'
|
59
|
+
end
|
60
|
+
@executable_checked = true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
def escape(string)
|
66
|
+
Shellwords.escape(string)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class CompileError < StandardError
|
71
|
+
end
|
72
|
+
|
73
|
+
class ExecutableError < StandardError
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Pug
|
3
|
+
class Config
|
4
|
+
# https://pugjs.org/api/reference.html
|
5
|
+
# https://github.com/pugjs/pug-cli
|
6
|
+
attr_accessor :filename
|
7
|
+
attr_accessor :basedir
|
8
|
+
attr_accessor :doctype
|
9
|
+
attr_accessor :pretty
|
10
|
+
attr_accessor :self
|
11
|
+
attr_accessor :debug
|
12
|
+
attr_accessor :compile_debug
|
13
|
+
attr_accessor :globals
|
14
|
+
attr_accessor :inline_runtime_functions
|
15
|
+
attr_accessor :name
|
16
|
+
attr_accessor :name_after_file
|
17
|
+
attr_accessor :out
|
18
|
+
attr_accessor :extension
|
19
|
+
attr_accessor :silent
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
@filename = nil
|
23
|
+
@basedir = nil
|
24
|
+
@doctype = nil
|
25
|
+
@pretty = false
|
26
|
+
@self = false
|
27
|
+
@debug = false
|
28
|
+
@compile_debug = false
|
29
|
+
@globals = []
|
30
|
+
@inline_runtime_functions = true
|
31
|
+
@name = 'template'
|
32
|
+
@name_after_file = nil
|
33
|
+
@out = nil
|
34
|
+
@extension = nil
|
35
|
+
@silent = true
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_hash
|
39
|
+
%i( filename basedir doctype
|
40
|
+
pretty self debug
|
41
|
+
compile_debug globals inline_runtime_functions
|
42
|
+
name name_after_file out
|
43
|
+
extension silent ).each_with_object({}) { |x, y| y[x] = send(x) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
singleton_class.class_exec { attr_accessor :config }
|
48
|
+
self.config = Config.new
|
49
|
+
end
|
50
|
+
|
data/pug-ruby.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = 'pug-ruby'
|
4
|
+
s.version = '1.0.1'
|
5
|
+
s.author = 'Yaroslav Konoplov'
|
6
|
+
s.email = 'eahome00@gmail.com'
|
7
|
+
s.summary = 'Ruby wrapper for the Pug/Jade template engine.'
|
8
|
+
s.description = 'Ruby wrapper for the Pug/Jade template engine.'
|
9
|
+
s.homepage = 'https://github.com/yivo/pug-ruby'
|
10
|
+
s.license = 'MIT'
|
11
|
+
|
12
|
+
s.executables = `git ls-files -z -- bin/*`.split("\x0").map{ |f| File.basename(f) }
|
13
|
+
s.files = `git ls-files -z`.split("\x0")
|
14
|
+
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
|
17
|
+
s.add_development_dependency 'bundler', '~> 1.7'
|
18
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
doctype html
|
2
|
+
html(lang='en')
|
3
|
+
head
|
4
|
+
title=pageTitle
|
5
|
+
script(type='text/javascript').
|
6
|
+
if (foo) bar(1 + 5);
|
7
|
+
body
|
8
|
+
h1 Jade - node template engine
|
9
|
+
#container.col
|
10
|
+
if youAreUsingJade
|
11
|
+
p You are amazing
|
12
|
+
else
|
13
|
+
p Get on it!
|
14
|
+
p.
|
15
|
+
Jade is a terse and simple templating language with a
|
16
|
+
strong focus on performance and powerful features.
|
data/test/pug/index.pug
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
doctype html
|
2
|
+
html(lang='en')
|
3
|
+
head
|
4
|
+
title=pageTitle
|
5
|
+
script(type='text/javascript').
|
6
|
+
if (foo) bar(1 + 5);
|
7
|
+
body
|
8
|
+
h1 Jade - node template engine
|
9
|
+
#container.col
|
10
|
+
if youAreUsingJade
|
11
|
+
p You are amazing
|
12
|
+
else
|
13
|
+
p Get on it!
|
14
|
+
p.
|
15
|
+
Jade is a terse and simple templating language with a
|
16
|
+
strong focus on performance and powerful features.
|
data/test/test-jade.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'pug-ruby'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class JadeTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_compile
|
8
|
+
file = expand_path('index.jade')
|
9
|
+
template = File.read(file)
|
10
|
+
result = Jade.compile(template, client: true)
|
11
|
+
assert_match_template_function(result)
|
12
|
+
assert_no_match_doctype(result)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_compile_with_io
|
16
|
+
io = StringIO.new("div\n | Hello, world!")
|
17
|
+
assert_equal(Jade.compile("div\n | Hello, world!"), Jade.compile(io))
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_compilation_error
|
21
|
+
assert_raise(Jade::CompileError) { Jade.compile("else\n div") }
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_includes
|
25
|
+
file = expand_path('includes/index.jade')
|
26
|
+
template = File.read(file)
|
27
|
+
result = Jade.compile(template, filename: file, client: false)
|
28
|
+
assert_match_doctype(result)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_extends
|
32
|
+
file = expand_path('extends/layout.jade')
|
33
|
+
template = File.read(file)
|
34
|
+
result = Jade.compile(template, filename: file, client: false)
|
35
|
+
assert_match_doctype(result)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_includes_client
|
39
|
+
file = expand_path('includes/index.jade')
|
40
|
+
template = File.read(file)
|
41
|
+
result = Jade.compile(template, filename: file, client: true)
|
42
|
+
assert_match_template_function(result)
|
43
|
+
assert_no_match_doctype(result)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_extends_client
|
47
|
+
file = expand_path('extends/layout.jade')
|
48
|
+
template = File.read(file)
|
49
|
+
result = Jade.compile(template, filename: file, client: true)
|
50
|
+
assert_match_template_function(result)
|
51
|
+
assert_no_match_doctype(result)
|
52
|
+
end
|
53
|
+
|
54
|
+
protected
|
55
|
+
def expand_path(relative_path)
|
56
|
+
File.expand_path(File.join('..', 'jade', relative_path), __FILE__)
|
57
|
+
end
|
58
|
+
|
59
|
+
def assert_match_doctype(string)
|
60
|
+
assert_match(/^\s*<!DOCTYPE html>/, string)
|
61
|
+
end
|
62
|
+
|
63
|
+
def assert_no_match_doctype(string)
|
64
|
+
assert_no_match(/^\s*<!DOCTYPE html>/, string)
|
65
|
+
end
|
66
|
+
|
67
|
+
def assert_match_template_function(string)
|
68
|
+
assert_match(/function\s+#{Jade.config.name}\s*\(locals\)\s*\{.*\}/m, string)
|
69
|
+
end
|
70
|
+
end
|
data/test/test-pug.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'pug-ruby'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class PugTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_compile
|
8
|
+
file = expand_path('index.pug')
|
9
|
+
template = File.read(file)
|
10
|
+
result = Pug.compile(template, client: true)
|
11
|
+
assert_match_template_function(result)
|
12
|
+
assert_no_match_doctype(result)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_compile_with_io
|
16
|
+
io = StringIO.new("div\n | Hello, world!")
|
17
|
+
assert_equal(Pug.compile("div\n | Hello, world!"), Pug.compile(io))
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_compilation_error
|
21
|
+
assert_raise(Pug::CompileError) { Pug.compile("else\n div") }
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_includes
|
25
|
+
file = expand_path('includes/index.pug')
|
26
|
+
template = File.read(file)
|
27
|
+
result = Pug.compile(template, filename: file, client: false)
|
28
|
+
assert_match_doctype(result)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_extends
|
32
|
+
file = expand_path('extends/layout.pug')
|
33
|
+
template = File.read(file)
|
34
|
+
result = Pug.compile(template, filename: file, client: false)
|
35
|
+
assert_match_doctype(result)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_includes_client
|
39
|
+
file = expand_path('includes/index.pug')
|
40
|
+
template = File.read(file)
|
41
|
+
result = Pug.compile(template, filename: file, client: true)
|
42
|
+
assert_match_template_function(result)
|
43
|
+
assert_no_match_doctype(result)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_extends_client
|
47
|
+
file = expand_path('extends/layout.pug')
|
48
|
+
template = File.read(file)
|
49
|
+
result = Pug.compile(template, filename: file, client: true)
|
50
|
+
assert_match_template_function(result)
|
51
|
+
assert_no_match_doctype(result)
|
52
|
+
end
|
53
|
+
|
54
|
+
protected
|
55
|
+
def expand_path(relative_path)
|
56
|
+
File.expand_path(File.join('..', 'pug', relative_path), __FILE__)
|
57
|
+
end
|
58
|
+
|
59
|
+
def assert_match_doctype(string)
|
60
|
+
assert_match(/^\s*<!DOCTYPE html>/, string)
|
61
|
+
end
|
62
|
+
|
63
|
+
def assert_no_match_doctype(string)
|
64
|
+
assert_no_match(/^\s*<!DOCTYPE html>/, string)
|
65
|
+
end
|
66
|
+
|
67
|
+
def assert_match_template_function(string)
|
68
|
+
assert_match(/function\s+#{Pug.config.name}\s*\(locals\)\s*\{.*\}/m, string)
|
69
|
+
end
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pug-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yaroslav Konoplov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Ruby wrapper for the Pug/Jade template engine.
|
42
|
+
email: eahome00@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- ".gitignore"
|
48
|
+
- ".travis.yml"
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- lib/jade-ruby/compile.rb
|
53
|
+
- lib/jade-ruby/config.rb
|
54
|
+
- lib/pug-ruby.rb
|
55
|
+
- lib/pug-ruby/compile.rb
|
56
|
+
- lib/pug-ruby/config.rb
|
57
|
+
- pug-ruby.gemspec
|
58
|
+
- test/jade/extends/index.jade
|
59
|
+
- test/jade/extends/layout.jade
|
60
|
+
- test/jade/includes/includes/footer.jade
|
61
|
+
- test/jade/includes/includes/header.jade
|
62
|
+
- test/jade/includes/index.jade
|
63
|
+
- test/jade/index.jade
|
64
|
+
- test/pug/extends/index.pug
|
65
|
+
- test/pug/extends/layout.pug
|
66
|
+
- test/pug/includes/includes/footer.pug
|
67
|
+
- test/pug/includes/includes/header.pug
|
68
|
+
- test/pug/includes/index.pug
|
69
|
+
- test/pug/index.pug
|
70
|
+
- test/test-jade.rb
|
71
|
+
- test/test-pug.rb
|
72
|
+
homepage: https://github.com/yivo/pug-ruby
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.5.1
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: Ruby wrapper for the Pug/Jade template engine.
|
96
|
+
test_files:
|
97
|
+
- test/jade/extends/index.jade
|
98
|
+
- test/jade/extends/layout.jade
|
99
|
+
- test/jade/includes/includes/footer.jade
|
100
|
+
- test/jade/includes/includes/header.jade
|
101
|
+
- test/jade/includes/index.jade
|
102
|
+
- test/jade/index.jade
|
103
|
+
- test/pug/extends/index.pug
|
104
|
+
- test/pug/extends/layout.pug
|
105
|
+
- test/pug/includes/includes/footer.pug
|
106
|
+
- test/pug/includes/includes/header.pug
|
107
|
+
- test/pug/includes/index.pug
|
108
|
+
- test/pug/index.pug
|
109
|
+
- test/test-jade.rb
|
110
|
+
- test/test-pug.rb
|