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

Use init.lua only for customizations #5287

Merged
merged 1 commit into from
Feb 9, 2019
Merged

Conversation

tarleb
Copy link
Collaborator

@tarleb tarleb commented Feb 9, 2019

The file init.lua in pandoc's data directory is run as part of
pandoc's Lua initialization process. Previously, the pandoc module was
loaded in init.lua, and the structure for marshaling was set-up after.
This allowed simple patching of element marshaling, but made using
init.lua more difficult:

  • it encouraged mixing essential initialization with user-defined
    customization;

  • upstream changes to init.lua had to be merged manually;

  • accidentally breaking marshaling by removing required modules was
    possible;

Instead, all required modules are now loaded before calling init.lua.
The file can be used entirely for user customization. Patching
marshaling functions, while discouraged, is still possible via the
debug module.

@tarleb tarleb force-pushed the lua-module-loading branch from 8634a26 to 7964e4a Compare February 9, 2019 19:13
@tarleb tarleb changed the title Lua module loading Use init.lua only for customizations Feb 9, 2019
The file `init.lua` in pandoc's data directory is run as part of
pandoc's Lua initialization process. Previously, the `pandoc` module was
loaded in `init.lua`, and the structure for marshaling was set-up after.
This allowed simple patching of element marshaling, but made using
`init.lua` more difficult:

  - it encouraged mixing essential initialization with user-defined
    customization;

  - upstream changes to init.lua had to be merged manually;

  - accidentally breaking marshaling by removing required modules was
    possible;

Instead, all required modules are now loaded before calling `init.lua`.
The file can be used entirely for user customization. Patching
marshaling functions, while discouraged, is still possible via the
`debug` module.
@tarleb tarleb force-pushed the lua-module-loading branch from 7964e4a to c8da49b Compare February 9, 2019 20:41
@jgm
Copy link
Owner

jgm commented Feb 9, 2019

Seems like a good idea to me!

@jgm jgm merged commit 75c791b into jgm:master Feb 9, 2019
@tarleb tarleb deleted the lua-module-loading branch December 23, 2019 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants