[gedit-latex/remove-tools: 4/4] Remove PostProcessors
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex/remove-tools: 4/4] Remove PostProcessors
- Date: Fri, 24 Jun 2011 23:36:34 +0000 (UTC)
commit 76aa6c65464c036ce50a25b609a097f70800fbd2
Author: John Stowers <john stowers gmail com>
Date: Sat Jun 25 01:50:04 2011 +1200
Remove PostProcessors
* LaTeX and Rubber support should be added to the
externaltools plugin
latex/latex/preview.py | 4 +-
latex/tools/postprocess.py | 131 --------------------------------------------
2 files changed, 2 insertions(+), 133 deletions(-)
---
diff --git a/latex/latex/preview.py b/latex/latex/preview.py
index 2f89813..d90cc4e 100644
--- a/latex/latex/preview.py
+++ b/latex/latex/preview.py
@@ -24,7 +24,7 @@ latex.preview
from ..base import File
from ..tools import Tool, Job, ToolRunner
-from ..tools.postprocess import RubberPostProcessor, GenericPostProcessor
+from ..tools.postprocess import GenericPostProcessor
from ..issues import MockStructuredIssueHandler
from environment import Environment
@@ -59,7 +59,7 @@ class ImageToolGenerator(object):
tool = Tool(label=self._names[self.format], jobs=[], description="", accelerator="", extensions=[])
# use rubber to render a DVI
- tool.jobs.append(Job("rubber --force --short --inplace \"$filename\"", True, RubberPostProcessor))
+ tool.jobs.append(Job("rubber --force --short --inplace \"$filename\"", True, GenericPostProcessor))
if self.render_box:
# DVI -> PS
diff --git a/latex/tools/postprocess.py b/latex/tools/postprocess.py
index b4c2a6e..2a2f9b8 100644
--- a/latex/tools/postprocess.py
+++ b/latex/tools/postprocess.py
@@ -94,134 +94,3 @@ class GenericPostProcessor(PostProcessor):
@property
def summary(self):
return self._summary
-
-
-class LaTeXPostProcessor(PostProcessor):
- """
- This post-processor generates messages from a standard LaTeX log with
- default error format (NOT using "-file-line-error")
- """
-
- _log = getLogger("LatexPostProcessor")
-
- name = "LaTeXPostProcessor"
-
- _PATTERN = pattern = re.compile(r"(^! (?P<text>.*?)$)|(^l\.(?P<line>[0-9]+))", re.MULTILINE)
-
- def __init__(self):
- pass
-
- def process(self, file, stdout, stderr, condition):
- self._file = file
-
- @property
- def successful(self):
- return True
-
- @property
- def summary(self):
- return self._summary
-
- @property
- def issues(self):
- try:
- log = open("%s.log" % self._file.shortname).read()
-
- # check for wrong format
- if log.find("file:line:error") > 0:
- return [Issue("The file:line:error format is not supported. Please remove that switch.", None, None, self._file, Issue.SEVERITY_ERROR)]
-
- # process log file and extract tuples like (message, line)
- tuples = []
- for match in self._PATTERN.finditer(log):
- if match.group("text"):
- tuple = [match.group("text"), 0]
- elif match.group("line"):
- tuple[1] = match.group("line")
- tuples.append(tuple)
-
- # generate issues from tuples
- self._issues = []
- for tuple in tuples:
- text = tuple[0]
- line = int(tuple[1]) - 1
- self._issues.append(Issue(text, line, None, self._file, Issue.SEVERITY_ERROR, Issue.POSITION_LINE))
-
- return self._issues
-
- except IOError:
- return [Issue("No LaTeX log file found", None, None, self._file, Issue.SEVERITY_ERROR)]
-
-
-class RubberPostProcessor(PostProcessor):
- """
- This is a post-processor for rubber
- """
-
- _log = getLogger("RubberPostProcessor")
-
- name = "RubberPostProcessor"
-
- _pattern = re.compile(r"(?P<file>[a-zA-Z0-9./_-]+)(:(?P<line>[0-9\-]+))?:(?P<text>.*?)$", re.MULTILINE)
-
- def __init__(self):
- self._issues = None
- self._summary = None
- self._successful = False
-
- # FIXME: circ dep
- from ..preferences import Preferences
-
- self._hide_box_warnings = Preferences().get_bool("HideBoxWarnings", False)
-
- @property
- def successful(self):
- return self._successful
-
- @property
- def issues(self):
- return self._issues
-
- @property
- def summary(self):
- return self._summary
-
- def process(self, file, stdout, stderr, condition):
- from ..base import File # FIXME: this produces a circ dep on toplevel
-
- self._issues = []
-
- self._log.debug("process(): stdout=\"%s\", stderr=\"%s\"" % (stdout, stderr))
-
- self._successful = not bool(condition)
-
- for match in self._pattern.finditer(stderr):
- severity = Issue.SEVERITY_ERROR
-
- # text
- text = match.group("text")
-
- if "Underfull" in text or "Overfull" in text:
- if self._hide_box_warnings:
- continue
- else:
- severity = Issue.SEVERITY_WARNING
-
- # line(s)
- lineFrom, lineTo = None, None
-
- line = match.group("line")
-
- if line:
- parts = line.split("-")
- lineFrom = int(parts[0]) - 1
- if len(parts) > 1:
- lineTo = int(parts[1]) - 1
-
- # filename
- filename = "%s/%s" % (file.dirname, match.group("file"))
-
- self._issues.append(Issue(escape(text), lineFrom, lineTo, File(filename), severity, Issue.POSITION_LINE))
-
-
-
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]