Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable LuaMetaTeX in ConTeXt tests and examples #557

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Witiko
Copy link
Owner

@Witiko Witiko commented Feb 20, 2025

This PR enables LuaMetaTeX in ConTeXt tests and examples after #551.

@Witiko Witiko added lua Related to the Lua interface and implementation technical debt Related to code smells and refactoring labels Feb 20, 2025
@Witiko Witiko added this to the 3.11.0 milestone Feb 20, 2025
@Witiko Witiko self-assigned this Feb 20, 2025
@Witiko Witiko force-pushed the fix/remove-selene-unicode branch from 600a7fc to 40aa8a2 Compare February 20, 2025 23:35
@Witiko Witiko changed the title Clean up code after #551 Reenable LuaMetaTeX and mention more contributors after #551 Feb 21, 2025
@Witiko Witiko force-pushed the fix/remove-selene-unicode branch 3 times, most recently from 8c981c0 to 98e0b37 Compare February 21, 2025 09:26
@Witiko Witiko changed the title Reenable LuaMetaTeX and mention more contributors after #551 Enable LuaMetaTeX in ConTeXt tests and examples Feb 21, 2025
@Witiko Witiko marked this pull request as draft February 21, 2025 10:02
@Witiko Witiko modified the milestones: 3.11.0, 3.11.1 Feb 21, 2025
@Witiko Witiko force-pushed the fix/remove-selene-unicode branch from 98e0b37 to c8aba5e Compare February 21, 2025 10:03
@Witiko Witiko added context Related to the ConTeXt interface and implementation and removed lua Related to the Lua interface and implementation labels Feb 21, 2025
@Witiko
Copy link
Owner Author

Witiko commented Feb 21, 2025

I wanted to test the new support for ConTeXt LMTX but I am still seeing some issues, namely the lack of support for the KPathSea library in LMTX, even in TeX Live, see the CI failure from this PR:

make FAIL_FAST=true test
make -C tests
make[1]: Entering directory '/__w/markdown/markdown/tests'
find testfiles/ -type f -name '*.test' -exec ./test.sh  {} +

Creating a Python virtual environment in /__w/markdown/markdown/tests/test-virtualenv.
2025-02-21 10:09:14,197 Running tests for 836 testfiles.
2025-02-21 10:09:14,197 Will fail at first error.
Testfile testfiles/regression/github/issue-508-fancy-lists.test:

  Some commands produced non-zero exit codes:
  - Command context [...] --luatex [...] test.tex [...] exited successfully.
  - Command context [...]          [...] test.tex [...] produced exit code 1.
  
  Some commands produced unexpected outputs:
  - Command context [...] --luatex [...] test.tex [...] produced expected output.
  - Command context [...]          [...] test.tex [...] produced unexpected output with the following diff:
  
    [...]

make[1]: *** [Makefile:13: all] Error 1
make[1]: Leaving directory '/__w/markdown/markdown/tests'
make: *** [Makefile:213: test] Error 2

Looking into the file test.log, I see the following:

lua error       > lua error on line 5 in file ./test.tex:

token call, execute: ...live/2024/texmf-dist/tex/context/base/mkiv/l-sandbox.lua:180: module 'kpse' not found:
	no field package.preload['kpse']
	no file '/usr/local/share/lua/5.5/kpse.lua'
	no file '/usr/local/share/lua/5.5/kpse/init.lua'
	no file '/usr/local/lib/lua/5.5/kpse.lua'
	no file '/usr/local/lib/lua/5.5/kpse/init.lua'
	no file './kpse.lua'
	no file './kpse/init.lua'
stack traceback:
	[C]: in upvalue 'requiem'
	...live/2024/texmf-dist/tex/context/base/mkiv/l-sandbox.lua:180: in function <...live/2024/texmf-dist/tex/context/base/mkiv/l-sandbox.lua:165>
	(...tail calls...)
	[ctxlua]:2: in main chunk
 1     % Load the package.
 2     \startluacode
 3     local kpse = require("kpse")
 4     kpse.set_program_name("luatex")
 5 >>  \stopluacode
 6     \usemodule[t][markdown]
 7     
 8     % Load the support files.
 9     \setupmarkdown [
10       eagerCache = false,
11       import = {
12         witiko/markdown/test = snippet as testsnippet,
13       }
14     ]
15

This is perhaps to be expected: Even if KPathSea is available for LuaMetaTeX in TeX Live, we apparently need to use the predefined object optional.kpse instead of require("kpse") according to luametatex.pdf. Regardless, KPathSea is unlikely to be widely available in ConTeXt standalone and therefore, we shouldn't rely on it.

@Witiko
Copy link
Owner Author

Witiko commented Feb 21, 2025

@andreiborisov: Can you please test that you can compile the example file examples/context-lmtx.tex using LMTX and version 3.11.0 of the Markdown package for TeX? You will need to remove the following part that loads KPathSea:

\startluacode
local kpse = require("kpse")
kpse.set_program_name("luatex")
\stopluacode

Furthermore, you will also need to copy all dependencies to the directory examples/. As discussed in #402 (comment), this includes at least the following files and packages from CTAN:

  1. The expl3-generic.tex plain TeX file from l3kernel
  2. The lua-uni-algos Lua package
  3. The lt3luabridge plain TeX package
  4. The tinyyaml Lua package

Please, let me know how that goes!

If you manage to compile the example document, I will use your feedback to hopefully have the CI running the LMTX tests and compiling the LMTX examples in the next version, to be released by the end of March at the latest. 🤞

This was referenced Feb 21, 2025
This was linked to issues Feb 21, 2025
@Witiko Witiko force-pushed the main branch 3 times, most recently from 97ee0f0 to 4902747 Compare March 11, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context Related to the ConTeXt interface and implementation technical debt Related to code smells and refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support LuaMetaTeX Support ConTeXt standalone
1 participant