#!/usr/bin/env ruby # Convert jMemorize JML files to Mnemosyne XML, which can be imported to # AnyMemo, Mnemosyne and possibly others. # The JML files should be uncompressed (Use 7-Zip or gunzip if necessary). # Only two-sided cards with plain syntax which have been learned one way # (front to back) are supported, and category information is discarded. require 'date' if ARGV.length < 2 puts "Usage: ruby " << $0 << " " exit end open(ARGV[1], 'w') do |outfile| outfile.puts '' # The creation date is relative to the Unix epoch in the Mnemosyne format. # Pretend the database was created at the Unix epoch. outfile.puts '' open ARGV[0] do |infile| # Read the JML file line by line. while line = infile.gets if line.match("' # Front side of the card. outfile.puts ' ' << front_side << '' # Back side of the card. outfile.puts ' ' << back_side << '' outfile.puts '' end end outfile.write '' end end