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.



82
83
84
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 82

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

Instance Method Details

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



114
115
116
117
118
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 114

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



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

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

#songsheetObject



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

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



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

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



142
143
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
# File 'lib/sisu/xml_scaffold_structure_sisu.rb', line 142

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



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

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



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

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