class SiSU_XML_Scaffold_Structure_Collapse::Source::Scroll

Public Class Methods

new(data='',md='') click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 82
def initialize(data='',md='')
  @data,@md=data,md
end

Public Instance Methods

collapsed() click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 95
def collapsed
  [ '0',
    '1',
    '2',
    '3',
    '4',
    '5',
    '6'
  ]
end
docbook() click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 105
def docbook
end
fictionbook() click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 107
def fictionbook
end
output(o,lev=nil,comment='') click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 111
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
songsheet() click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 85
def songsheet
  @t='sisu'
  data=@data
  if @md.opt.act[:verbose_plus][:set]==:on
    structure_collapsed(data)
  end
  structure_build_collapsed(data)
end
structure_build_collapsed(data) click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 124
def structure_build_collapsed(data)
  @s=tags.collapsed
  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)
      lev=o.lc
      structure_build_tag_close(lev,h)
      puts "#{spaces*lev}<#{@s[lev]}>\n#{spaces*lev}  [#{o.ocn}] #{lev} {#{o.node}}"
      h[0]=lev
    end
  end
  structure_build_tag_close(0,h)
end
structure_build_tag_close(lev,h) click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 139
def structure_build_tag_close(lev,h)
  case h[0]
  when 1
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
    puts "</#{@s[0]}>"         if (lev==0)
  when 2
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
    puts "</#{@s[0]}>"         if (lev==0)
  when 3
    puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 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)
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 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)
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 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)
    puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
    puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
    puts "</#{@s[0]}>"         if (lev==0)
  end
end
structure_collapsed(data) click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 116
def structure_collapsed(data)
  puts "\ncollapsed structure, heading outline --->\n\n"
  data.each_with_index do |o,i|
    if  (o.is ==:heading || o.is ==:heading_insert)
      output(o,o.lc)
    end
  end
end
tags() click to toggle source
# File lib/sisu/xml_scaffold_structure_collapsed.rb, line 93
def tags
  # collapsed -->
  def collapsed
    [ '0',
      '1',
      '2',
      '3',
      '4',
      '5',
      '6'
    ]
  end
  def docbook
  end
  def fictionbook
  end
  self
end