Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed allpages

git-svn-id: svn://78.47.249.61/ruby-mediawiki/trunk@54 ba9c31aa-a806-0410-9a81-9f13d15ee83b
  • Loading branch information...
commit dc45b40b4a408ff53add4a0d5c2c447484c52c9c 1 parent 431bf6d
sven authored
Showing with 23 additions and 1 deletion.
  1. +2 −1  lib/mediawiki.rb
  2. +21 −0 lib/mediawiki/specialpage.rb
3  lib/mediawiki.rb
View
@@ -11,6 +11,7 @@
require 'uri'
require 'mediawiki/article'
+require 'mediawiki/specialpage'
require 'mediawiki/category'
require 'mediawiki/minibrowser'
@@ -73,7 +74,7 @@ def article(name, section = nil)
# result:: [Array] of [String] Articlenames
def allpages()
pages = []
- Article.new( self, 'Special:Allpages', nil, false ).xhtml.each_element('table[2]/tr/td/a') do | a |
+ SpecialPage.new( self, 'Special:Allpages', nil, false ).xhtml.each_element('table[2]/tr/td/a') do | a |
pages.push( a.text )
end
pages
21 lib/mediawiki/specialpage.rb
View
@@ -0,0 +1,21 @@
+require 'mediawiki/article'
+
+module MediaWiki
+ ##
+ # The SpecialPage class represents MediaWiki special pages.
+ class SpecialPage < Article
+
+ ##
+ # Reload the xhtml,
+ # will be automatically done by SpecialPage#xhtml if not already cached.
+ def xhtml_reload
+ html = @wiki.browser.get_content("#{@wiki.article_url(@name, @section)}")
+ html.scan(/<!-- start content -->(.+)<!-- end content -->/m) { |content,|
+ @xhtml = REXML::Document.new("<xhtml>#{content}</xhtml>").root
+ }
+ @xhtml_cached = true
+ end
+
+ end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.