Ignore:
Timestamp:
2012-10-16T16:21:46+13:00 (12 years ago)
Author:
sjm84
Message:

Fixing some spacing issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-cols/niupepa/issuetoitem.py

    r26314 r26323  
    55
    66def findIssueFiles(startDir):
    7    for currentDir, dirs, filenames in os.walk(startDir):
    8       for filename in filenames:
    9          if re.search(r'^.*\.issue$', filename, re.M):
     7    for currentDir, dirs, filenames in os.walk(startDir):
     8        for filename in filenames:
     9            if re.search(r'^.*\.issue$', filename, re.M):
    1010
    11             filenamePrefix = filename.split(".")[0]
    12             filenameSegments = filenamePrefix.split("_")
    13             volume = filenameSegments[1]
    14             issue = filenameSegments[2]
     11                filenamePrefix = filename.split(".")[0]
     12                filenameSegments = filenamePrefix.split("_")
     13                volume = filenameSegments[1]
     14                issue = filenameSegments[2]
    1515           
    16             #Read the issue file
    17             i = open(os.path.join(currentDir, filename))
    18             lines = i.readlines()
    19             i.close()
     16                #Read the issue file
     17                i = open(os.path.join(currentDir, filename))
     18                lines = i.readlines()
     19                i.close()
    2020
    21             #Create a new item file
    22             o = open(os.path.join(currentDir, filename.replace("issue", "item")), "w")
     21                #Create a new item file
     22                o = open(os.path.join(currentDir, filename.replace("issue", "item")), "w")
    2323
    24             if len(volume) > 0:
    25                o.write("<Volume>" + volume + "\n")
    26             if len(issue) > 0:
    27                o.write("<Issue>" + issue + "\n")
     24                if len(volume) > 0:
     25                    o.write("<Volume>" + volume + "\n")
     26                if len(issue) > 0:
     27                    o.write("<Issue>" + issue + "\n")
    2828
    29             count = 0
    30             for line in lines:
    31                if line.startswith("<"):
    32                   o.write(line)
    33                else:
    34                   count += 1
    35                   line = line.rstrip()
    36                   nameSegments = line.split("_")
    37                   o.write(nameSegments[len(nameSegments)-1] + ":images/" + line + ".gif:text/" + line + ".txt\n")
    38             o.close()
    39 
     29                count = 0
     30                for line in lines:
     31                    if line.startswith("<"):
     32                        o.write(line)
     33                    else:
     34                        count += 1
     35                        line = line.rstrip()
     36                        nameSegments = line.split("_")
     37                        o.write(nameSegments[len(nameSegments)-1] + ":images/" + line + ".gif:text/" + line + ".txt\n")
     38                o.close()
    4039
    4140findIssueFiles('.')
Note: See TracChangeset for help on using the changeset viewer.