Class: SiSU_XML_Scaffold_Structure_Collapse::Source::Scroll
- Inherits:
-
SiSU_XML_Scaffold_Structure_Collapse::Source
- Object
- SiSU_XML_Scaffold_Structure_Collapse::Source
- SiSU_XML_Scaffold_Structure_Collapse::Source::Scroll
- Defined in:
- lib/sisu/xml_scaffold_structure_collapsed.rb
Instance Method Summary collapse
-
#collapsed ⇒ Object
collapsed –>.
- #docbook ⇒ Object
- #fictionbook ⇒ Object
-
#initialize(data = '', md = '') ⇒ Scroll
constructor
A new instance of Scroll.
- #output(o, lev = nil, comment = '') ⇒ Object
- #songsheet ⇒ Object
- #structure_build_collapsed(data) ⇒ Object
- #structure_build_tag_close(lev, h) ⇒ Object
- #structure_collapsed(data) ⇒ Object
- #tags ⇒ Object
Methods inherited from SiSU_XML_Scaffold_Structure_Collapse::Source
Constructor Details
#initialize(data = '', md = '') ⇒ Scroll
Returns a new instance of Scroll.
84 85 86 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 84 def initialize(data='',md='') @data,@md=data,md end |
Instance Method Details
#collapsed ⇒ Object
collapsed –>
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 97 def collapsed [ '0', '1', '2', '3', '4', '5', '6' ] end |
#docbook ⇒ Object
107 108 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 107 def docbook end |
#fictionbook ⇒ Object
109 110 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 109 def fictionbook end |
#output(o, lev = nil, comment = '') ⇒ Object
113 114 115 116 117 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 113 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 ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 87 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) ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 126 def structure_build_collapsed(data) @s=.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) ⇒ Object
141 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 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 141 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) ⇒ Object
118 119 120 121 122 123 124 125 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 118 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 ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/sisu/xml_scaffold_structure_collapsed.rb', line 95 def # collapsed --> def collapsed [ '0', '1', '2', '3', '4', '5', '6' ] end def docbook end def fictionbook end self end |