home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
-
- def _optimize(tagList, tagName, conversion):
- newTagList = []
- for tag in tagList:
- if tag.name == tagName or tag.name == 'rawtext':
- newTagList.append(tag)
- continue
-
- for i, newTag in enumerate(newTagList[:-1]):
- if newTag.name == tagName and newTagList[i + 1].name == tagName:
- tagList.remove(newTag)
- continue
-
- newTagList = []
- for tag in tagList:
- if tag.name == tagName:
- newTagList.append(tag)
- continue
-
- for i, newTag in enumerate(newTagList[:-1]):
- value = conversion(newTag.parameter)
- nextValue = conversion(newTagList[i + 1].parameter)
- if value == nextValue:
- tagList.remove(newTagList[i + 1])
- continue
-
- while len(tagList) > 0 and tagList[-1].name == tagName:
- del tagList[-1]
-
-
- def tagListOptimizer(tagList):
- oldSize = len(tagList)
- _optimize(tagList, 'fontsize', int)
- _optimize(tagList, 'fontweight', int)
- return oldSize - len(tagList)
-
-