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: