Class: MediaWikiHTMLGenerator::MediaWikiLinkHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/mediacloth/mediawikihtmlgenerator.rb

Overview

The default link handler. A custom link handler may extend this class.

Instance Method Summary collapse

Instance Method Details

Method invoked to resolve references to resources of unknown types. The type is indicated by the resource prefix. Examples of inline links to unknown references include:

  • [[Media:video.mpg]] (prefix Media, resource video.mpg)

  • [[Image:pretty.png|100px|A ''pretty'' picture]] (prefix Image,

resource <tt>pretty.png</tt>, and options <tt>100px</tt> and <tt>A
<i>pretty</i> picture</tt>.

The return value should be a well-formed hyperlink, image, object or applet tag.



47
48
49
# File 'lib/mediacloth/mediawikihtmlgenerator.rb', line 47

def link_for(prefix, resource, options=[])
  "<a href=\"javascript:void(0)\">#{prefix}:#{resource}(#{options.join(', ')})</a>"
end

#url_for(resource) ⇒ Object

Method invoked to resolve references to wiki pages when they occur in an internal link. In all the following internal links, the page name is My Page:

  • [[My Page]]

  • [[My Page|Click here to view my page]]

  • [[My Page|Click ''here'' to view my page]]

The return value should be a URL that references the page resource.



34
35
36
# File 'lib/mediacloth/mediawikihtmlgenerator.rb', line 34

def url_for(resource)
  "javascript:void(0)"
end