diff options
Diffstat (limited to 'texall')
| -rwxr-xr-x | texall | 56 |
1 files changed, 46 insertions, 10 deletions
@@ -379,6 +379,8 @@ def processtexfiles(args): runtex(tex, texname, realname, dirname, reason=reason) elif req == "bibtex": run(["bibtex8", "--wolfgang", jobname], dirname, reason=reason) + elif isinstance(req, tuple): + run(req, dirname, reason) else: error(os.path.join(dirname,jobname+".aux"), "unsupported request: %s"%req) numrun+=1 @@ -398,7 +400,7 @@ def processtexfiles(args): rmtempfile(tmplist, dirname) -re_logmatcher = re.compile("^LaTeX Warning: There were undefined references\.$|^LaTeX Warning: Label\(s\) may have changed\. Rerun to get cross-references right\.$|^REQ:(\d+):(\w+):") +re_logmatcher = re.compile("^LaTeX Warning: There were undefined references\.$|^LaTeX Warning: Label\(s\) may have changed\. Rerun to get cross-references right\.$|^REQ:(\d+):(\w+):REQ|^REQ:(\d+):(\w+):$") def requests(logpath): reqs = {} def addrequest(name, priority): @@ -408,16 +410,50 @@ def requests(logpath): reqs[name] = priority try: log = open(logpath) + inrequest = False for line in log: - m = re_logmatcher.match(line) - if m: - if m.group() == 'LaTeX Warning: There were undefined references.': - addrequest("latex",0) - elif m.group() == 'LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.': - addrequest("latex",0) - elif m.group(1)!=None: - addrequest(m.group(2), int(m.group(1))) - # TODO: add support for multiple bibliographies, see biblatex.pdf Sec. 2.4.4 + if inrequest: + # strip newline character + while line[-1] in ("\n", "\r"): + line = line[:-1] + if line[:7] == "binary=": + reqbinary = line[7:] + elif line[:7] == "option=": + reqoptions.extend(line[7:].split(" ")) + elif line[:7] == "infile=": + reqinfile = line[7:] + elif line == ":REQ": + if reqbinary != None: + if reqbinary not in ("bibtex", "bibtex8"): + error(logpath, "ignoring request to run %s for security reasons"%reqbinary, warning=True) + inrequest = False + continue + reqoptions[:0] = [reqbinary] + if reqbinary == "bibtex8": + reqoptions[1:1] = [ "--wolfgang" ] + if reqinfile != None: + reqoptions.append(reqinfile) + addrequest(tuple(reqoptions), reqpri) + inrequest=False + else: + error(logpath, "malformatted request ignored", warning=True) + inrequest=False + else: + m = re_logmatcher.match(line) + if m: + if m.group() == 'LaTeX Warning: There were undefined references.': + addrequest("latex",0) + elif m.group() == 'LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.': + addrequest("latex",0) + elif m.group(1)!=None: + addrequest(m.group(2), int(m.group(1))) + elif m.group(3)!=None: + inrequest = True + reqname = m.group(4) + reqpri = int(m.group(3)) + reqbinary = None + reqoptions = [] + reqinfile = None except IOError, (errno, strerror): error(logpath, "could not be read: %s"%strerror) else: |
