dryml 2.0.0.pre3 → 2.0.0.pre4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.pre3
1
+ 2.0.0.pre4
@@ -88,6 +88,16 @@ require 'rexml/xpath'
88
88
  doc.restore_erb_scriptlets(node.to_s).strip
89
89
  end
90
90
 
91
+ def filename
92
+ @filename ||= begin
93
+ page = node.parent
94
+ while page.name != 'dryml_page' do
95
+ page = node.parent
96
+ end
97
+ page.attributes['path']
98
+ end
99
+ end
100
+
91
101
  # The contents of the XML or ERB comment, if any, immediately above the tag definition
92
102
  def comment
93
103
  @comment ||= begin
@@ -18,7 +18,7 @@ module Dryml
18
18
  end
19
19
 
20
20
 
21
- @reference_src = "<dryml_page>" + source + "</dryml_page>"
21
+ @reference_src = "<dryml_page path=\"#{ERB::Util.html_escape path}\">" + source + "</dryml_page>"
22
22
  rex_src = Dryml::Parser::Source.new(@reference_src)
23
23
 
24
24
  @elements = Dryml::Parser::Elements.new(self)
@@ -115,11 +115,17 @@ module Dryml
115
115
  attributes
116
116
  end
117
117
 
118
-
119
118
  def add_classes(attributes, *classes)
120
119
  add_classes!(HashWithIndifferentAccess.new(attributes), classes)
121
120
  end
122
121
 
122
+ def remove_classes!(attributes, *remove_classes)
123
+ if attributes[:class]
124
+ attributes[:class] = (attributes[:class].split - remove_classes).join(' ')
125
+ end
126
+ attributes
127
+ end
128
+
123
129
  def add_data_rapid!(attrs, tag, options)
124
130
  data_rapid = ActiveSupport::JSON.decode(attrs["data_rapid"] || "{}")
125
131
  attrs["data_rapid"] = data_rapid.update(tag => options).to_json
@@ -136,6 +142,7 @@ module Dryml
136
142
  attrs = attrs.with_indifferent_access unless attrs.is_a?(HashWithIndifferentAccess)
137
143
  classes = overriding_attrs[:class]
138
144
  add_classes!(attrs, *classes.split) if classes
145
+ remove_classes!(attrs, *(overriding_attrs[:remove_class].split)) if overriding_attrs[:remove_class]
139
146
  if (data_rapid = overriding_attrs["data_rapid"])
140
147
  attrs["data_rapid"]=ActiveSupport::JSON.decode(attrs["data_rapid"] || "{}").
141
148
  update(ActiveSupport::JSON.decode(data_rapid)).to_json
data/lib/dryml.rb CHANGED
@@ -17,7 +17,7 @@ module Dryml
17
17
  VERSION = File.read(File.expand_path('../../VERSION', __FILE__)).strip
18
18
  @@root = Pathname.new File.expand_path('../..', __FILE__)
19
19
  def self.root; @@root; end
20
- EDIT_LINK_BASE = "https://github.com/tablatom/hobo/edit/master/dryml"
20
+ EDIT_LINK_BASE = "https://github.com/Hobo/hobodoc/edit/master/dryml"
21
21
 
22
22
  class DrymlSyntaxError < RuntimeError; end
23
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dryml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre3
4
+ version: 2.0.0.pre4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-26 00:00:00.000000000 Z
12
+ date: 2012-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - '='
36
36
  - !ruby/object:Gem::Version
37
- version: 2.0.0.pre3
37
+ version: 2.0.0.pre4
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - '='
44
44
  - !ruby/object:Gem::Version
45
- version: 2.0.0.pre3
45
+ version: 2.0.0.pre4
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rubydoctest
48
48
  requirement: !ruby/object:Gem::Requirement