From 50ec9b90df09467c289a3499d4733c1b2c5ed3ef Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 23 May 2025 12:42:21 +0200 Subject: [PATCH 1/2] lua - Correctly check Lua is running on windows Follow up on #12806 --- src/resources/pandoc/datadir/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/pandoc/datadir/init.lua b/src/resources/pandoc/datadir/init.lua index 778402383c4..57da17d70b7 100644 --- a/src/resources/pandoc/datadir/init.lua +++ b/src/resources/pandoc/datadir/init.lua @@ -1,4 +1,4 @@ -if pandoc.system.os == "windows" then +if pandoc.system.os == "mingw32" then local function get_windows_ansi_codepage() -- Reading the code page directly out of the registry was causing From 95c99a7a6968d5e73c23482be00872fe417bb8f8 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 23 May 2025 12:58:15 +0200 Subject: [PATCH 2/2] test - add a simple test to avoid future problems --- tests/docs/smoke-all/2025/05/23/12806.qmd | 12 ++++++++++++ tests/docs/smoke-all/2025/05/23/check-init.lua | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/docs/smoke-all/2025/05/23/12806.qmd create mode 100644 tests/docs/smoke-all/2025/05/23/check-init.lua diff --git a/tests/docs/smoke-all/2025/05/23/12806.qmd b/tests/docs/smoke-all/2025/05/23/12806.qmd new file mode 100644 index 00000000000..660c5226e95 --- /dev/null +++ b/tests/docs/smoke-all/2025/05/23/12806.qmd @@ -0,0 +1,12 @@ +--- +title: Checking init.lua defines codepage stuff on windows +format: native +_quarto: + tests: + native: default +filters: + - at: pre-ast + path: check-init.lua +--- + +This document only serve to run the Lua filter to check init.lua correctly applies on Windows \ No newline at end of file diff --git a/tests/docs/smoke-all/2025/05/23/check-init.lua b/tests/docs/smoke-all/2025/05/23/check-init.lua new file mode 100644 index 00000000000..2f87b88ed9a --- /dev/null +++ b/tests/docs/smoke-all/2025/05/23/check-init.lua @@ -0,0 +1,9 @@ +Meta = function(m) + if (pandoc.system.os == "mingw32") then + -- IMPORTANT: This is only valid on windows + assert(_G.convert_from_utf8, "Required function 'convert_from_utf8' is missing from global scope on Windows. Something may be wrong with 'init.lua'") + else + assert(not _G.convert_from_utf8, "Function 'convert_from_utf8' is in global scope on non-Windows. Something may be wrong with 'init.lua'") + end + return m +end \ No newline at end of file