Handle common markup tasks for the various Context subclasses
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.
# File rdoc/generator.rb, line 100
def cvs_url(url, full_path)
if /%s/ =~ url
return sprintf( url, full_path )
else
return url + full_path
end
end
Convert a string in markup format into HTML.
# File rdoc/generator.rb, line 59
def markup(str, remove_para = false)
return '' unless str
# Convert leading comment markers to spaces, but only if all non-blank
# lines have them
if str =~ /^(?>\s*)[^\#]/ then
content = str
else
content = str.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }
end
res = formatter.convert content
if remove_para then
res.sub!(/^<p>/, '')
res.sub!(/<\/p>$/, '')
end
res
end
Qualify a stylesheet URL; if if css_name does not begin with
‘/’ or ‘http://’, prepend a prefix relative to
path. Otherwise, return it unmodified.
# File rdoc/generator.rb, line 85
def style_url(path, css_name=nil)
# $stderr.puts "style_url( #{path.inspect}, #{css_name.inspect} )"
css_name ||= CSS_NAME
if %r{^(https?:/)?/} =~ css_name
css_name
else
RDoc::Markup::ToHtml.gen_relative_url path, css_name
end
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.