Просмотр исходного кода

Merge pull request #34350 from overleaf/mj-pandoc-texinputs

[clsi] Add TEXINPUTS variable to compressing conversion

GitOrigin-RevId: 7d708f106f6abf344707a87ba75a6e41f4023bd8
Mathias Jakobsen 2 месяцев назад
Родитель
Сommit
f52dccbee5

+ 6 - 1
services/clsi/app/js/ConversionManager.js

@@ -274,7 +274,12 @@ async function convertLaTeXToDocumentInDir(
     compileDir,
     Settings.pandocImage,
     timeoutMs,
-    {},
+    {
+      // By default pandoc uses cwd for resolving \input, \include, etc.
+      // Setting TEXINPUTS allows us to override that to look in the actual
+      // compileDir rather than the output directory.
+      TEXINPUTS: '..:',
+    },
     'conversions',
     outputId
   )

+ 6 - 0
services/clsi/test/unit/js/ConversionManager.test.js

@@ -433,6 +433,12 @@ describe('ConversionManager', function () {
           )
         })
 
+        it('should run the conversion and set the TEXINPUTS environment variable', function (ctx) {
+          expect(
+            ctx.CommandRunner.promises.run.firstCall.args[5]
+          ).toMatchObject({ TEXINPUTS: '..:' })
+        })
+
         it('should run pandoc then zip the subdirectory and return the zip path', function (ctx) {
           expect(ctx.CommandRunner.promises.run.callCount).toBe(2)
           expect(ctx.CommandRunner.promises.run.secondCall.args[1]).toEqual([