Module RDoc::Generator::MarkUp
In: generator.rb
doc-tmp/rdoc/generator.rb

Handle common markup tasks for the various Context subclasses

Methods

cvs_url   cvs_url   markup   markup   style_url   style_url  

Public Instance methods

Build a webcvs URL with the given ‘url’ argument. URLs with a ’%s’ in them get the file‘s path sprintfed into them; otherwise they‘re just catenated together.

[Source]

     # File doc-tmp/rdoc/generator.rb, line 137
137:     def cvs_url(url, full_path)
138:       if /%s/ =~ url
139:         return sprintf( url, full_path )
140:       else
141:         return url + full_path
142:       end
143:     end

Build a webcvs URL with the given ‘url’ argument. URLs with a ’%s’ in them get the file‘s path sprintfed into them; otherwise they‘re just catenated together.

[Source]

     # File generator.rb, line 137
137:     def cvs_url(url, full_path)
138:       if /%s/ =~ url
139:         return sprintf( url, full_path )
140:       else
141:         return url + full_path
142:       end
143:     end

Convert a string in markup format into HTML.

[Source]

     # File doc-tmp/rdoc/generator.rb, line 81
 81:     def markup(str, remove_para = false)
 82:       return '' unless str
 83: 
 84:       unless defined? @formatter then
 85:         unless @options.mathml
 86:           @formatter = RDoc::Markup::ToHtmlCrossref.new(path, self,
 87:                                                         @options.show_hash)
 88:         else
 89:           @formatter = RDoc::Markup::ToXHtmlTexParser.new(path, self,
 90:                                                           @options.show_hash, 
 91:                                                           @options.mathml)
 92:         end
 93:       end
 94: 
 95:       # Convert leading comment markers to spaces, but only if all non-blank
 96:       # lines have them
 97:       if str =~ /^(?>\s*)[^\#]/ then
 98:         content = str
 99:       else
100:         content = str.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }
101:       end
102: 
103:       unless @options.mathml
104:         res = @formatter.convert content
105:       else
106:         res = @formatter.convert content, @formatter.block_exceptions
107:       end
108: 
109:       if remove_para then
110:         res.sub!(/^<p>/, '')
111:         res.sub!(/<\/p>$/, '')
112:       end
113: 
114:       res
115:     end

Convert a string in markup format into HTML.

[Source]

     # File generator.rb, line 81
 81:     def markup(str, remove_para = false)
 82:       return '' unless str
 83: 
 84:       unless defined? @formatter then
 85:         unless @options.mathml
 86:           @formatter = RDoc::Markup::ToHtmlCrossref.new(path, self,
 87:                                                         @options.show_hash)
 88:         else
 89:           @formatter = RDoc::Markup::ToXHtmlTexParser.new(path, self,
 90:                                                           @options.show_hash, 
 91:                                                           @options.mathml)
 92:         end
 93:       end
 94: 
 95:       # Convert leading comment markers to spaces, but only if all non-blank
 96:       # lines have them
 97:       if str =~ /^(?>\s*)[^\#]/ then
 98:         content = str
 99:       else
100:         content = str.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }
101:       end
102: 
103:       unless @options.mathml
104:         res = @formatter.convert content
105:       else
106:         res = @formatter.convert content, @formatter.block_exceptions
107:       end
108: 
109:       if remove_para then
110:         res.sub!(/^<p>/, '')
111:         res.sub!(/<\/p>$/, '')
112:       end
113: 
114:       res
115:     end

Qualify a stylesheet URL; if if css_name does not begin with ‘/’ or ‘http[s]://’, prepend a prefix relative to path. Otherwise, return it unmodified.

[Source]

     # File doc-tmp/rdoc/generator.rb, line 122
122:     def style_url(path, css_name=nil)
123: #      $stderr.puts "style_url( #{path.inspect}, #{css_name.inspect} )"
124:       css_name ||= CSS_NAME
125:       if %r{^(https?:/)?/} =~ css_name
126:         css_name
127:       else
128:         RDoc::Generator.gen_url path, css_name
129:       end
130:     end

Qualify a stylesheet URL; if if css_name does not begin with ‘/’ or ‘http[s]://’, prepend a prefix relative to path. Otherwise, return it unmodified.

[Source]

     # File generator.rb, line 122
122:     def style_url(path, css_name=nil)
123: #      $stderr.puts "style_url( #{path.inspect}, #{css_name.inspect} )"
124:       css_name ||= CSS_NAME
125:       if %r{^(https?:/)?/} =~ css_name
126:         css_name
127:       else
128:         RDoc::Generator.gen_url path, css_name
129:       end
130:     end

[Validate]