Generators::MarkUp

                                                                   

Handle common markup tasks for the various Html classes


                                                                   

Handle common markup tasks for the various Html classes

Public Instance Methods

cvs_url(url, full_path) click to toggle source

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 lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 248
248:         def cvs_url(url, full_path)
249:             if /%s/ =~ url
250:                 return sprintf( url, full_path )
251:             else
252:                 return url + full_path
253:             end
254:         end
cvs_url(url, full_path) click to toggle source

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 lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 248
248:         def cvs_url(url, full_path)
249:             if /%s/ =~ url
250:                 return sprintf( url, full_path )
251:             else
252:                 return url + full_path
253:             end
254:         end
markup(str, remove_para=false) click to toggle source

Convert a string in markup format into HTML. We keep a cached SimpleMarkup object lying around after the first time we’re called per object.

     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 197
197:         def markup(str, remove_para=false)
198:             return '' unless str
199:             unless defined? @markup
200:                 @markup = SM::SimpleMarkup.new
201: 
202:                 # class names, variable names, file names, or instance variables
203:                 @markup.add_special(/(
204:                 \b([A-Z]\w*(::\w+)*[.\#]\w+)  #    A::B.meth
205:                 | \b([A-Z]\w+(::\w+)*)       #    A::B..
206:                 | \#\w+[!?=]?                #    #meth_name 
207:                 | \b\w+([_\/\.]+\w+)+[!?=]?  #    meth_name
208:                 )/, :CROSSREF)
209: 
210:                 # external hyperlinks
211:                 @markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
212: 
213:                 # and links of the form  <text>[<url>]
214:                 @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
215:                 #        @markup.add_special(/\b(\S+?\[\S+?\.\S+?\])/, :TIDYLINK)
216: 
217:             end
218:             unless defined? @html_formatter
219:                 @html_formatter = HyperlinkHtml.new(self.path, self)
220:             end
221: 
222:             # Convert leading comment markers to spaces, but only
223:             # if all non-blank lines have them
224: 
225:             if str =~ /^(?>\s*)[^\#]/
226:                 content = str
227:             else
228:                 content = str.gsub(/^\s*(#+)/)  { $1.tr('#',' ') }
229:             end
230: 
231:             res = @markup.convert(content, @html_formatter)
232:             if remove_para
233:                 res.sub!(/^<p>/, '')
234:                 res.sub!(/<\/p>$/, '')
235:             end
236:             res
237:         end
markup(str, remove_para=false) click to toggle source

Convert a string in markup format into HTML. We keep a cached SimpleMarkup object lying around after the first time we’re called per object.

     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 197
197:         def markup(str, remove_para=false)
198:             return '' unless str
199:             unless defined? @markup
200:                 @markup = SM::SimpleMarkup.new
201: 
202:                 # class names, variable names, file names, or instance variables
203:                 @markup.add_special(/(
204:                 \b([A-Z]\w*(::\w+)*[.\#]\w+)  #    A::B.meth
205:                 | \b([A-Z]\w+(::\w+)*)       #    A::B..
206:                 | \#\w+[!?=]?                #    #meth_name 
207:                 | \b\w+([_\/\.]+\w+)+[!?=]?  #    meth_name
208:                 )/, :CROSSREF)
209: 
210:                 # external hyperlinks
211:                 @markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK)
212: 
213:                 # and links of the form  <text>[<url>]
214:                 @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\.\S+?\])/, :TIDYLINK)
215:                 #        @markup.add_special(/\b(\S+?\[\S+?\.\S+?\])/, :TIDYLINK)
216: 
217:             end
218:             unless defined? @html_formatter
219:                 @html_formatter = HyperlinkHtml.new(self.path, self)
220:             end
221: 
222:             # Convert leading comment markers to spaces, but only
223:             # if all non-blank lines have them
224: 
225:             if str =~ /^(?>\s*)[^\#]/
226:                 content = str
227:             else
228:                 content = str.gsub(/^\s*(#+)/)  { $1.tr('#',' ') }
229:             end
230: 
231:             res = @markup.convert(content, @html_formatter)
232:             if remove_para
233:                 res.sub!(/^<p>/, '')
234:                 res.sub!(/<\/p>$/, '')
235:             end
236:             res
237:         end
style_url(path, css_name=nil) click to toggle source
     # File lib/generators/templates/application/merb_core/doc/rdoc/generators/merb_generator.rb, line 240
240:         def style_url(path, css_name=nil)
241:             css_name ||= CSS_NAME      
242:         end
style_url(path, css_name=nil) click to toggle source
     # File lib/generators/templates/application/merb_stack/doc/rdoc/generators/merb_generator.rb, line 240
240:         def style_url(path, css_name=nil)
241:             css_name ||= CSS_NAME      
242:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.