def convertRecipes(filename)
mydata=Array.new
mydata = getData(filename)
fp="recipes_hash_marshalled"
rectext =""
aRecipeList=RecipeList.new()
aCategoryList=CategoryList.new()
aKeywordsList=KeywordsList.new()
i=0
listOfHashes=Array.new
while i<= mydata.size-1
if isMMstart(mydata[i]) then
while not isTitle(mydata[i]) and i<=mydata.size-1
i=i+1
end
if i>mydata.size-1 then print "EOF !!!\n" end
aTitle=Title.new(String(clearTitle(mydata[i])))
while not isCategory(mydata[i]) and i<=mydata.size-1
i=i+1
end
aCategoryList=clearCategories(mydata[i])
while not isYield(mydata[i]) and i<=mydata.size-1
i=i+1
end
aYield=Yields.new(clearYield(mydata[i]))
i=i+2
aIngredList=IngredsList.new()
while (mydata[i] =~ /\w+/ or isMMline(mydata[i+1]))
if (isMMline(mydata[i+1]) and not mydata[i] =~ /\w+/) then
i=i+2
elsif isMMline(mydata[i]) then i=i+1
else
if not isMMline(mydata[i])
if (mydata[i] =~ /,\s+/) then
mIngreds = mydata[i].chomp.split(/,/)
for j in 0..mIngreds.size-1
aIngred=Ingreds.new('','','')
aIngred=splitIgredients(mIngreds[j].chomp, mydata[i+1].chomp)
aIngred.ingprint
aIngredList.append([aIngred.name, aIngred.set, aIngred.type])
end
else
aIngred=Ingreds.new('','','')
aIngred=splitIgredients(mydata[i].chomp, mydata[i+1].chomp)
if not aIngred.isempty then
aIngredList.append([aIngred.name, aIngred.set, aIngred.type])
end
aIngred.ingprint
end
i=i+1
else
i=i+1
end
end
end
rectext=""
while not mydata[i] =~ /:[\w;\d; ]+/ and i<=mydata.size-1
rectext << String(mydata[i].chomp)
i=i+1
end
aRecData=Recdata.new(rectext)
while (isKeywords(mydata[i]) and i<=mydata.size-1 and isMMend(mydata[i]) )
i=i+1
end
if isKeywords(mydata[i]) then
aKeywordsList=clearKeywords(mydata[i])
end
aRecipe=Recipe.new(aTitle,aCategoryList,aYield,aIngredList,aRecData,aKeywordsList)
aRecHash=Hash.new(nil)
aRecHash={"title"=>aTitle.name,"category"=>aCategoryList.catlist,"yields"=>aYield.nr,"ingreds"=>aIngredList.inglist,"data"=>aRecData.text,"keywords"=>aKeywordsList.keylist}
aRecipeList.append(aRecipe)
listOfHashes.push(aRecHash)
end
i=i+1
end
puts listOfHashes.inspect
marshallData(listOfHashes, "recipes_hash_marshalled")
@reclist=aRecipeList
end