Permalink
Browse files

Namespaceangabe bei Wiki#allpages

git-svn-id: svn://78.47.249.61/ruby-mediawiki/trunk@64 ba9c31aa-a806-0410-9a81-9f13d15ee83b
  • Loading branch information...
1 parent daea1af commit dcda1850386fb8b8982648dd983d9d84adc5396b astro committed Jun 10, 2006
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/mediawiki.rb
View
@@ -103,10 +103,17 @@ def namespace_ids
##
# Returns the pages listed on "Special:Allpages"
+ #
+ # TODO: Handle big wikis with chunked Special:Allpages
+ # namespace_id:: Optional namespace for article index (see Wiki#namespace_ids to retrieve id)
# result:: [Array] of [String] Articlenames
- def allpages()
+ def allpages(namespace_id=nil)
+ # Dirty, but works
+ article_name = 'Special:Allpages'
+ article_name += "&namespace=#{namespace_id}" if namespace_id
+
pages = []
- SpecialPage.new( self, 'Special:Allpages', nil, false ).xhtml.each_element('table[2]/tr/td/a') do | a |
+ SpecialPage.new( self, article_name, nil, false ).xhtml.each_element('table[2]/tr/td/a') do | a |
pages.push( a.text )
end
pages

0 comments on commit dcda185

Please sign in to comment.