topazscripts 1.5
parent
c1e5943471
commit
a1fec0b54d
@ -0,0 +1,20 @@
|
||||
Changes in version 1.5
|
||||
- completely reworked generation of styles to use actual page heights and widths
|
||||
- added new script getpagedim.py to support the above
|
||||
- style names with underscores in them are now properly paired with their base class
|
||||
- fixed hanging indents that did not ever set a left margin
|
||||
- added support for a number of not previously known region types
|
||||
- added support for a previously unknown snippet - <empty></empty>
|
||||
- corrected a bug that caused unknown regions to abort the program
|
||||
- added code to make the handling of unknown regions better in general
|
||||
- corrected a bug that caused the last link on a page to be missing (if it was the last thing on the page)
|
||||
|
||||
Changes in version 1.3
|
||||
- font generation by gensvg.py is now greatly improved with support for contour points added
|
||||
- support for more region types
|
||||
- support for inline images in paragraphs or text fields (ie. initial graphics for the first letter of a word)
|
||||
- greatly improved dtd information used for the xml to prevent parsing mistakes
|
||||
|
||||
Version 1.0
|
||||
- initial release
|
||||
|
@ -0,0 +1,53 @@
|
||||
#! /usr/bin/python
|
||||
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
|
||||
|
||||
from __future__ import with_statement
|
||||
import csv
|
||||
import sys
|
||||
import os
|
||||
import getopt
|
||||
from struct import pack
|
||||
from struct import unpack
|
||||
|
||||
|
||||
class DocParser(object):
|
||||
def __init__(self, flatxml):
|
||||
self.flatdoc = flatxml.split('\n')
|
||||
|
||||
|
||||
# find tag if within pos to end inclusive
|
||||
def findinDoc(self, tagpath, pos, end) :
|
||||
result = None
|
||||
docList = self.flatdoc
|
||||
cnt = len(docList)
|
||||
if end == -1 :
|
||||
end = cnt
|
||||
else:
|
||||
end = min(cnt,end)
|
||||
foundat = -1
|
||||
for j in xrange(pos, end):
|
||||
item = docList[j]
|
||||
if item.find('=') >= 0:
|
||||
(name, argres) = item.split('=')
|
||||
else :
|
||||
name = item
|
||||
argres = ''
|
||||
if name.endswith(tagpath) :
|
||||
result = argres
|
||||
foundat = j
|
||||
break
|
||||
return foundat, result
|
||||
|
||||
def process(self):
|
||||
(pos, sph) = self.findinDoc('page.h',0,-1)
|
||||
(pos, spw) = self.findinDoc('page.w',0,-1)
|
||||
if (sph == None): sph = '-1'
|
||||
if (spw == None): spw = '-1'
|
||||
return sph, spw
|
||||
|
||||
|
||||
def getPageDim(flatxml):
|
||||
# create a document parser
|
||||
dp = DocParser(flatxml)
|
||||
(ph, pw) = dp.process()
|
||||
return ph, pw
|
Loading…
Reference in New Issue