Sha256: 30a32adeabfe93e2ea0cb9d796a8c9ab324c5ca8d607d5f2b693658d584a1562

Contents?: true

Size: 757 Bytes

Versions: 13

Compression:

Stored size: 757 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
require "wikipedia"

SANITIZATION_SAMPLE_PATH = File.join(File.dirname(__FILE__), "..", "spec", "fixtures", "sanitization_samples")

def add_sanitization_test(url)
  title = Wikipedia::Url.new(url).title
  page = Wikipedia.find(title, :rvsection => 0)
  File.open(File.join(SANITIZATION_SAMPLE_PATH, "#{title}-raw.txt"), 'w') {|f| f << page.content }
  File.open(File.join(SANITIZATION_SAMPLE_PATH, "#{title}-sanitized.txt"), 'w') {|f| f << page.sanitized_content }
end

if __FILE__ == $0
  unless ARGV.size == 1
    puts "Usage: #{$0} http://en.wikipedia.org/wiki/Social_Democratic_Party_of_Kyrgyzstan"
    exit 0
  end
  url = ARGV[0]
  add_sanitization_test(url)
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wikipedia-client-1.6.3 script/add_sanitization_test
wikipedia-client-1.6.2 script/add_sanitization_test
wikipedia-client-1.6.1 script/add_sanitization_test
wikipedia-client-1.5.0 script/add_sanitization_test
wikipedia-client-1.4.0 script/add_sanitization_test
wikipedia-client-1.3.3 script/add_sanitization_test
wikipedia-client-1.3.2 script/add_sanitization_test
wikipedia-client-1.3.0 script/add_sanitization_test
wikipedia-client-1.2.0 script/add_sanitization_test
wikipedia-client-1.1.2 script/add_sanitization_test
wikipedia-client-1.1.1 script/add_sanitization_test
wikipedia-client-1.1.0 script/add_sanitization_test
wikipedia-client-1.0.0 script/add_sanitization_test