diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2006-09-15 15:14:50 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2006-09-15 15:14:50 +0000 |
commit | 25b6e47c8496418ba7d7680f5787bf2a41a9c9fc (patch) | |
tree | 4afef4775018ad4cfa7201e2ba228eb3bad1e460 /maintainers | |
parent | 0dc7b90c203d5948421fe9e7a77984e0318c8e79 (diff) |
* Keep a single empty line after comments.
svn path=/nixpkgs/trunk/; revision=6534
Diffstat (limited to 'maintainers')
-rw-r--r-- | maintainers/scripts/sort-attrs.str | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/maintainers/scripts/sort-attrs.str b/maintainers/scripts/sort-attrs.str index 3ce118f51f710..20063be8ef93d 100644 --- a/maintainers/scripts/sort-attrs.str +++ b/maintainers/scripts/sort-attrs.str @@ -63,7 +63,7 @@ rules <remove-section-start> x => (x', starts); <map(regularise-empty-lines); qsort(compare-attrs)> [x' | xs] => [x'' | xs']; <[] <+ \x -> ["\n\n\n" | x]\ > starts => starts'; - <debug; prepend-layout; debug> (starts', x'') => x''' + <prepend-layout> (starts', x'') => x''' \ })> groups => attrs'; <debug> "did it" @@ -100,11 +100,22 @@ rules // separate into lines, keeping the \n // last whitespace is significant, keep <list-sep-end(?10); split-init-last> cs => (init, last); - <debug; filter(where(fetch-elem(not(?10 <+ ?32)))); debug; concat> init => cs'; // remove whitespace-only lines - <concat> [<explode-string> "\n\n", cs', last] => cs''; // add one empty line - <debug> "A"; - <debug> cs; - <debug> cs'' + <regularise-empty-lines'> init => cs'; // remove whitespace-only lines + <concat> [<explode-string> "\n\n", <concat> 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 | <regularise-empty-lines'> xs] + where + <fetch-elem(not(?10 <+ ?32))> x; + <not(fetch-elem(not(?10 <+ ?32)))> y + + regularise-empty-lines': [x | xs] -> [x | <regularise-empty-lines'> xs] + where <fetch-elem(not(?10 <+ ?32))> x + + regularise-empty-lines': [x | xs] -> <regularise-empty-lines'> xs + where <not(fetch-elem(not(?10 <+ ?32)))> x prepend-layout: |