Class: Generators::HTMLPuppetNode
Instance Attribute Summary collapse
Instance Method Summary
collapse
#build_resource_detail_list, #build_resource_summary_list, #collect_resources
#build_referenced_list
Constructor Details
#initialize(context, html_file, prefix, options) ⇒ HTMLPuppetNode
Returns a new instance of HTMLPuppetNode.
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 461
def initialize(context, html_file, prefix, options)
super(context, options)
@html_file = html_file
@is_module = context.is_module?
@values = {}
context.viewer = self
if options.all_one_file
@path = context.full_name
else
@path = http_url(context.full_name, prefix)
end
AllReferences.add("NODE(#{@context.full_name})", self)
end
|
Instance Attribute Details
Returns the value of attribute path.
459
460
461
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 459
def path
@path
end
|
Instance Method Details
#<=>(other) ⇒ Object
646
647
648
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 646
def <=>(other)
self.name <=> other.name
end
|
#build_attribute_list(section) ⇒ Object
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 570
def build_attribute_list(section)
atts = @context.attributes.sort
res = []
atts.each do |att|
next unless att.section == section
if att.visibility == :public || att.visibility == :protected || @options.show_all
entry = {
"name" => CGI.escapeHTML(att.name),
"rw" => att.rw,
"a_desc" => markup(att., true)
}
unless att.visibility == :public || att.visibility == :protected
entry["rw"] << "-"
end
res << entry
end
end
res
end
|
#build_child_list(context) ⇒ Object
642
643
644
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 642
def build_child_list(context)
build_referenced_list(context.childs)
end
|
#build_realize_list(context) ⇒ Object
638
639
640
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 638
def build_realize_list(context)
build_referenced_list(context.realizes)
end
|
#build_require_list(context) ⇒ Object
634
635
636
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 634
def build_require_list(context)
build_referenced_list(context.requires)
end
|
#class_attribute_values ⇒ Object
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 590
def class_attribute_values
h_name = CGI.escapeHTML(name)
@values["classmod"] = "Node"
@values["title"] = CGI.escapeHTML("#{@values['classmod']}: #{h_name}")
c = @context
c = c.parent while c and !c.diagram
@values["diagram"] = diagram_reference(c.diagram) if c && c.diagram
@values["full_name"] = h_name
parent_class = @context.superclass
if parent_class
@values["parent"] = CGI.escapeHTML(parent_class)
if parent_name
lookup = parent_name + "::#{parent_class}"
else
lookup = parent_class
end
lookup = "NODE(#{lookup})"
parent_url = AllReferences[lookup] || AllReferences[parent_class]
@values["par_url"] = aref_to(parent_url.path) if parent_url and parent_url.document_self
end
files = []
@context.in_files.each do |f|
res = {}
full_path = CGI.escapeHTML(f.file_absolute_name)
res["full_path"] = full_path
res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
res["cvsurl"] = cvs_url( @options.webcvs, full_path ) if @options.webcvs
files << res
end
@values['infiles'] = files
end
|
#http_url(full_name, prefix) ⇒ Object
return the relative file name to store this class in, which is also its url
485
486
487
488
489
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 485
def http_url(full_name, prefix)
path = full_name.dup
path.gsub!(/<<\s*(\w*)/) { "from-#$1" } if path['<<']
File.join(prefix, path.split("::").collect { |p| Digest::MD5.hexdigest(p) }) + ".html"
end
|
#index_name ⇒ Object
495
496
497
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 495
def index_name
name
end
|
479
480
481
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 479
def name
@context.name
end
|
#parent_name ⇒ Object
491
492
493
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 491
def parent_name
@context.parent.full_name
end
|
#value_hash ⇒ Object
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 510
def value_hash
class_attribute_values
add_table_of_sections
@values["charset"] = @options.charset
@values["style_url"] = style_url(path, @options.css)
d = markup(@context.)
@values["description"] = d unless d.empty?
ml = build_method_summary_list
@values["methods"] = ml unless ml.empty?
rl = build_resource_summary_list
@values["resources"] = rl unless rl.empty?
il = build_include_list(@context)
@values["includes"] = il unless il.empty?
rl = build_require_list(@context)
@values["requires"] = rl unless rl.empty?
rl = build_realize_list(@context)
@values["realizes"] = rl unless rl.empty?
cl = build_child_list(@context)
@values["childs"] = cl unless cl.empty?
@values["sections"] = @context.sections.map do |section|
secdata = {
"sectitle" => section.title,
"secsequence" => section.sequence,
"seccomment" => markup(section.)
}
al = build_alias_summary_list(section)
secdata["aliases"] = al unless al.empty?
co = build_constants_summary_list(section)
secdata["constants"] = co unless co.empty?
al = build_attribute_list(section)
secdata["attributes"] = al unless al.empty?
cl = build_class_list(0, @context, section)
secdata["classlist"] = cl unless cl.empty?
mdl = build_method_detail_list(section)
secdata["method_list"] = mdl unless mdl.empty?
rdl = build_resource_detail_list(section)
secdata["resource_list"] = rdl unless rdl.empty?
secdata
end
@values
end
|
#write_on(f) ⇒ Object
499
500
501
502
503
504
505
506
507
508
|
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 499
def write_on(f)
value_hash
template = TemplatePage.new(
RDoc::Page::BODYINC,
RDoc::Page::NODE_PAGE,
RDoc::Page::METHOD_LIST)
template.write_html_on(f, @values)
end
|