[Pkg-isocodes-devel] [SCM] ISO language, territory, currency, script codes and their translations branch, master, updated. 03570ff21c5b274fa394e207b5343689711250ca

Tobias Quathamer toddy at debian.org
Sun Jun 24 11:51:05 UTC 2012


The following commit has been merged in the master branch:
commit 0535e2a837beb74b3b096fb569634bcd911955ce
Author: Tobias Quathamer <toddy at debian.org>
Date:   Sat Jun 23 14:54:57 2012 +0200

    Collect all information and write complete entry later on

diff --git a/iso_639_3/iso-dis-639-tab-parse.py b/iso_639_3/iso-dis-639-tab-parse.py
index 6a90991..8a245b7 100755
--- a/iso_639_3/iso-dis-639-tab-parse.py
+++ b/iso_639_3/iso-dis-639-tab-parse.py
@@ -79,7 +79,12 @@ Source: <http://www.sil.org/iso639-3/>
 <iso_639_3_entries>
 """)
 
-f.readline()		# throw away the header
+# The first line only contains a header, so discard it
+f.readline()
+
+# Set up a container for XML element 'iso_639_3_entry'
+iso_639_3_entry = ''
+
 for li in f.readlines():
 	# Split the line into parts and look for quotes
 	parts = li.split('\t')
@@ -106,17 +111,19 @@ for li in f.readlines():
 	element_scope = parts.pop()
 	language_type = parts.pop()
 	documentation = parts.pop()
-	ot.write('\t<iso_639_3_entry\n')
-	ot.write('\t\tid="%s"\n' % code)
+	# Assemble the iso_639_3_entry
+	iso_639_3_entry = '\t<iso_639_3_entry\n'
+	iso_639_3_entry += '\t\tid="%s"\n' % code
 	if iso_639_1 != '':
-		ot.write('\t\tpart1_code="%s"\n' % iso_639_1)
+		iso_639_3_entry += '\t\tpart1_code="%s"\n' % iso_639_1
 	if iso_639_2 != '':
-		ot.write('\t\tpart2_code="%s"\n' % iso_639_2)
-	ot.write('\t\tscope="%s"\n' % element_scope)
-	ot.write('\t\ttype="%s"\n' % language_type)
+		iso_639_3_entry += '\t\tpart2_code="%s"\n' % iso_639_2
+	iso_639_3_entry += '\t\tscope="%s"\n' % element_scope
+	iso_639_3_entry += '\t\ttype="%s"\n' % language_type
 	if inverted_names.has_key(code):
 		reference_name = inverted_names[code]
-	ot.write('\t\tname="%s" />\n' % reference_name)
+	iso_639_3_entry += '\t\tname="%s" />\n' % reference_name
+	ot.write(iso_639_3_entry)
 
 ot.write('</iso_639_3_entries>\n')
 ot.close()

-- 
ISO language, territory, currency, script codes and their translations



More information about the Pkg-isocodes-devel mailing list