-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Allow including TeX-flavor fragments instead of only whole documents #505
Comments
Is the I'll try to have a look today and see if I can figure out what's up. |
For the sake of the github post. The original included file has only got the macro definition in it. |
Wow yes this is as sticky little cart/horse problem and I broke it while adding other capabilities. Our file type detection wants to have its cake and eat it too, but I'm struggling to visualize how we can have both sets of nice things. I suspect the answer is going to be to stop trying to guess file types and just expect one of the other. We can't simultaneously sniff file types, allow valid comment syntaxs, and validate our own parsing tree. With auto-detecting whether percentage units were vertical or horizontal the "smart" behavior turned out to be both finicky and limiting. Requiring the user to specify the axis both reduced unexpected behavior quirks and enabled more complex layouts. Likewise I think sniffing every text file and input string and trying to figure out if it's Lua, TeX, or XML will turn into a fiasco. At the very least we'll have to stop pretending the first few bytes actually tell us anything and actually try to feed the whole blob to each parser until one of them doesn't croak. |
This issue is a ~~~duplicate~~~ near duplicate of #465. |
Closes sile-typesetter#465. See also sile-typesetter#505.
Closes sile-typesetter#465. See also sile-typesetter#505.
@kappa2222 As of just now the bulk of your issue should be fixed in the master branch. You can recompile sile from that and it should work as it did before I broke it. The catch is that "working" in this case still isn't quite what you expect. Sile can include a TeX-flavor file and splice it into the parsed tree where your include statement was, but it expects the included file to have a top level I am leaving this issue open to address that because it does seem like including a fragment like that should be possible, but actual regression bug was #465 and that is fixed. Now this is a feature request for a new behavior that would be more intuitive. |
I confirm that the problem is solved now, many thanks. I don't mind adding a |
@kappa2222 Do be aware when you include something any whitespace (including newlines) after the opening document tag and before the ending tag is going to get brought into your host document. It might happen that where you put the include this isn't a problem, but it might introduce unexpected spaces if you pull in inline content. What might have been discarded when rendering the include as a stand alone document might not get discarded at the include position. This seems like unexpected behavior to me and I've mentioned it in our outstanding whitespace issue #105. Not requiring the wrapping document tag would make including fragments more intuitive in my mind. |
Hello. I have two
.sil
filesand
When I compile this example I get:
I invoke sile like:
At first I thought Sile was not reading the file to include, but it's not like that because if I pass \include a wrong path I get a meaningful file-not-found error. Notice also the filename in the error message (which refers to the included) and the line (which refers to the includee).
The text was updated successfully, but these errors were encountered: