Sha256: 8cc5a10191c9ed2546df54fb01eb9c9175b428516de04aed689286759d6ecd9e
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module Infoboxer module Tree # Module included into everything, that can be treated as # link to some MediaWiki page, despite of behavior. Namely, # {Wikilink} and {Template}. module Linkable # Extracts wiki page by this link and returns it parsed (or nil, # if page not found). # # About template "following" see also {Template#follow} docs. # # @return {MediaWiki::Page} # # **See also**: # * {Tree::Nodes#follow} for extracting multiple links at once; # * {MediaWiki#get} for basic information on page extraction. def follow client.get(link) end # Human-readable page URL # # @return [String] def url # FIXME: fragile as hell. page.url.sub(%r{[^/]+$}, link.tr(' ', '_')) end protected def page lookup_parents(MediaWiki::Page).first or fail('Not in a page from real source') end def client page.client or fail('MediaWiki client not set') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
infoboxer-0.3.0 | lib/infoboxer/tree/linkable.rb |
infoboxer-0.2.8 | lib/infoboxer/tree/linkable.rb |