Sha256: 7889441d749d9698486081abe7e8daf63a1cc825e017371567c12b6adeac2143

Contents?: true

Size: 778 Bytes

Versions: 14

Compression:

Stored size: 778 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__ == $PROGRAM_NAME
  unless ARGV.size == 1
    puts "Usage: #{$PROGRAM_NAME} http://en.wikipedia.org/wiki/Social_Democratic_Party_of_Kyrgyzstan"
    exit 0
  end
  url = ARGV[0]
  add_sanitization_test(url)
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
wikipedia-client-1.17.0 script/add_sanitization_test
wikipedia-client-1.16.0 script/add_sanitization_test
wikipedia-client-1.15.0 script/add_sanitization_test
wikipedia-client-1.14.0 script/add_sanitization_test
wikipedia-client-1.13.0 script/add_sanitization_test
wikipedia-client-1.12.0 script/add_sanitization_test
wikipedia-client-1.11.0 script/add_sanitization_test
wikipedia-client-1.10.0 script/add_sanitization_test
wikipedia-client-1.9.1 script/add_sanitization_test
wikipedia-client-1.9.0 script/add_sanitization_test
wikipedia-client-1.8.0 script/add_sanitization_test
wikipedia-client-1.7.1 script/add_sanitization_test
wikipedia-client-1.7.0 script/add_sanitization_test
wikipedia-client-1.6.4 script/add_sanitization_test