summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua')
-rw-r--r--Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua20
1 files changed, 17 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
index 506b8bf9cf8..d7e27bc6cb9 100644
--- a/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
+++ b/Master/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua
@@ -37,6 +37,7 @@ local tcp = nil
local env_end = nil
local env_lines = nil
+local parent_env = nil
local last_code = nil
local last_output = nil
@@ -149,15 +150,28 @@ local function record_line(line)
end
function pyluatex.record_env(quiet)
- if quiet then
- env_end = "\\end{pythonq}"
+ local name
+ if parent_env ~= nil then
+ name = parent_env
+ parent_env = nil
else
- env_end = "\\end{python}"
+ if quiet then
+ name = "pythonq"
+ else
+ name = "python"
+ end
end
+ env_end = "\\end{" .. name .. "}"
env_lines = {}
luatexbase.add_to_callback("process_input_buffer", record_line, "pyluatex_record_line")
end
+function pyluatex.set_parent_env(name)
+ if parent_env == nil then
+ parent_env = name
+ end
+end
+
function pyluatex.run_file(path, write)
local f = io.open(path, "r")
if f then