[texworks] Lua scripting
Stefan Löffler
st.loeffler at gmail.com
Sun Jun 7 17:04:02 CEST 2009
Hi,
On 2009-06-07 16:13, Hans Hagen wrote:
> i have to wait til there is a windows binary, but looking at the txt
> file, why this syntax?
Why not build it yourself (there's a guide to it on the TW wiki) ;).
Anyway, the syntax is not as difficult as it seems, that was my bad. I
wrote the docs in a way suitable for direct integration with the TW
wiki. The "{{{" and "}}}" are part of the markup used there. You can see
examples of the header in the patch I posted, but I'll copy one here for
clarity:
--[[TeXworksScript
Title: Parse LaTeX Log (Example)
Description: Gives examples of how to modify the output log of a LaTeX run
Author: Stefan Löffler
Version: 0.1
Date: 2009-06-07
Script-Type: hook
Hook: AfterTypeset
]]
> why not just create a texworks table
>
> texworks = {
> key1 = value1,
> key2 = value2,
> }
>
> after loading the script, the lua instance in texworks can check this
> table (no parsing of the lua file needed)
>
> apart from this better fitting in the lua syntax than {{{ }}} it also
> makes syntax checking easier when writing scripts
The header gets parsed by TW before the script is loaded into the Lua
context, hence the information is provided in the comment. The problem
with using a Lua table is that AFAIK the whole script is compiled and
put on the stack as a single command. Hence TW can't (easily) access any
data in it. Anyway, I think providing the data in the comment isn't so
bad, the problem was just the markup in the documentation. Sorry for that.
-Stefan
More information about the texworks
mailing list