Hi,
Thanks for your inputs Aditya and Bruce.
I’m still having some issues when trying to include the output of the filter module within lua.
MNWE:
\defineexternalfilter
[sympy]
[filtercommand={/Users/aleks/miniconda3/bin/python3 \externalfilterinputfile\space > \externalfilteroutputfile},
bufferbefore=init,
output={\externalfilterbasefile.out},
readcommand=\typefile,
read=no,]
\startbuffer[init]
from sympy import *
\stopbuffer
\starttext
\startluacode
local deg2rad = [[
%\startsympy
print(latex(rad(%angleVal%)))
%\stopsympy
]]
local calcTrigFunction = [[
\startsympy
from sympy import *
print(latex(%fname%(rad(%angleVal%))))
\stopsympy
]]
local angleList = {0, 30, 45, 60, 90, 120, 135, 150, 180, 210, 225, 240, 270, 300, 315, 330, 360}
for _, a in ipairs(angleList) do
context.templates[calcTrigFunction] {
fname = "sin",
angleVal = a
}
end
\stopluacode
\stoptext
In particular, it fails as soon as \startsympy and \stopsympy are part of the template. Should I protect these?