From 395fb8f9f4e13f0ca30b93c7b419c22a4625e5c4 Mon Sep 17 00:00:00 2001 From: Karthik Nayak Date: Wed, 17 Feb 2016 23:36:16 +0530 Subject: 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=,position=)". Add Documentation and tests for the same. Helped-by: Eric Sunshine Signed-off-by: Karthik Nayak Reviewed-by: Eric Sunshine Signed-off-by: Junio C Hamano --- ref-filter.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ref-filter.c') 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; -- cgit v1.2.3