opulent 1.7.6 → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b59b4c5e2bf15d9811ed9d884408670ba01ea886
4
- data.tar.gz: 1b5bfb6dc4b4ab45977b927c25ffb8da14f0890c
3
+ metadata.gz: a6c5d6d50befc28fa099ba8dc76859816d590fc4
4
+ data.tar.gz: 05e2764b0e1aeb3e7f457769bf4f883805a37e79
5
5
  SHA512:
6
- metadata.gz: cb0efc02944e95e2f92d07679b5d4d626ed535c5e860e65f4430c2e0cd21b01080069093541ddcfac5f1be236480564b7705b8da57baf2860c24cf24e905c177
7
- data.tar.gz: 2e16fb13de65c3914eb51bc7424f84b20a98c8d16dedf954d35d3d9ec2b80801122e6630a9d5e692a73affc8b195c9dee136b64dda8be0df9290fc67b89f5a8c
6
+ metadata.gz: 48cdc428d01132ce3fb26d0823701a10bd5f3a9aa3816c00774c87a434674eae6627c0c4395b0e5d5617576841cc69e3995f5ffab03d2a8abd8eefb981045162
7
+ data.tar.gz: 9e977e449021c5dc7c3ab9099b512445ab611f5b26b08c33767215f31dd9af79b99e64fbcafb65be122284cd328bb27de6417e481c8a3c5e9eb1c9ee09ca29ce
@@ -9,7 +9,7 @@ require 'benchmark'
9
9
  require 'benchmark/ips'
10
10
 
11
11
  require 'tilt'
12
- require '../lib/opulent'
12
+ require_relative '../lib/opulent'
13
13
  require 'erubis'
14
14
  require 'erb'
15
15
  require 'haml'
@@ -332,7 +332,7 @@ module Opulent
332
332
  if escape
333
333
  buffer code
334
334
  else
335
- buffer_escape code[1..-2]
335
+ buffer_escape code
336
336
  end
337
337
  when /\A([\\#]?[^#\\]*([#\\][^\\#\{][^#\\]*)*)/
338
338
  string_remaining = $'
@@ -340,7 +340,7 @@ module Opulent
340
340
 
341
341
  # Static text
342
342
  if escape && string_current =~ Utils::ESCAPE_HTML_PATTERN
343
- buffer_escape "\'#{string_current}\'"
343
+ buffer_escape "\"#{string_current.gsub '"', '\"'}\""
344
344
  else
345
345
  buffer_freeze string_current
346
346
  end
@@ -67,8 +67,14 @@ module Opulent
67
67
  end
68
68
 
69
69
  # Set input local variables in current scope
70
- locals.each do |key, value|
71
- scope.local_variable_set key, value
70
+ if RUBY_VERSION.start_with?('1.9', '2.0')
71
+ locals.each do |key, value|
72
+ eval "#{key} = #{value.inspect}", scope
73
+ end
74
+ else
75
+ locals.each do |key, value|
76
+ scope.local_variable_set key, value
77
+ end
72
78
  end
73
79
 
74
80
  # Evaluate the template in the given scope (context)
@@ -55,7 +55,7 @@ module Opulent
55
55
  #
56
56
  def parse(code)
57
57
  # Split the code into lines and parse them one by one
58
- @code = code.lines
58
+ @code = code.lines.to_a
59
59
 
60
60
  # Current line index
61
61
  @i = -1
@@ -110,7 +110,7 @@ module Opulent
110
110
  end
111
111
 
112
112
  # Apply definitions to each case of the control node
113
- if %i(if unless case).include? node[@type]
113
+ if [:if, :unless, :case].include? node[@type]
114
114
  node[@children].each do |array|
115
115
  process_definitions[array]
116
116
  end
@@ -6,7 +6,7 @@ module Opulent
6
6
  BUFFER = :@_opulent_buffer
7
7
 
8
8
  # Default Opulent file extension
9
- FILE_EXTENSION = '.op'
9
+ FILE_EXTENSION = '.op'.freeze
10
10
 
11
11
  # Default yield target which is used for child block replacements
12
12
  DEFAULT_EACH_KEY = :key
@@ -15,19 +15,20 @@ module Opulent
15
15
  DEFAULT_EACH_VALUE = :value
16
16
 
17
17
  # List of self enclosing node elements
18
- SELF_ENCLOSING = %i(
19
- img link input meta br hr area base col command embed keygen param source
20
- track wbr
21
- )
18
+ SELF_ENCLOSING = [
19
+ :img, :link, :input, :meta, :br, :hr, :area, :base, :col, :command,
20
+ :embed, :keygen, :param, :source, :track, :wbr
21
+ ].freeze
22
22
 
23
23
  # List of inline node parents which can be either inline or have complex
24
24
  # structures inside of them, such as anchor tags
25
- MULTI_NODE = %i(a)
25
+ MULTI_NODE = [:a].freeze
26
26
 
27
27
  # List of inline node names
28
- INLINE_NODE = %i(
29
- text a span strong em br i b small label sub sup abbr var code kbd
30
- )
28
+ INLINE_NODE = [
29
+ :text, :a, :span, :strong, :em, :br, :i, :b, :small, :label, :sub, :sup,
30
+ :abbr, :var, :code, :kbd
31
+ ].freeze
31
32
 
32
33
  # Check whether text should or shouldn't be evaluated
33
34
  INTERPOLATION_CHECK = /(?<!\\)\#\{.*\}/
@@ -46,11 +47,10 @@ module Opulent
46
47
  :'.' => :class,
47
48
  :'#' => :id,
48
49
  :'&' => :name
49
- }
50
+ }.freeze
50
51
 
51
52
  # Opulent runtime settings
52
53
  DEFAULTS = {
53
- # dependency_manager: true, # Soon to be implemented
54
54
  indent: 2,
55
55
  layouts: false,
56
56
  pretty: false,
@@ -16,6 +16,7 @@ module Opulent
16
16
  #
17
17
  def prepare
18
18
  # Set up the rendering engine
19
+ @options[:file] = eval_file
19
20
  @engine = ::Opulent.new @data, @options
20
21
  end
21
22
 
@@ -1,9 +1,10 @@
1
1
  # @Opulent
2
2
  module Opulent
3
3
  # Opulent KEYWORDS
4
- KEYWORDS = %i(
5
- def yield include if else elsif unless case when each while until doctype
6
- )
4
+ KEYWORDS = [
5
+ :def, :yield, :include, :if, :else, :elsif, :unless, :case, :when, :each,
6
+ :while, :until, :doctype
7
+ ].freeze
7
8
 
8
9
  # @Tokens
9
10
  class Tokens
@@ -1,4 +1,4 @@
1
1
  # @Opulent
2
2
  module Opulent
3
- VERSION = '1.7.6'
3
+ VERSION = '1.7.7'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opulent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.6
4
+ version: 1.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Grozav