Remarkably 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/remarkably.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
module Remarkably
|
2
2
|
|
3
|
-
|
4
|
-
@@default_engine = nil
|
3
|
+
module Config
|
5
4
|
class << self
|
6
|
-
|
7
|
-
@@default_engine
|
8
|
-
end
|
9
|
-
def default_engine= engine
|
10
|
-
@@default_engine = engine
|
11
|
-
end
|
5
|
+
attr_accessor :default_engine
|
12
6
|
end
|
13
7
|
end
|
14
8
|
|
@@ -1,14 +1,16 @@
|
|
1
|
-
require
|
1
|
+
require 'remarkably'
|
2
2
|
|
3
3
|
module Remarkably
|
4
4
|
module Engines
|
5
5
|
class CSS < Base::Engine
|
6
6
|
def method! sym, args, hash, &block
|
7
7
|
sym = sym.to_s.downcase
|
8
|
+
sym = "##{sym}".chop if sym[-1].chr == '!'
|
9
|
+
sym = ".#{sym}".chop if sym[-1].chr == '?'
|
8
10
|
|
9
11
|
if block_given?
|
10
12
|
current_prefix = @css_prefix
|
11
|
-
@css_prefix = (@css_prefix+"
|
13
|
+
@css_prefix = (@css_prefix+"#{sym}#{args.map{|a|a.to_s}.join} ")
|
12
14
|
@css_depth+=1
|
13
15
|
@css_prefix_rendered=false
|
14
16
|
block.call
|
@@ -20,7 +22,7 @@ module Remarkably
|
|
20
22
|
@output.chop!
|
21
23
|
@output << "}"
|
22
24
|
end
|
23
|
-
@output << "\n#{@css_prefix}
|
25
|
+
@output << "\n#{@css_prefix}{"
|
24
26
|
@css_prefix_rendered = true
|
25
27
|
@css_first_use = false
|
26
28
|
end
|
@@ -29,6 +31,25 @@ module Remarkably
|
|
29
31
|
self
|
30
32
|
end
|
31
33
|
|
34
|
+
def css_prefix prefix, &block
|
35
|
+
@css_prefix << prefix
|
36
|
+
block.call
|
37
|
+
@css_prefix.chop!
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def css_class args, hash, &block
|
42
|
+
css_prefix ".", &block
|
43
|
+
end
|
44
|
+
|
45
|
+
def css_id args, hash, &block
|
46
|
+
css_prefix "#", &block
|
47
|
+
end
|
48
|
+
|
49
|
+
def css_pseudo args, hash, &block
|
50
|
+
css_prefix ":", &block
|
51
|
+
end
|
52
|
+
|
32
53
|
def to_s
|
33
54
|
"#{super.chop}}".strip+"\n"
|
34
55
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'remarkably'
|
2
|
+
require 'remarkably/engines/xml'
|
3
|
+
require 'remarkably/engines/css'
|
4
4
|
|
5
5
|
module Remarkably
|
6
6
|
module Engines
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: Remarkably
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2007-05-
|
6
|
+
version: 0.5.2
|
7
|
+
date: 2007-05-26 00:00:00 +02:00
|
8
8
|
summary: Remarkably is a very tiny Markaby-like XML builder
|
9
9
|
require_paths:
|
10
10
|
- lib
|