[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Add a method of automatically sorting the spelling files



---
 data/spelling/Makefile              | 6 ++++++
 data/spelling/corrections           | 2 +-
 data/spelling/corrections-case      | 2 +-
 data/spelling/corrections-multiword | 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)
 create mode 100644 data/spelling/Makefile

diff --git a/data/spelling/Makefile b/data/spelling/Makefile
new file mode 100644
index 0000000..e475d72
--- /dev/null
+++ b/data/spelling/Makefile
@@ -0,0 +1,6 @@
+sort: sort-corrections sort-corrections-case sort-corrections-multiword
+
+sort-%: %
+	csplit --prefix $<- $< '/^$$/'
+	LANG=en_US sort $<-01 | cat $<-00 - > $<
+	rm -f $<-0[01]
diff --git a/data/spelling/corrections b/data/spelling/corrections
index ec35af5..ab01992 100644
--- a/data/spelling/corrections
+++ b/data/spelling/corrections
@@ -15,7 +15,7 @@
 # Note that corrections involving multiple word mistakes or case errors
 # should be included in the appropriate data file, rather than here.
 #
-# Please keep the list sorted (using the en_US locale).
+# Please keep the list sorted using `make sort`
 
 abandonned||abandoned
 abandonning||abandoning
diff --git a/data/spelling/corrections-case b/data/spelling/corrections-case
index 5c0d19d..8cd4371 100644
--- a/data/spelling/corrections-case
+++ b/data/spelling/corrections-case
@@ -6,7 +6,7 @@
 # The format of each line is:
 # mistake||correction
 #
-# Please keep the list sorted (using the en_US locale).
+# Please keep the list sorted using `make sort`
 
 american||American
 apache||Apache
diff --git a/data/spelling/corrections-multiword b/data/spelling/corrections-multiword
index cae8c06..559bbe1 100644
--- a/data/spelling/corrections-multiword
+++ b/data/spelling/corrections-multiword
@@ -5,7 +5,7 @@
 # The format of each line is:
 # SPELLING_MISTAKE_REGEX||correction
 #
-# Please keep the list sorted (using the en_US locale).
+# Please keep the list sorted using `make sort`
 
 (?i)allows to||allows one to
 (?i)allow to||allow one to
-- 
2.9.3


Reply to: