From: Karthik Nayak Date: Thu, 03 Sep 2015 16:01:04 GMT Subject: Re: [PATCH v15 05/13] ref-filter: implement an `align` atom Message-ID: In-Reply-To: On Thu, Sep 3, 2015 at 7:42 PM, Eric Sunshine wrote: > On Tue, Sep 1, 2015 at 2:26 PM, Karthik Nayak wrote: >> Implement an `align` atom which left-, middle-, or right-aligns the >> content between %(align:..) and %(end). > > Spell this either %(align:) or %(align:...) with three dots, not two. > I, personally, think %(align:) is sufficient. > Will change. >> It is followed by `:,`, where the `` is >> either left, right or middle and `` is the size of the area >> into which the content will be placed. If the content between >> %(align:) and %(end) is more than the width then no alignment is >> performed. e.g. to align a refname atom to the middle with a total >> width of 40 we can do: --format="%(align:middle,40)%(refname)%(end)". >> >> We have an `at_end` function for each element of the stack which is to >> be called when the `end` atom is encountered. Using this we implement >> the aling_handler() for the `align` atom, this aligns the final strbuf >> by calling `strbuf_utf8_align()` from utf8.c. >> >> Ensure that quote formatting is performed on the whole of >> %(align)...%(end) rather than individual atoms inside. We skip quote > > Add colon: %(align:) > Okay. >> formatting for individual atoms when the current stack element is >> handling an %(align) atom and perform quote formatting at the end when > > %(align:) > will do. >> we encounter the %(end) atom. >> >> Add documentation and tests for the same. >> >> Signed-off-by: Karthik Nayak >> --- >> diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt >> index e49d578..cac3128 100644 >> --- a/Documentation/git-for-each-ref.txt >> +++ b/Documentation/git-for-each-ref.txt >> @@ -127,6 +127,15 @@ color:: >> Change output color. Followed by `:`, where names >> are described in `color.branch.*`. >> >> +align:: >> + Left-, middle-, or right-align the content between %(align:..) > > %(align:) > noted. >> + and %(end). Followed by `:,`, where the >> + `` is either left, right or middle and `` is >> + the total length of the content with alignment. If the >> + contents length is more than the width then no alignment is >> + performed. If used with '--quote' everything in between >> + %(align:..) and %(end) is quoted. > > %(align:) > Also drop the extra space before "and": s/\s+and/ and/ > Noted, thanks for the review. -- Regards, Karthik Nayak