Revisions
-
bfroehle revised this gist
Jan 10, 2013 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,12 +11,20 @@ doc.search('/mediawiki/page').each do |el| title = el.at('title').inner_text.tr('/', '-') content = el.at('text').inner_text kind = :mediawiki commit = { :message => "Import MediaWiki page #{title} into Gollum", :name => 'Bradley M. Froehle', :email => '[email protected]' } m = content.match(/^\s*<rst>(.*)<\/rst>\s*$/m) if m kind = :rest content = m[1] end begin puts "Writing page #{title}" wiki.write_page(title, kind, content, commit) rescue Gollum::DuplicatePageError => e p "Duplicate #{title}" end -
bfroehle revised this gist
Jan 10, 2013 . 1 changed file with 6 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,25 +2,22 @@ require 'rubygems' require 'hpricot' require 'gollum' require 'open-uri' wiki = Gollum::Wiki.new('ipython.wiki') doc = Hpricot(open('https://dl.dropbox.com/s/5ogy0xg2lkuo1rf/IPython-20130110012347.xml')) doc.search('/mediawiki/page').each do |el| title = el.at('title').inner_text.tr('/', '-') content = el.at('text').inner_text commit = { :message => "Import MediaWiki page #{title} into Gollum", :name => 'Bradley M. Froehle', :email => 'brad.froehle@gmail.com' } begin puts "Writing page #{title}" wiki.write_page(title, :mediawiki, content, commit) rescue Gollum::DuplicatePageError => e p "Duplicate #{title}" end end -
bfroehle revised this gist
Jan 10, 2013 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/usr/bin/env python import re import requests html = requests.get('http://wiki.ipython.org/Special:AllPages') all_pages_table = re.search('<table class="mw-allpages-table-chunk">(.*)</table>', html.content, re.DOTALL).group() titles = re.findall(r'title="([^"]*?)"', all_pages_table) hrefs = re.findall(r'href="([^"]*?)"', all_pages_table) print("Go to http://wiki.ipython.org/Special:Export and export the following:") print('\n'.join(titles)) -
henare created this gist
Mar 10, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/usr/bin/env ruby require 'rubygems' require 'hpricot' require 'gollum' wiki = Gollum::Wiki.new('openaustralia.wiki') file = File.open("OpenAustralia-20110309232515.xml", "r") doc = Hpricot(file) doc.search('/mediawiki/page').each do |el| title = el.at('title').inner_text content = el.at('text').inner_text commit = { :message => "Import MediaWiki page #{title} into Gollum", :name => 'Henare Degan', :email => '[email protected]' } begin puts "Writing page #{title}" wiki.write_page(title, :mediawiki, content, commit) rescue Gollum::DuplicatePageError => e p "Duplicate #{title}" end end file.close