=====Ruby script to convert Hein Online citations to AGLC===== Explanation at: [[:blog:2008:20080603-convert_hein_to_aglc_-_ruby]] #!/usr/bin/ruby # 20080603 Nic Suzor # Available under CC BY-SA 2.5 (AU) http://creativecommons.org/licenses/by-sa/2.5/au/ # # Alternatively, permission is granted to exercise any of the rights comprised # in the copyright in this code, as long as the user agrees that it is provided with # no warranty, express or implied, to the extent permissible by applicable law. puts "this script will convert Hein Online citations to AGLC formatted citations." puts "\n" puts "enter a Hein Online cite (on up to two lines):" cite = gets.chomp! cite = cite + gets.chomp! while cite != '' #eg: 82 Ind. L.J. 261 (2007) On Virtual Worlds: Copyright and Contract Law at the Dawn of the Virtual Age; Reuveni, Erez #becomes: Reuveni, Erez, "On Virtual Worlds: Copyright and Contract Law at the Dawn of the Virtual Age" (2007) 82 Ind. L.J. 261 cite = cite.gsub(/(.*?)(\(.*?\))(.*?); *(.*?)\Z/, '\4, "\3" \2 \1') puts cite puts "\nNext cite (enter two carriage returns to finish):\n" cite = gets.chomp! cite = cite + gets.chomp! end