-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Introduce an f-specification argument in ltcmd #1525
base: develop
Are you sure you want to change the base?
Conversation
Currently this is a draft: there are some clear open questions to answer before it is ready to merge
|
I'd maybe drop the warning on |
Is it possible in the architecture of Cf. the handling of the optional argument in |
As for the argument name, what about an upper case |
88e37f9
to
d55f3ba
Compare
Thinking here is that reading the arg. spec. should be clear: collecting an environment will allow newlines, so should be |
I thought about that - but the pattern we have at the moment is all uppercase specs relate to the matching lowercase in that they take an extra |
Whilst we don't currently do this, it would be possible to do a 'pre-scan' to establish if special settings are needed. The issue I think is that unlike say |
that pattern is strong and easy to understand so I don't think we should break it, thus that would rule |
Maybe a dumb Saturday evening idea, but what about using a special sort of processor? Right now |
I would think this is bound to produce problems forever. Besides, what you do with respect to chars being |
I see the idea, but we have a few things that mean I suspect it's not quite right
However, it does suggest something we could do - see parallel reply. |
I think @Skillmon's approach could work, with a logic for seeking an optional arg:
This could be done by adding an additional specifier (lets say |
Performance is not that bad, it's just |
I don't think we can use a group, and we have to deal with looping for spaces, but yes, I guess you are broadly right about performance. |
Good point about multiple |
One might well argue that both |
Of course you can use a group! You're doing right now for the
Yes, applying
My argumentation is that |
I think I'll implement the suggestion, we can look at it then decide if we need automation - that would mainly sit in a different part of the code so would still require the underlying |
d55f3ba
to
4193145
Compare
79ff942
to
4600c98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some typos. Only read the non-code part.
4600c98
to
c152931
Compare
I've made two adjustments here:
The second idea is partly-done. At present, you have to turn this on using a |
We could make life a little easier e.g. by saying that optional args before |
For the tokens in front of Regarding the tokens after it: There are two possibilities, imho, either throw an error or throw a warning (I think |
Also, we currently have no special handling of tokens in the same line as |
Based on the general
I think it's reasonable to exclude stuff after |
Like the end-of-env case, we get a choice here. We could special-case line one, in which case I would be minded to say that optional arguments don't need to worry about spaces ( I can see an argument for special-casing both the first and last line, but want to be sure we have consensus - all of this is doable, as I say. |
If I understand @Skillmon's comment correctly the command handling the grabbed f argument would need to know the last line before processing of the returned argument starts (so the prefix could be stripped from all lines) so returning an inline markup would be usable but not especially convenient |
Just an idea: Special handling of the first and last line could also be implemented as an argument processor and then split the Not sure how the policy is on argument processors only really usable on a single argument type. |
Yes, that is certainly a possible- although if the feeling is there should be a 'kernel position' on what syntax makes sense, then this would not quite be the way.
I think provided we can find a suitable non-clashing name, that's not a major concern. |
My feeling on the various questions I've left open
but I am happy to listen to alternative views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approve (perhaps with a bit more docu around the issues when using it in certain ways)
{ \@@_grab_D_call:Nw #1 } | ||
{ \@@_add_arg:o \c_novalue_tl } | ||
\cs_set_eq:NN \do \char_set_catcode_other:N | ||
\dospecials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is the definition of "the first line"? The line on which \begin
appears? In a document it is easy to say no tokens on that line are supported, but if the environment is placed into another definition (as we have seen in one example, there is no "line ending" within the definition.
\group_begin: | ||
\@@_grab_D_verb_safe:N #1 | ||
} | ||
#5 #1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be enough to document the technical issue, but perhaps with a bit more information than just saying "for technical reasons". More on the line o f
and the like is not a good idea, because it means ... in such and such ... situations, so better always use ...
it is a straight extension that allows documents to use syntax that wasn't allowed before, so doesn't really need a rollback. |
I don't have any strong views on that (and haven't thought about it much to be honest)
might be ok (to keep it simple), but it might need explaining that if "content" is delivered as part of a macro definition it is always on the "first line". I think the starting point was exactly such a scenario wasn't it? (with the environment being inside some other definition and som intro text inside) -- if so what would be the documented advice?
You have to allow for tokens and treat it as the last line of the content, but more importantly I think you need to allow for tokens after the Again, my argument is usage in an outer environment definitions where you may reasonably end up with
guess that still applies
Write up the user documentation and see if this is nicely explainable (and then decide if this syntax addition is really a good idea). |
As the idea here is '
Same point as above: you can't hide verb-like stuff in macro args. |
I'm not talking about verb in argument, I'm talking about a case like this:
|
Try that with |
there is no expectation that filecontents can be used or should be used for this (that is a simple packaging tool) and verbatim works (with the verbatim package) if you use the syntax without
This is a very comon use case and it handles tokens after \endverbatim inside the definition. |
I guess we need to sort this first then :) I modelled the current code on I've not looked at how the |
The grabbing of a nested |
I've squashed and rebased the work so far: I plan to add some new commits to adjust behaviour so they can be reviewed with a clear starting point :) |
6e59360
to
ca67aaf
Compare
See latex3/latex3#591.
Internal housekeeping
Status of pull request
Checklist of required changes before merge will be approved
\changes
entries in source includedchanges.txt
updatedltnewsX.tex
(and/orlatexchanges.tex
) updated