diff options
author | Lukas Schrangl <schrangl@iap.tuwien.ac.at> | 2019-07-02 17:37:12 (GMT) |
---|---|---|
committer | Lukas Schrangl <schrangl@iap.tuwien.ac.at> | 2019-07-02 17:37:12 (GMT) |
commit | 2ecf9b252ea0793c329cbde9d513fd67b65328f5 (patch) | |
tree | 7e4d77eb7e4609e3b8981ad713a47a3f6c3d052f /src | |
parent | b66be8353c8a0d5e188bade8610068e9ad18af9d (diff) | |
download | SCons-2ecf9b252ea0793c329cbde9d513fd67b65328f5.zip SCons-2ecf9b252ea0793c329cbde9d513fd67b65328f5.tar.gz SCons-2ecf9b252ea0793c329cbde9d513fd67b65328f5.tar.bz2 |
LaTeX scanner: Find > 1 includes per line
"^[^%\n]*" at the beginning of the reg ex would match all but the last
include so that they were lost. There is no point checking for "%" since
comments are stripped anyways, so just remove that part.
Also add test case for multiple includes per line.
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Scanner/LaTeX.py | 1 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/LaTeXTests.py | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py index f48c84d..ce4c310 100644 --- a/src/engine/SCons/Scanner/LaTeX.py +++ b/src/engine/SCons/Scanner/LaTeX.py @@ -187,7 +187,6 @@ class LaTeX(SCons.Scanner.Base): # lines), interfering with a match on the next line. # add option for whitespace before the '[options]' or the '{filename}' regex = r''' - ^[^%\n]* \\( include | includegraphics(?:\s*\[[^\]]+\])? diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py index 6dd7dac..409699c 100644 --- a/src/engine/SCons/Scanner/LaTeXTests.py +++ b/src/engine/SCons/Scanner/LaTeXTests.py @@ -61,6 +61,12 @@ test.write('test3.latex',r""" \includegraphics[width=60mm]{inc5.xyz} """) +test.write('test4.latex',r""" +\include{inc1}\include{inc2} +\only<1>{\includegraphics{inc5.xyz}}% +\only<2>{\includegraphics{inc7.png}} +""") + test.subdir('subdir') test.write('inc1.tex',"\n") @@ -73,6 +79,7 @@ test.write(['subdir', 'inc3c.tex'], "\n") test.write(['subdir', 'inc4.eps'], "\n") test.write('inc5.xyz', "\n") test.write('inc6.tex', "\n") +test.write('inc7.png', "\n") test.write('incNO.tex', "\n") # define some helpers: @@ -155,6 +162,15 @@ class LaTeXScannerTestCase3(unittest.TestCase): files = ['inc5.xyz', 'subdir/inc4.eps'] deps_match(self, deps, files) +class LaTeXScannerTestCase4(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(TEXINPUTS=[test.workpath("subdir")],LATEXSUFFIXES = [".tex", ".ltx", ".latex"]) + s = SCons.Scanner.LaTeX.LaTeXScanner() + path = s.path(env) + deps = s(env.File('test4.latex'), env, path) + files = ['inc1.tex', 'inc2.tex', 'inc5.xyz', 'inc7.png'] + deps_match(self, deps, files) + if __name__ == "__main__": unittest.main() |