SEESenv/scripts/autoid.py
changeset 33 bc535262231d
parent 31 06a02dd3966f
--- a/SEESenv/scripts/autoid.py	Sat Feb 27 00:10:28 2010 +0530
+++ b/SEESenv/scripts/autoid.py	Sun Feb 28 16:22:19 2010 +0530
@@ -9,6 +9,7 @@
 tagged = re.compile('<para[^>]* id="x_([0-9a-f]+)"[^>]*>', re.M)
 untagged = re.compile('<para>')
 
+script_folder='/home/hg/repos/SEES-hacks/temp/'
 names = glob.glob('/home/hg/repos/SEES-hacks/temp/ch*.docbook') 
 # First pass: find the highest-numbered paragraph ID.
 
@@ -18,7 +19,7 @@
 errs = 0
 beginning="p_list= "
 
-id_file=open('p_list.py','w')
+id_file=open(script_folder+'p_list.py','w') 
 dictionary={}
 id_list=[]
 for name in names:
@@ -37,7 +38,7 @@
     global chapter   
     biggest_id += 1
      
-    id_name="%s_%x" % (chapter,biggest_id)   
+    id_name="%s_%x" % (chapter.split('/')[-1],biggest_id)   
     id_list.append(id_name)    
     
     return '<para id="%s">' %id_name
@@ -50,7 +51,7 @@
     id_list=[]    
     f = open(name).read()
     f1 = untagged.sub(retag, f )
-    dictionary[chapter]=id_list       
+    dictionary[chapter.split('/')[-1]]=id_list       
     if f1 != f:
         tmpname = name + '.tmp'
         fp = open(tmpname, 'w')