Skip to content

Commit

Permalink
Fixing bug in the resolution of image paths (#3 (comment))
Browse files Browse the repository at this point in the history
  • Loading branch information
fchauvel committed Aug 30, 2015
1 parent 8cd82b6 commit 934f994
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions flap/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def replacements_for(self, fragment, match):
return [ Fragment(fragment.file(), fragment.line_number(), graphicInclusion) ]

def select_image_file(self, fragment, match, path):
graphics = fragment.file().container().files_that_matches(path)
graphics = self.flap.file().container().files_that_matches(path)
if not graphics:
raise ValueError("Unable to find any file for graphic '%s' in '%s'" % (match.group(1), fragment.file().container().path()))
graphic = None
Expand Down Expand Up @@ -379,5 +379,4 @@ def on_include(self, fragment):

def on_include_SVG(self, fragment, graphicFile):
self._fileSystem.copy(graphicFile, self._output)
self._listener.on_include_SVG(fragment)

self._listener.on_include_SVG(fragment)
10 changes: 10 additions & 0 deletions tests/unit/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ def testLinksToSVGAreAdjusted(self):
self.verify_merged(r"A \includesvg{foo} Z")
self.verify_image("foo.svg")

def test_includesvg_in_separated_file(self):
self.create_main_file("A \\input{parts/foo} A")
self.create_tex_file("parts/foo.tex", "B \\includesvg{img/sources/test} B")
self.create_image("img/sources/test.svg")

self.run_flap()

self.verify_merged("A B \\includesvg{test} B A")
self.verify_image("test.svg")

def testSVGFilesAreCopiedEvenWhenJPGAreAvailable(self):
self.create_main_file(r"A \includesvg{img/foo} Z")

Expand Down

0 comments on commit 934f994

Please sign in to comment.