dryml 1.1.0.pre0 → 1.1.0.pre2
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.
- data/Rakefile +1 -1
- data/lib/dryml/dryml_doc.rb +12 -3
- data/lib/dryml.rb +10 -4
- metadata +14 -6
data/Rakefile
CHANGED
@@ -39,7 +39,7 @@ Jeweler::Tasks.new do |gemspec|
|
|
39
39
|
gemspec.authors = ["Tom Locke"]
|
40
40
|
gemspec.rubyforge_project = "hobo"
|
41
41
|
gemspec.add_dependency("hobosupport", ["= #{Dryml::VERSION}"])
|
42
|
-
gemspec.add_dependency("actionpack", [">= 2.2.2"])
|
42
|
+
gemspec.add_dependency("actionpack", [">= 2.2.2", "< 3.0.0"])
|
43
43
|
end
|
44
44
|
Jeweler::GemcutterTasks.new
|
45
45
|
Jeweler::RubyforgeTasks.new do |rubyforge|
|
data/lib/dryml/dryml_doc.rb
CHANGED
@@ -32,15 +32,21 @@ require 'rexml/xpath'
|
|
32
32
|
|
33
33
|
def initialize(home, filename, name=nil)
|
34
34
|
@name = name || filename.sub(/.dryml$/, '')[home.length+1..-1]
|
35
|
+
@source = File.read(filename)
|
35
36
|
@doc = Dryml::Parser::Document.new(File.read(filename), filename)
|
36
37
|
parse_tag_defs
|
37
38
|
end
|
38
39
|
|
39
|
-
attr_reader :name, :doc, :tag_defs
|
40
|
+
attr_reader :name, :doc, :tag_defs, :source
|
40
41
|
|
41
42
|
def comment
|
42
43
|
first_node = doc[0][0]
|
43
|
-
|
44
|
+
if first_node.is_a?(REXML::Comment)
|
45
|
+
doc.restore_erb_scriptlets(first_node.to_s.strip)
|
46
|
+
elsif first_node.to_s.strip.starts_with?("[![DRYML-ERB")
|
47
|
+
text = doc.restore_erb_scriptlets(first_node.to_s.strip)
|
48
|
+
text.match(/<%#(.*?)%>/m)[1] rescue nil
|
49
|
+
end
|
44
50
|
end
|
45
51
|
|
46
52
|
include CommentMethods
|
@@ -77,7 +83,7 @@ require 'rexml/xpath'
|
|
77
83
|
doc.restore_erb_scriptlets(node.to_s).strip
|
78
84
|
end
|
79
85
|
|
80
|
-
# The contents of the XML comment, if any, immediately above the tag definition
|
86
|
+
# The contents of the XML or ERB comment, if any, immediately above the tag definition
|
81
87
|
def comment
|
82
88
|
@comment ||= begin
|
83
89
|
space = node.previous_sibling and
|
@@ -86,6 +92,9 @@ require 'rexml/xpath'
|
|
86
92
|
|
87
93
|
if comment_node.is_a?(REXML::Comment)
|
88
94
|
doc.restore_erb_scriptlets(comment_node.to_s.strip)
|
95
|
+
elsif space.to_s.strip.starts_with?("[![DRYML-ERB")
|
96
|
+
text = doc.restore_erb_scriptlets(space.to_s.strip)
|
97
|
+
text.match(/.*<%#(.*?)%>$/m)[1] rescue nil
|
89
98
|
end
|
90
99
|
end
|
91
100
|
end
|
data/lib/dryml.rb
CHANGED
@@ -11,7 +11,13 @@ require 'hobosupport'
|
|
11
11
|
require 'action_pack'
|
12
12
|
require 'active_record' if ActionPack::VERSION::MAJOR==2 && ActionPack::VERSION::MINOR==2
|
13
13
|
|
14
|
-
|
14
|
+
if ActiveSupport.const_defined? :Dependencies
|
15
|
+
if ActiveSupport::Dependencies.respond_to?(:autoload_paths)
|
16
|
+
ActiveSupport::Dependencies.autoload_paths |= [ File.dirname(__FILE__)]
|
17
|
+
else
|
18
|
+
ActiveSupport::Dependencies.load_paths |= [ File.dirname(__FILE__)]
|
19
|
+
end
|
20
|
+
end
|
15
21
|
|
16
22
|
# Hobo can be installed in /vendor/hobo, /vendor/plugins/hobo, vendor/plugins/hobo/hobo, etc.
|
17
23
|
::DRYML_ROOT = File.expand_path(File.dirname(__FILE__) + "/..")
|
@@ -19,7 +25,7 @@ ActiveSupport::Dependencies.load_paths |= [ File.dirname(__FILE__)] if ActiveSup
|
|
19
25
|
# The Don't Repeat Yourself Markup Language
|
20
26
|
module Dryml
|
21
27
|
|
22
|
-
VERSION = "1.1.0.
|
28
|
+
VERSION = "1.1.0.pre2"
|
23
29
|
|
24
30
|
class DrymlSyntaxError < RuntimeError; end
|
25
31
|
|
@@ -284,8 +290,8 @@ module Dryml
|
|
284
290
|
this = locals.delete(:this) || nil
|
285
291
|
|
286
292
|
renderer_class = Dryml::Template.build_cache[template_path]._?.environment ||
|
287
|
-
Dryml.make_renderer_class(template_src, template_path, locals.keys)
|
288
|
-
renderer_class.new(template_path, view).render_page(this, locals)
|
293
|
+
Dryml.make_renderer_class(template_src, template_path, locals.keys, [], included_taglibs)
|
294
|
+
renderer_class.new(template_path, view).render_page(this, locals)
|
289
295
|
end
|
290
296
|
|
291
297
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dryml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -1876988167
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.1.0.
|
10
|
+
- pre2
|
11
|
+
version: 1.1.0.pre2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Tom Locke
|
@@ -27,13 +27,13 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - "="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash: -
|
30
|
+
hash: -1876988167
|
31
31
|
segments:
|
32
32
|
- 1
|
33
33
|
- 1
|
34
34
|
- 0
|
35
|
-
-
|
36
|
-
version: 1.1.0.
|
35
|
+
- pre2
|
36
|
+
version: 1.1.0.pre2
|
37
37
|
type: :runtime
|
38
38
|
version_requirements: *id001
|
39
39
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +50,14 @@ dependencies:
|
|
50
50
|
- 2
|
51
51
|
- 2
|
52
52
|
version: 2.2.2
|
53
|
+
- - <
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 7
|
56
|
+
segments:
|
57
|
+
- 3
|
58
|
+
- 0
|
59
|
+
- 0
|
60
|
+
version: 3.0.0
|
53
61
|
type: :runtime
|
54
62
|
version_requirements: *id002
|
55
63
|
description:
|