| Class | Generators::HtmlClass |
| In: |
generators/html_generator.rb
|
| Parent: | ContextUser |
Wrap a ClassModule context
| path | [R] |
# File generators/html_generator.rb, line 633
633: def initialize(context, html_file, prefix, options)
634: super(context, options)
635:
636: @html_file = html_file
637: @is_module = context.is_module?
638: @values = {}
639:
640: context.viewer = self
641:
642: if options.all_one_file
643: @path = context.full_name
644: else
645: @path = http_url(context.full_name, prefix)
646: end
647:
648: collect_methods
649:
650: AllReferences.add(name, self)
651: end
# File generators/html_generator.rb, line 799
799: def <=>(other)
800: self.name <=> other.name
801: end
# File generators/html_generator.rb, line 729
729: def build_attribute_list(section)
730: atts = @context.attributes.sort
731: res = []
732: atts.each do |att|
733: next unless att.section == section
734: if att.visibility == :public || att.visibility == :protected || @options.show_all
735: entry = {
736: "name" => CGI.escapeHTML(att.name),
737: "rw" => att.rw,
738: "a_desc" => markup(att.comment, true)
739: }
740: unless att.visibility == :public || att.visibility == :protected
741: entry["rw"] << "-"
742: end
743: res << entry
744: end
745: end
746: res
747: end
# File generators/html_generator.rb, line 749
749: def class_attribute_values
750: h_name = CGI.escapeHTML(name)
751:
752: @values["classmod"] = @is_module ? "Module" : "Class"
753: @values["title"] = "#{@values['classmod']}: #{h_name}"
754:
755: c = @context
756: c = c.parent while c and !c.diagram
757: if c && c.diagram
758: @values["diagram"] = diagram_reference(c.diagram)
759: end
760:
761: @values["full_name"] = h_name
762:
763: parent_class = @context.superclass
764:
765: if parent_class
766: @values["parent"] = CGI.escapeHTML(parent_class)
767:
768: if parent_name
769: lookup = parent_name + "::" + parent_class
770: else
771: lookup = parent_class
772: end
773:
774: parent_url = AllReferences[lookup] || AllReferences[parent_class]
775:
776: if parent_url and parent_url.document_self
777: @values["par_url"] = aref_to(parent_url.path)
778: end
779: end
780:
781: files = []
782: @context.in_files.each do |f|
783: res = {}
784: full_path = CGI.escapeHTML(f.file_absolute_name)
785:
786: res["full_path"] = full_path
787: res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
788:
789: if @options.webcvs
790: res["cvsurl"] = cvs_url( @options.webcvs, full_path )
791: end
792:
793: files << res
794: end
795:
796: @values['infiles'] = files
797: end
return the relative file name to store this class in, which is also its url
# File generators/html_generator.rb, line 655
655: def http_url(full_name, prefix)
656: path = full_name.dup
657: if path['<<']
658: path.gsub!(/<<\s*(\w*)/) { "from-#$1" }
659: end
660: File.join(prefix, path.split("::")) + ".html"
661: end
# File generators/html_generator.rb, line 668
668: def parent_name
669: @context.parent.full_name
670: end
# File generators/html_generator.rb, line 684
684: def value_hash
685: class_attribute_values
686: add_table_of_sections
687:
688: @values["charset"] = @options.charset
689: @values["style_url"] = style_url(path, @options.css)
690:
691: d = markup(@context.comment)
692: @values["description"] = d unless d.empty?
693:
694: ml = build_method_summary_list
695: @values["methods"] = ml unless ml.empty?
696:
697: il = build_include_list(@context)
698: @values["includes"] = il unless il.empty?
699:
700: @values["sections"] = @context.sections.map do |section|
701:
702: secdata = {
703: "sectitle" => section.title,
704: "secsequence" => section.sequence,
705: "seccomment" => markup(section.comment)
706: }
707:
708: al = build_alias_summary_list(section)
709: secdata["aliases"] = al unless al.empty?
710:
711: co = build_constants_summary_list(section)
712: secdata["constants"] = co unless co.empty?
713:
714: al = build_attribute_list(section)
715: secdata["attributes"] = al unless al.empty?
716:
717: cl = build_class_list(0, @context, section)
718: secdata["classlist"] = cl unless cl.empty?
719:
720: mdl = build_method_detail_list(section)
721: secdata["method_list"] = mdl unless mdl.empty?
722:
723: secdata
724: end
725:
726: @values
727: end