Class: Erbside::SGML

Inherits:
Inline show all
Defined in:
lib/erbside/inline/sgml.rb

Overview

XML and HTML

Constant Summary collapse

EXTENSIONS =
%w{ .html .xml }

Constants inherited from Inline

Inline::TAG

Instance Attribute Summary

Attributes inherited from Inline

#context, #file, #result, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Inline

#changed?, #content, #exist?, extension_list, factory, #format_block, #format_side, inherited, #initialize, map, #output, register, #relative_output, #remarker_multiline, #render, #render_blocks, #render_result, #render_sides, #render_template, #save

Constructor Details

This class inherits a constructor from Erbside::Inline

Class Method Details

.extensionsObject



11
12
13
# File 'lib/erbside/inline/sgml.rb', line 11

def self.extensions
  EXTENSIONS
end

Instance Method Details

#block_matchObject



37
38
39
40
41
# File 'lib/erbside/inline/sgml.rb', line 37

def block_match
  b = Regexp.escape(remarker_block_begin)
  e = Regexp.escape(remarker_block_end)
  %r{^(\s*)(#{b})(\s*)(:#{TAG})(\+\d*)?(\:)(\s*)((?m:.*?))(\s#{e})}
end

#block_parts(match_data) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/erbside/inline/sgml.rb', line 44

def block_parts(match_data)
  { :indent   => match_data[1],
    :pad      => match_data[3],
    :count    => match_data[5],
    :space    => match_data[7],
    :template => match_data[8],
    :tail     => match_data[9]
  }
end

#line_matchObject



31
32
33
34
# File 'lib/erbside/inline/sgml.rb', line 31

def line_match
  rem = Regexp.escape(remarker)
  /^(\ *)(.*?)(\ *)(#{rem})(\ *)(:#{TAG})()?(:)(.*?\S.*?)(-->)$/
end

#remarkerObject



16
17
18
# File 'lib/erbside/inline/sgml.rb', line 16

def remarker
  '<!--'
end

#remarker_block_beginObject



21
22
23
# File 'lib/erbside/inline/sgml.rb', line 21

def remarker_block_begin
  '<!--'
end

#remarker_block_endObject



26
27
28
# File 'lib/erbside/inline/sgml.rb', line 26

def remarker_block_end
  '-->'
end