-
-
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
Overhaul include/preamble semantics (and lots of plumbing for the instantiation / run cycle) #1373
Conversation
I haven't actually implemented this change yet, just updated the CLI hints and man page for what I am proposing. This draft PR is a request for comment, especially from @simoncozens. Here is what the new bits of man page would be:
|
A couple more notes:
|
Erm, maybe I did not fully understand the point, but for many XML cases, I feel that the current "preamble" is actually what is needed: a document that will define the papersize, class and other settings or options, before processing the XML content. EDIT: Or maybe the above is covered by your |
I think (still playing with exactly which option does what) you would still be able to use a pre-document-document roughly like you are now, but with the new arguments I would envision you loading up a class using |
Ah I see the idea. In the cases I consider, it could perhaps be the same class, with different class options, but also:
For an actual use case, e.g. my XML lexicon is multi-lingual, my current preambles selects the main language and related options (e.g. the English version skips all French elements, the French version skips most of the English but keeps some of it such as glosses, since the definition come (more or less) from the English author. Currently it the same class, and the preambles (one for "fr", one for "en") just enables different settings for the specific output. Of course in that case, I could have maybe used class options rather than settings, but that could make a lot of them... And having to remember all those to pass as command line argument is also a bit unsatisfying. That is to say, I am unsure requiring a class only and playing with CLI options is the way to go. But I am not certain the above makes full sense either! |
I don't see any reason you couldn't mix and match. What you are doing is fine if that's what you want and I don't see any reason to change it. The issue I have is that there are things the current system will not let you accomplish. It also has weird gotchas like not being able to include SIL things that happen to have the same name as a Lua thing (or vise versa). There just isn't enough control currently. |
684dd78
to
560b991
Compare
BREAKING CHANGE: The `-I` / `--include` option was overloaded for more than one purpose and is now deprecated in favor of more specific replacements: `-r` / `--require` for loading code into SILE before input processing, `-p` / `--preamble` for processing content prior to a document and `-P` / `--postamble` for processing content after a document.
I started trying to fix the SILE.inputs table to make room for new things coming from the CLI—only to discover later that was for something else. That let to a yack shave and I decided the best thing to do was refactor some of the core libraries sooner rather than later to start cleaning up the name space. This let to a yack shave where I couldn't move some bits without doing it all at once, so I just blew it all up and put it back together again. All tests should pass before *and* after this commit with no changes to what is being tested. BREAKING CHANGE: Some internal files and APIs got renamed with more structured name spaces. In particular the inputter, shaper, and outputter libraries all have a common naming scheme now and sensible inheritance chains. No functionality was harmed, but if you are overriding undocumented internal Lua methods you might have to update your name spaces to match.
Previous versions of SILE created output files even if they were going to crash hard before writing anything into it. Current iterations wait until we at least do a few things like instantiate the class, so now we have a chance to fail before writing anything.
The output file and meta data is not instantiated later *after* we know what final paper size is. Previous versions started the PDF at one size and then changed it out from under the meta data.
607ff97
to
ac9c111
Compare
I realize there is more work to be done along these lines but testing and reasoning about all the changes in context with other developments was starting to get too hard in a branch. |
Closes #653
Closes #798
Closes #1092
Closes #1413
Lays groundwork for #1438
BREAKING CHANGE: The
-I
/--include
option whose use was overloaded for more than one purpose is deprecated in favor of more specific replacements:-r
/--require
for loading code into SILE before input processing,-p
/--preamble
for processing content prior to a document and-P
/--postamble
for processing content after a document.c.f. especially my latest romment