Generators::HtmlFile

                                                                   

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.


                                                                   

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.

Attributes

path[R]
name[R]
path[R]
name[R]

Public Class Methods

new(context, options, file_dir) click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 756
756:         def initialize(context, options, file_dir)
757:             super(context, options)
758:             @@f_seq  = @@f_seq.succ
759:             @f_seq   = @@f_seq
760:             @values = {}
761: 
762:             @path = http_url(file_dir)
763:             @source_file_path = File.expand_path(@context.file_relative_name).gsub("\/doc\/", "/")
764:             @name = @context.file_relative_name
765: 
766:             collect_methods
767:             AllReferences.add(name, self)
768:             context.viewer = self
769:         end
new(context, options, file_dir) click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 756
756:         def initialize(context, options, file_dir)
757:             super(context, options)
758:             @@f_seq  = @@f_seq.succ
759:             @f_seq   = @@f_seq
760:             @values = {}
761: 
762:             @path = http_url(file_dir)
763:             @source_file_path = File.expand_path(@context.file_relative_name).gsub("\/doc\/", "/")
764:             @name = @context.file_relative_name
765: 
766:             collect_methods
767:             AllReferences.add(name, self)
768:             context.viewer = self
769:         end

Public Instance Methods

<=>(other) click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 899
899:         def <=>(other)
900:             self.name <=> other.name
901:         end
<=>(other) click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 899
899:         def <=>(other)
900:             self.name <=> other.name
901:         end
aref() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 783
783:         def aref
784:             @f_seq
785:         end
aref() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 783
783:         def aref
784:             @f_seq
785:         end
file_attribute_values() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 880
880:         def file_attribute_values
881:             full_path = @context.file_absolute_name
882:             short_name = File.basename(full_path)
883: 
884:             @values["title"] = CGI.escapeHTML("File: #{short_name}")
885: 
886:             if @context.diagram
887:                 @values["diagram"] = diagram_reference(@context.diagram)
888:             end
889: 
890:             @values["short_name"]   = CGI.escapeHTML(short_name)
891:             @values["full_path"]    = CGI.escapeHTML(full_path)
892:             @values["dtm_modified"] = @context.file_stat.mtime.to_s
893: 
894:             if @options.webcvs
895:                 @values["cvsurl"] = cvs_url( @options.webcvs, @values["full_path"] )
896:             end
897:         end
file_attribute_values() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 880
880:         def file_attribute_values
881:             full_path = @context.file_absolute_name
882:             short_name = File.basename(full_path)
883: 
884:             @values["title"] = CGI.escapeHTML("File: #{short_name}")
885: 
886:             if @context.diagram
887:                 @values["diagram"] = diagram_reference(@context.diagram)
888:             end
889: 
890:             @values["short_name"]   = CGI.escapeHTML(short_name)
891:             @values["full_path"]    = CGI.escapeHTML(full_path)
892:             @values["dtm_modified"] = @context.file_stat.mtime.to_s
893: 
894:             if @options.webcvs
895:                 @values["cvsurl"] = cvs_url( @options.webcvs, @values["full_path"] )
896:             end
897:         end
filename_to_label() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 775
775:         def filename_to_label
776:             @context.file_relative_name.gsub(/%|\/|\?|\#/) {|s| '%' + ("%x" % s[0]) }
777:         end
filename_to_label() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 775
775:         def filename_to_label
776:             @context.file_relative_name.gsub(/%|\/|\?|\#/) {|s| '%' + ("%x" % s[0]) }
777:         end
full_file_source() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 804
804:         def full_file_source
805:             ret_str = ""
806:             File.open(@source_file_path, 'r') do |f| 
807:                 while(!f.eof?) do
808:                     ret_str += f.readline()
809:                 end
810:             end
811:             ret_str
812:         rescue
813:             "file not found -#{@source_file_path}-"
814:             #@source_file_path
815:         end
full_file_source() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 804
804:         def full_file_source
805:             ret_str = ""
806:             File.open(@source_file_path, 'r') do |f| 
807:                 while(!f.eof?) do
808:                     ret_str += f.readline()
809:                 end
810:             end
811:             ret_str
812:         rescue
813:             "file not found -#{@source_file_path}-"
814:             #@source_file_path
815:         end
full_name() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 792
792:         def full_name
793:             @context.file_absolute_name
794:         end
full_name() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 792
792:         def full_name
793:             @context.file_absolute_name
794:         end
http_url(file_dir) click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 771
771:         def http_url(file_dir)
772:             File.join(file_dir, @context.file_relative_name.tr('.', '_')) + ".html"
773:         end
http_url(file_dir) click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 771
771:         def http_url(file_dir)
772:             File.join(file_dir, @context.file_relative_name.tr('.', '_')) + ".html"
773:         end
name() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 787
787:         def name
788:             full_path = @context.file_absolute_name
789:             short_name = File.basename(full_path)
790:         end
name() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 787
787:         def name
788:             full_path = @context.file_absolute_name
789:             short_name = File.basename(full_path)
790:         end
parent_name() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 800
800:         def parent_name
801:             nil
802:         end
parent_name() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 800
800:         def parent_name
801:             nil
802:         end
scope() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 796
796:         def scope
797:             @context.file_relative_name.gsub(/\/#{name}$/, '')
798:         end
scope() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 796
796:         def scope
797:             @context.file_relative_name.gsub(/\/#{name}$/, '')
798:         end
seq() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 779
779:         def seq
780:             @f_seq
781:         end
seq() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 779
779:         def seq
780:             @f_seq
781:         end
value_hash() click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 817
817:         def value_hash
818:             file_attribute_values
819:             add_table_of_sections
820: 
821:             @values["charset"]   = @options.charset
822:             @values["href"]      = path
823:             @values["style_url"] = style_url(path, @options.css)
824:             @values["file_seq"] =  seq
825: 
826:             #pulling in the source for this file
827:             #@values["source_code"] = @context.token_stream
828: 
829:             @values["file_source_code"] = CGI.escapeHTML(full_file_source)
830: 
831:             if @context.comment
832:                 d = markup(@context.comment)
833:                 @values["description"] = d if d.size > 0
834:             end
835: 
836:             ml = build_method_summary_list
837:             @values["methods"] = ml unless ml.empty?
838: 
839:             il = build_include_list(@context)
840:             @values["includes"] = il unless il.empty?
841: 
842:             rl = build_requires_list(@context)
843:             @values["requires"] = rl unless rl.empty?
844: 
845: 
846:             file_context = @context
847: 
848:             @values["sections"] = @context.sections.map do |section|
849: 
850:                 secdata = {
851:                     "sectitle" => section.title,
852:                     "secsequence" => section.sequence,
853:                     "seccomment" => markup(section.comment)
854:                 }
855: 
856:                 cl = build_class_list(0, @context, section, file_context)
857:                 @values["classlist"] = cl unless cl.empty?
858: 
859:                 mdl = build_method_detail_list(section)
860:                 secdata["method_list"] = mdl unless mdl.empty?
861: 
862:                 al = build_alias_summary_list(section)
863:                 secdata["aliases"] = al unless al.empty?
864: 
865:                 co = build_constants_summary_list(section)
866:                 @values["constants"] = co unless co.empty?
867: 
868:                 secdata
869:             end
870: 
871:             @values
872:         end
value_hash() click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 817
817:         def value_hash
818:             file_attribute_values
819:             add_table_of_sections
820: 
821:             @values["charset"]   = @options.charset
822:             @values["href"]      = path
823:             @values["style_url"] = style_url(path, @options.css)
824:             @values["file_seq"] =  seq
825: 
826:             #pulling in the source for this file
827:             #@values["source_code"] = @context.token_stream
828: 
829:             @values["file_source_code"] = CGI.escapeHTML(full_file_source)
830: 
831:             if @context.comment
832:                 d = markup(@context.comment)
833:                 @values["description"] = d if d.size > 0
834:             end
835: 
836:             ml = build_method_summary_list
837:             @values["methods"] = ml unless ml.empty?
838: 
839:             il = build_include_list(@context)
840:             @values["includes"] = il unless il.empty?
841: 
842:             rl = build_requires_list(@context)
843:             @values["requires"] = rl unless rl.empty?
844: 
845: 
846:             file_context = @context
847: 
848:             @values["sections"] = @context.sections.map do |section|
849: 
850:                 secdata = {
851:                     "sectitle" => section.title,
852:                     "secsequence" => section.sequence,
853:                     "seccomment" => markup(section.comment)
854:                 }
855: 
856:                 cl = build_class_list(0, @context, section, file_context)
857:                 @values["classlist"] = cl unless cl.empty?
858: 
859:                 mdl = build_method_detail_list(section)
860:                 secdata["method_list"] = mdl unless mdl.empty?
861: 
862:                 al = build_alias_summary_list(section)
863:                 secdata["aliases"] = al unless al.empty?
864: 
865:                 co = build_constants_summary_list(section)
866:                 @values["constants"] = co unless co.empty?
867: 
868:                 secdata
869:             end
870: 
871:             @values
872:         end
write_on(f) click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 874
874:         def write_on(f)
875:             value_hash
876:             template = TemplatePage.new(RDoc::Page::SRC_BODY,RDoc::Page::FILE_PAGE, RDoc::Page::METHOD_LIST)
877:             template.write_html_on(f, @values)
878:         end
write_on(f) click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 874
874:         def write_on(f)
875:             value_hash
876:             template = TemplatePage.new(RDoc::Page::SRC_BODY,RDoc::Page::FILE_PAGE, RDoc::Page::METHOD_LIST)
877:             template.write_html_on(f, @values)
878:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.