From 25b6e47c8496418ba7d7680f5787bf2a41a9c9fc Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 15 Sep 2006 15:14:50 +0000 Subject: [PATCH] * Keep a single empty line after comments. svn path=/nixpkgs/trunk/; revision=6534 --- maintainers/scripts/sort-attrs.str | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/maintainers/scripts/sort-attrs.str b/maintainers/scripts/sort-attrs.str index 3ce118f51f7..20063be8ef9 100644 --- a/maintainers/scripts/sort-attrs.str +++ b/maintainers/scripts/sort-attrs.str @@ -63,7 +63,7 @@ rules x => (x', starts); [x' | xs] => [x'' | xs']; <[] <+ \x -> ["\n\n\n" | x]\ > starts => starts'; - (starts', x'') => x''' + (starts', x'') => x''' \ })> groups => attrs'; "did it" @@ -100,11 +100,22 @@ rules // separate into lines, keeping the \n // last whitespace is significant, keep cs => (init, last); - init => cs'; // remove whitespace-only lines - [ "\n\n", cs', last] => cs''; // add one empty line - "A"; - cs; - cs'' + init => cs'; // remove whitespace-only lines + [ "\n\n", cs', last] => cs'' // add one empty line + + /* Dirty hack: *do* keep the first empty line following a non-empty line. !!! order matters */ + regularise-empty-lines': [] -> [] + + regularise-empty-lines': [x, y | xs] -> [x, y | xs] + where + x; + y + + regularise-empty-lines': [x | xs] -> [x | xs] + where x + + regularise-empty-lines': [x | xs] -> xs + where x prepend-layout: