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