Class | Generators::HtmlFile |
In: |
lib/rdoc/generators/html_generator.rb
|
Parent: | ContextUser |
Handles the mapping of a file‘s information to HTML. In reality, a file corresponds to a TopLevel object, containing modules, classes, and top-level methods. In theory it could contain attributes and aliases, but we ignore these for now.
name | [R] | |
path | [R] |
# File lib/rdoc/generators/html_generator.rb, line 774 774: def initialize(context, options, file_dir) 775: super(context, options) 776: 777: @values = {} 778: 779: if options.all_one_file 780: @path = filename_to_label 781: else 782: @path = http_url(file_dir) 783: end 784: 785: @name = @context.file_relative_name 786: 787: collect_methods 788: AllReferences.add(name, self) 789: context.viewer = self 790: end
# File lib/rdoc/generators/html_generator.rb, line 891 891: def <=>(other) 892: self.name <=> other.name 893: end
# File lib/rdoc/generators/html_generator.rb, line 872 872: def file_attribute_values 873: full_path = @context.file_absolute_name 874: short_name = File.basename(full_path) 875: 876: @values["title"] = CGI.escapeHTML("File: #{short_name}") 877: 878: if @context.diagram 879: @values["diagram"] = diagram_reference(@context.diagram) 880: end 881: 882: @values["short_name"] = CGI.escapeHTML(short_name) 883: @values["full_path"] = CGI.escapeHTML(full_path) 884: @values["dtm_modified"] = @context.file_stat.mtime.to_s 885: 886: if @options.webcvs 887: @values["cvsurl"] = cvs_url( @options.webcvs, @values["full_path"] ) 888: end 889: end
# File lib/rdoc/generators/html_generator.rb, line 797 797: def filename_to_label 798: @context.file_relative_name.gsub(/%|\/|\?|\#/) {|s| '%' + ("%x" % s[0]) } 799: end
# File lib/rdoc/generators/html_generator.rb, line 792 792: def http_url(file_dir) 793: File.join(file_dir, @context.file_relative_name.tr('.', '_')) + 794: ".html" 795: end
# File lib/rdoc/generators/html_generator.rb, line 809 809: def value_hash 810: file_attribute_values 811: add_table_of_sections 812: 813: @values["charset"] = @options.charset 814: @values["href"] = path 815: @values["style_url"] = style_url(path, @options.css) 816: 817: if @context.comment 818: d = markup(@context.comment) 819: @values["description"] = d if d.size > 0 820: end 821: 822: ml = build_method_summary_list 823: @values["methods"] = ml unless ml.empty? 824: 825: il = build_include_list(@context) 826: @values["includes"] = il unless il.empty? 827: 828: rl = build_requires_list(@context) 829: @values["requires"] = rl unless rl.empty? 830: 831: if @options.promiscuous 832: file_context = nil 833: else 834: file_context = @context 835: end 836: 837: 838: @values["sections"] = @context.sections.map do |section| 839: 840: secdata = { 841: "sectitle" => section.title, 842: "secsequence" => section.sequence, 843: "seccomment" => markup(section.comment) 844: } 845: 846: cl = build_class_list(0, @context, section, file_context) 847: @values["classlist"] = cl unless cl.empty? 848: 849: mdl = build_method_detail_list(section) 850: secdata["method_list"] = mdl unless mdl.empty? 851: 852: al = build_alias_summary_list(section) 853: secdata["aliases"] = al unless al.empty? 854: 855: co = build_constants_summary_list(section) 856: @values["constants"] = co unless co.empty? 857: 858: secdata 859: end 860: 861: @values 862: end