-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
%
in inline scripts
#450
Comments
No you're not missing something. The parser is looking for TeX like syntax features first before it parses what is inside or outside a script. This is actually pretty frustrating and i wish we had a better solution too. I'll just throw in the other major one is curly braces. These are pretty basic to Lua syntax but cannot be used in inline scripts. As a result almost all scripts have to be included from a separate file. It's almost silly to even support the inline syntax without being able to use basic Lua syntax, so I would like to see this fixed at some point. |
If the parser is checking for TeXlike syntax first, wouldn't it be possible to hack in = escape-with-backslash solution, as if it was parsing ordinary text? Obviously not a pretty solution, but it might work until a proper fix has been worked out? |
Just an extra note to mention this is also going to be a problem for other future features such as Lilypond support (#435). This really needs a proper fix so that a tag can wrap some other language and pass it's contents through to some other parser. |
Progress. I have reworked the LPEG grammar SILE uses to parse "TeX like" input to pass through |
Status report: as of last night this works for the command as well as environment form of |
Status report: as of now the environment form of script can now pass through braces to Lua. The command form will be a little trickier as it will need to count opening and closing braces rather than just skipping all of them to the end |
Status report: braces work in the command form For that case I'll need to work on the escaping syntax. However at least basic Lua functionality is now possible. |
Hi,
I'm new to SILE and not yet sure if I got it's "TeXlike" syntax right, but I could not find anything about this in SILE's official documentation. I was expecting the following MWE to work:
i.e. typesetting a "2". Yet SILE (current git master) fails with:
Obviously because the
%
is parsed as a comment in TeXLike mode. During ordinary text input you can escape it with a backslash in order to typeset a%
. I've also tried that in the MWE above, but SILE then fails with! [string "SILE.typesetter:typeset(tostring(5 "]:1: ')' expected near <eof> at test.sil l.2, col.1
.I've read in #92 that "TeXlike-mode is just for toy examples and tests" and so this might be considered a wont-fix, but then it might be helpful to mention in the official docs that in TeXlike mode all special characters (
\
,{
,}
, and%
) cannot be used in inline scripts? I'd love to be able to use%
in inline scripts as you could then usestring.format()
inline as well.But, perhaps I've just missed some relevant section in the documentation and there is already some special syntax for this?
The text was updated successfully, but these errors were encountered: