Class: SiSU_HTML::Source::LinksGuide

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/html.rb

Direct Known Subclasses

Toc

Instance Method Summary collapse

Constructor Details

#initialize(data, md) ⇒ LinksGuide

Returns a new instance of LinksGuide.



190
191
192
193
# File 'lib/sisu/html.rb', line 190

def initialize(data,md)
  @data,@md=data,md
  @links_guide_=SiSU_Env::CreateSite.new(@md.opt).html_quick_ref?
end

Instance Method Details

#tocObject



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/sisu/html.rb', line 194

def toc
  @links_guide_toc=[]
  if @links_guide_
    format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
    guide_type='horzontal' #values: horizontal or vertical
    @links_guide_toc << format_head_toc.links_guide_open(guide_type)
    if defined? @md.lnk \
    and @md.lnk
      @md.lnk.each do |l|
        if defined? l[:say]
          target=(l[:url] !~/^\.(\.)?\//) \
          ? 'external'
          : '_top'
          s_lnk_url,s_lnk_lnk=l[:url],l[:say]
          txt_obj={
            lnk_url: s_lnk_url,
            lnk_txt: s_lnk_lnk,
            target: target,
          }
          lev_dob_ocn=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
          @links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk
        end
      end
    end
    format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)
    @links_guide_toc << format_head_toc.links_guide_close #(guide_type)
    @links_guide_toc
  else ''
  end
end