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