Skip to content

Commit 590d109

Browse files
authored
Merge pull request #12813 from quarto-dev/fix/init-lua-windows-check
lua - Correctly check Lua is running on windows
2 parents 245560d + 95c99a7 commit 590d109

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

src/resources/pandoc/datadir/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if pandoc.system.os == "windows" then
1+
if pandoc.system.os == "mingw32" then
22

33
local function get_windows_ansi_codepage()
44
-- Reading the code page directly out of the registry was causing
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Checking init.lua defines codepage stuff on windows
3+
format: native
4+
_quarto:
5+
tests:
6+
native: default
7+
filters:
8+
- at: pre-ast
9+
path: check-init.lua
10+
---
11+
12+
This document only serve to run the Lua filter to check init.lua correctly applies on Windows
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Meta = function(m)
2+
if (pandoc.system.os == "mingw32") then
3+
-- IMPORTANT: This is only valid on windows
4+
assert(_G.convert_from_utf8, "Required function 'convert_from_utf8' is missing from global scope on Windows. Something may be wrong with 'init.lua'")
5+
else
6+
assert(not _G.convert_from_utf8, "Function 'convert_from_utf8' is in global scope on non-Windows. Something may be wrong with 'init.lua'")
7+
end
8+
return m
9+
end

0 commit comments

Comments
 (0)