Re: [PATCH] pretty: Add %(trailer:X) to display single trailer
- From
Anders Waldenborg <anders@0x63.nu>
- Date
- Oct 31, 2018, 23:01 UTC
- Message-ID
- <87a7mtlnzr.fsf@0x63.nu>
- In-Reply-To
- <20181031202708.GA13021@sigill.intra.peff.net>
Jeff King writes:
Show 10 quoted lines
> On the other hand, if the rule were not "this affects the next > placeholder" but had a true ending mark, then we could make a real > parse-tree out of it, and format chunks of placeholders. E.g.: > > %(format:lpad=30,filename)%(subject) %(authordate)%(end) > > would pad and format the whole string with two placeholders. I know that > going down this road eventually involves reinventing XML, but I think > having an actual tree structure may not be an unreasonable thing to > shoot for.
Yes. I'm thinking that with [] for formatting specifiers and () for placeholders, {} would be available for nesting. E.g:
%[lpad=30,mangle]{%(subject) %ad%}> My main concern for now is to avoid introducing new > syntax that we'll be stuck with forever, even though it may later become > redundant (or worse, create parsing ambiguities).
Agreed.
I'm planning to work on the initial "trailer:key=" part later this week. Maybe I can play around with different formatting options and see how it affects the parser.