Class | Generators::HtmlFile |
In: |
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 generators/html_generator.rb, line 818 818: def initialize(context, options, file_dir) 819: super(context, options) 820: 821: @values = {} 822: 823: if options.all_one_file 824: @path = filename_to_label 825: else 826: @path = http_url(file_dir) 827: end 828: 829: @name = @context.file_relative_name 830: 831: collect_methods 832: AllReferences.add(name, self) 833: context.viewer = self 834: end
# File generators/html_generator.rb, line 935 935: def <=>(other) 936: self.name <=> other.name 937: end
# File generators/html_generator.rb, line 916 916: def file_attribute_values 917: full_path = @context.file_absolute_name 918: short_name = File.basename(full_path) 919: 920: @values["title"] = CGI.escapeHTML("File: #{short_name}") 921: 922: if @context.diagram 923: @values["diagram"] = diagram_reference(@context.diagram) 924: end 925: 926: @values["short_name"] = CGI.escapeHTML(short_name) 927: @values["full_path"] = CGI.escapeHTML(full_path) 928: @values["dtm_modified"] = @context.file_stat.mtime.to_s 929: 930: if @options.webcvs 931: @values["cvsurl"] = cvs_url( @options.webcvs, @values["full_path"] ) 932: end 933: end
# File generators/html_generator.rb, line 841 841: def filename_to_label 842: @context.file_relative_name.gsub(/%|\/|\?|\#/) {|s| '%' + ("%x" % s[0]) } 843: end
# File generators/html_generator.rb, line 836 836: def http_url(file_dir) 837: File.join(file_dir, @context.file_relative_name.tr('.', '_')) + 838: '.' + @options.template 839: end
# File generators/html_generator.rb, line 853 853: def value_hash 854: file_attribute_values 855: add_table_of_sections 856: 857: @values["charset"] = @options.charset 858: @values["href"] = path 859: @values["style_url"] = style_url(path, @options.css) 860: 861: if @context.comment 862: d = markup(@context.comment) 863: @values["description"] = d if d.size > 0 864: end 865: 866: ml = build_method_summary_list 867: @values["methods"] = ml unless ml.empty? 868: 869: il = build_include_list(@context) 870: @values["includes"] = il unless il.empty? 871: 872: rl = build_requires_list(@context) 873: @values["requires"] = rl unless rl.empty? 874: 875: if @options.promiscuous 876: file_context = nil 877: else 878: file_context = @context 879: end 880: 881: 882: @values["sections"] = @context.sections.map do |section| 883: 884: secdata = { 885: "sectitle" => section.title, 886: "secsequence" => section.sequence, 887: "seccomment" => markup(section.comment) 888: } 889: 890: cl = build_class_list(0, @context, section, file_context) 891: @values["classlist"] = cl unless cl.empty? 892: 893: mdl = build_method_detail_list(section) 894: secdata["method_list"] = mdl unless mdl.empty? 895: 896: al = build_alias_summary_list(section) 897: secdata["aliases"] = al unless al.empty? 898: 899: co = build_constants_summary_list(section) 900: @values["constants"] = co unless co.empty? 901: 902: secdata 903: end 904: 905: @values 906: end