Create import_hash with .new(0) so that we don't have to check if
a hash exists before incrementing it.
This commit is contained in:
parent
eb6a2b9bd0
commit
8c35cc957b
|
@ -11,7 +11,7 @@ module Jekyll
|
||||||
# wordpress.com blog (/wp-admin/export.php).
|
# wordpress.com blog (/wp-admin/export.php).
|
||||||
module WordpressDotCom
|
module WordpressDotCom
|
||||||
def self.process(filename = "wordpress.xml")
|
def self.process(filename = "wordpress.xml")
|
||||||
import_count = Hash.new
|
import_count = Hash.new(0)
|
||||||
doc = Hpricot::XML(File.read(filename))
|
doc = Hpricot::XML(File.read(filename))
|
||||||
|
|
||||||
(doc/:channel/:item).each do |item|
|
(doc/:channel/:item).each do |item|
|
||||||
|
@ -58,11 +58,8 @@ module Jekyll
|
||||||
f.puts '---'
|
f.puts '---'
|
||||||
f.puts item.at('content:encoded').inner_text
|
f.puts item.at('content:encoded').inner_text
|
||||||
end
|
end
|
||||||
if import_count[type] == nil
|
|
||||||
import_count[type] = 1
|
import_count[type] += 1
|
||||||
else
|
|
||||||
import_count[type] += 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
import_count.each do |key, value|
|
import_count.each do |key, value|
|
||||||
|
|
Loading…
Reference in New Issue