Class: MediaWikiHTMLGenerator::MediaWikiLinkHandler
- Inherits:
-
Object
- Object
- MediaWikiHTMLGenerator::MediaWikiLinkHandler
- Defined in:
- lib/mediacloth/mediawikihtmlgenerator.rb
Overview
The default link handler. A custom link handler may extend this class.
Instance Method Summary collapse
-
#link_for(prefix, resource, options = []) ⇒ Object
Method invoked to resolve references to resources of unknown types.
-
#url_for(resource) ⇒ Object
Method invoked to resolve references to wiki pages when they occur in an internal link.
Instance Method Details
#link_for(prefix, resource, options = []) ⇒ Object
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]]
(prefixMedia
, resourcevideo.mpg
) -
[[Image:pretty.png|100px|A ''pretty'' picture]]
(prefixImage
,
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, =[]) "<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 |