diff options
author | Karthik Nayak <karthik.188@gmail.com> | 2016-02-17 21:06:16 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-18 01:06:45 +0300 |
commit | 395fb8f9f4e13f0ca30b93c7b419c22a4625e5c4 (patch) | |
tree | d70f0bd2c3233ec4c54ede84c458c4693a713ab0 /ref-filter.c | |
parent | 5bd881d998d6475b8a866af00b1a4d4e6b04c2cc (diff) |
ref-filter: align: introduce long-form syntax
Introduce optional prefixes "width=" and "position=" for the align atom
so that the atom can be used as "%(align:width=<width>,position=<position>)".
Add Documentation and tests for the same.
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.c')
-rw-r--r-- | ref-filter.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ref-filter.c b/ref-filter.c index 797f9fe2d8..2255dcc6c5 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -78,7 +78,15 @@ static void align_atom_parser(struct used_atom *atom, const char *arg) const char *s = params.items[i].string; int position; - if (!strtoul_ui(s, 10, &width)) + if (skip_prefix(s, "position=", &s)) { + position = parse_align_position(s); + if (position < 0) + die(_("unrecognized position:%s"), s); + align->position = position; + } else if (skip_prefix(s, "width=", &s)) { + if (strtoul_ui(s, 10, &width)) + die(_("unrecognized width:%s"), s); + } else if (!strtoul_ui(s, 10, &width)) ; else if ((position = parse_align_position(s)) >= 0) align->position = position; |