Fix for match regexes

This commit is contained in:
Alexander Yakovlev 2017-01-15 13:26:26 +07:00
parent e015f90252
commit 08363fdb74

View file

@ -1,12 +1,11 @@
#!/usr/bin/ruby
require 'pp'
require './Wiki.rb'
wiki = Wiki.new
list = wiki.get_list()['allpages']
for page in list do
page_text = wiki.get_text(page['title']).body
if page_text.match("[[Category:Jokes]]") and not page_text.match("<vote type=1 />") then
if page_text.match(/\[\[Category\:Jokes\]\]/) and not page_text.match(/<vote type=1 \/>/) then
page_text = page_text + "\n\n<vote type=1 />"
wiki.create_page(page['title'], page_text)
end