Class: Textile2Signature
- Inherits:
-
Object
- Object
- Textile2Signature
- Defined in:
- lib/maruku/input_textile2/t2_parser.rb
Constant Summary
- Reg =
%r{ ^ # block name is 1 ([A-Za-z0-9]+)? # style is 2 ( \{ # open bracket ([^\}]+) # style spec is 3 \} # close bracket )? # language is 4 (\[(\w+)\])? # value is 5 # class and id (?: \( # open par (\w+)? # optional class specification is 6 (?:\#(\w+))? # optional id is 7 \) # close par )? # alignment is 8 (\<|\>|\<\>|\=)? # padding (\(+)? # left is 9 (\)+)? # right is 10 # filters is 11 (\| (?:(?:\w+)\|)+ )? # optional final dot is 12 (\.)? $ }x
Instance Attribute Summary (collapse)
-
- (Object) block_name
or nil.
-
- (Object) css_class
or nil.
-
- (Object) css_id
or nil.
-
- (Object) double_dot
nil or true.
-
- (Object) filters
nil [], array of strings.
-
- (Object) lang
or nil or nil.
-
- (Object) num_left_pad
nil or 1..
-
- (Object) num_right_pad
nil or 1..
-
- (Object) style
Returns the value of attribute style.
-
- (Object) text_align
'left', 'right', 'center', 'justified'.
Instance Method Summary (collapse)
-
- (Textile2Signature) initialize(s)
constructor
A new instance of Textile2Signature.
Constructor Details
- (Textile2Signature) initialize(s)
A new instance of Textile2Signature
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 55 def initialize(s) if m = Reg.match(s) self.block_name = m[1] self.style = m[3] self.lang = m[4] self.css_class = m[6] self.css_id = m[7] self.text_align = {nil=>nil,'>'=>'right','<'=>'left', '<>'=>'center','='=>'justified'}[m[8]] self.num_left_pad = m[9] && m[9].size self.num_right_pad = m[10] && m[10].size self.filters = m[11] && m[11].split('|') self.double_dot = m[12] && true end end |
Instance Attribute Details
- (Object) block_name
or nil
72 73 74 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 72 def block_name @block_name end |
- (Object) css_class
or nil
75 76 77 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 75 def css_class @css_class end |
- (Object) css_id
or nil
76 77 78 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 76 def css_id @css_id end |
- (Object) double_dot
nil or true
81 82 83 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 81 def double_dot @double_dot end |
- (Object) filters
nil [], array of strings
80 81 82 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 80 def filters @filters end |
- (Object) lang
or nil or nil
74 75 76 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 74 def lang @lang end |
- (Object) num_left_pad
nil or 1..
78 79 80 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 78 def num_left_pad @num_left_pad end |
- (Object) num_right_pad
nil or 1..
79 80 81 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 79 def num_right_pad @num_right_pad end |
- (Object) style
Returns the value of attribute style
73 74 75 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 73 def style @style end |
- (Object) text_align
'left', 'right', 'center', 'justified'
77 78 79 |
# File 'lib/maruku/input_textile2/t2_parser.rb', line 77 def text_align @text_align end |