Class: SiSU_XML_Scaffold_Structure_Sisu::Source::Scroll

Inherits:
SiSU_XML_Scaffold_Structure_Sisu::Source show all
Defined in:
lib/sisu/xml_scaffold_structure_sisu.rb

Instance Method Summary collapse

Methods inherited from SiSU_XML_Scaffold_Structure_Sisu::Source

#read, #spaces

Constructor Details

#initialize(data = '', md = '') ⇒ Scroll

Returns a new instance of Scroll.



84
85
86
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 84

def initialize(data='',md='')
  @data,@md=data,md
end

Instance Method Details

#output(o, lev = nil, comment = '') ⇒ Object



116
117
118
119
120
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 116

def output(o,lev=nil,comment='')
   puts lev == (0..6) \
   ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
   : "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
end

#sisuObject



96
97
98
99
100
101
102
103
104
105
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 96

def sisu
  [ '0',
    'A',
    'B',
    'C',
    '1',
    '2',
    '3'
  ]
end

#songsheetObject



87
88
89
90
91
92
93
94
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 87

def songsheet
  @t='sisu'
  data=@data
  if @md.opt.act[:verbose_plus][:set]==:on
    structure_sisu_simple(data)
  end
  structure_build_sisu(data)
end

#structure_build_sisu(data) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 121

def structure_build_sisu(data)
  @s=tags.sisu
  puts "\nXML [#{@t} type] structure outline --->\n\n"
  h=[0,false,false,false]
  puts "<#{@s[0]}>"
  data.each_with_index do |o,i|
    if  (o.is ==:heading || o.is ==:heading_insert)
      structure_build_tag_close(o.ln,h)
      puts "#{spaces*o.ln}<#{@s[o.ln]}>\n#{spaces*o.ln}  [#{o.ocn}] #{o.ln} {#{o.node}}"
      case o.ln
      when 1
        h=[o.ln,true,false,false]
      when 2
        h=[o.ln,true,true,false]
      when 3
        h=[o.ln,true,true,true]
      when 4..6
        h[0]=o.ln
      end
    end
  end
  structure_build_tag_close(0,h)
end

#structure_build_tag_close(lev, h) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 144

def structure_build_tag_close(lev,h)
  case h[0]
  when 1
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
    puts "</#{@s[0]}>"         if (lev==0)
  when 2
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
    puts "</#{@s[0]}>"         if (lev==0)
  when 3
    puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
    puts "</#{@s[0]}>"         if (lev==0)
  when 4
    puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
    puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
    puts "</#{@s[0]}>"         if (lev==0)
  when 5
    puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
    puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
    puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
    puts "</#{@s[0]}>"         if (lev==0)
  when 6
    puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
    puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
    puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
    puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
    puts "</#{@s[0]}>"         if (lev==0)
  end
end

#structure_sisu_simple(data) ⇒ Object



108
109
110
111
112
113
114
115
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 108

def structure_sisu_simple(data)
  puts "\nsisu structure, heading outline --->\n\n"
  data.each_with_index do |o,i|
    if  (o.is ==:heading || o.is ==:heading_insert)
      puts "#{spaces*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}</#{tags.sisu[o.ln]}>"
    end
  end
end

#tagsObject



95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 95

def tags
  def sisu
    [ '0',
      'A',
      'B',
      'C',
      '1',
      '2',
      '3'
    ]
  end
  self
end