From b536c412a885ab13f79b81c622e2f3de80ef1b15 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 17 Jun 2014 00:46:17 +0200 Subject: [PATCH] Reverting useless commit Revert "Added \obeylines command to verse, verse* and chorus environments." This reverts commit 315915221ce241c4b7f6848fb360c48590c974e1. --- songbook_core/data/latex/songs_minimal.sty | 8 ------ songbook_core/errors.py | 12 -------- songbook_core/plastex.py | 32 +++------------------- 3 files changed, 4 insertions(+), 48 deletions(-) delete mode 100644 songbook_core/data/latex/songs_minimal.sty diff --git a/songbook_core/data/latex/songs_minimal.sty b/songbook_core/data/latex/songs_minimal.sty deleted file mode 100644 index 7c3b8a51..00000000 --- a/songbook_core/data/latex/songs_minimal.sty +++ /dev/null @@ -1,8 +0,0 @@ -% Minimal songs.sty package, to be loaded by the songbook_core library, by the -% PlasTeX packages. Some songs.sty commands are implemented in Python, in the -% songbook_core/plastex*.py packages, and some commands are implemented in this -% file. - -\newenvironment{chorus}{\obeylines}{} -\newenvironment{verse}{\obeylines}{} -\newenvironment{verse*}{\obeylines}{} diff --git a/songbook_core/errors.py b/songbook_core/errors.py index 27b15775..b8e73466 100644 --- a/songbook_core/errors.py +++ b/songbook_core/errors.py @@ -85,15 +85,3 @@ class UnknownStep(SongbookError): def __str__(self): return """Compilation step "{step}" unknown.""".format(step=self.step) - -class LatexImportError(SongbookError): - """Could not import package.""" - - def __init__(self, package): - super(LatexImportError, self).__init__() - self.package = package - - def __str__(self): - return """Error while importing LaTeX package "{}".""".format( - self.package - ) diff --git a/songbook_core/plastex.py b/songbook_core/plastex.py index 0d4e14eb..b743bd00 100644 --- a/songbook_core/plastex.py +++ b/songbook_core/plastex.py @@ -11,9 +11,6 @@ import locale import os import sys -from songbook_core import __DATADIR__ -from songbook_core import errors - def process_unbr_spaces(node): r"""Replace '~' and '\ ' in node by nodes that @@ -52,37 +49,16 @@ class SongParser(object): """Analyseur syntaxique de fichiers .sg""" @staticmethod - def load_package(tex, package): - """Wrapper to 'tex.ownerDocument.context.loadPackage' catching errors. - """ - if not tex.ownerDocument.context.loadPackage(tex, package): - raise errors.LatexImportError(package) - - @classmethod - def create_tex(cls): + def create_tex(): """Create a TeX object, ready to parse a tex file.""" tex = TeX() tex.disableLogging() tex.ownerDocument.context.loadBaseMacros() - - # Setting paths sys.path.append(os.path.dirname(__file__)) - old_texinputs = os.environ.get("TEXINPUTS", '') - os.environ["TEXINPUTS"] = "{}:{}".format( - old_texinputs, - os.path.join(__DATADIR__, "latex"), - ) - - # Loading packages - cls.load_package(tex, "plastex_patchedbabel") - cls.load_package(tex, "plastex_chord") - cls.load_package(tex, "plastex_songs") - cls.load_package(tex, "songs_minimal.sty") - - # Unsetting paths + tex.ownerDocument.context.loadPackage(tex, "plastex_patchedbabel") + tex.ownerDocument.context.loadPackage(tex, "plastex_chord") + tex.ownerDocument.context.loadPackage(tex, "plastex_songs") sys.path.pop() - os.environ["TEXINPUTS"] = old_texinputs - return tex @classmethod