Skip to content

Commit 4a4edb5

Browse files
committed
add hunspell spell checks, fix bugs in generation of plaintext file
1 parent 0785e0b commit 4a4edb5

File tree

4 files changed

+566
-9
lines changed

4 files changed

+566
-9
lines changed

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ language: c++
99
# alternatives: gcc, clang, or both (as yaml list)
1010
compiler: clang
1111

12+
addons:
13+
apt:
14+
packages:
15+
- hunspell
16+
1217
install:
1318
-
1419

scripts/Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ all: \
1717
check-markdown \
1818
check-references \
1919
check-notabs \
20+
hunspell-check \
2021
cpplint-all \
2122
check-badchars
2223

@@ -78,6 +79,17 @@ check-badchars: $(SOURCEPATH) $(BUILD_DIR) Makefile
7879
if [ -s $(BUILD_DIR)/CppCoreGuidelines.md.badchars ]; then echo 'Warning: Undesired chars (–’‘“”¸…¦) found, use straight quotes instead:'; cat $(BUILD_DIR)/CppCoreGuidelines.md.badchars; false; fi;
7980

8081

82+
.PHONY: hunspell-check
83+
hunspell-check: $(BUILD_DIR)/plain-nohtml.txt
84+
hunspell -p hunspell/isocpp.dic -u < build/plain-nohtml.txt > $(BUILD_DIR)/hunspell-report.txt
85+
if [ -s $(BUILD_DIR)/hunspell-report.txt ]; then echo 'Warning: Spellcheck failed, fix words or add to dictionary:'; cat $(BUILD_DIR)/hunspell-report.txt; false; fi;
86+
87+
# only list words that are not in dict
88+
# to include all add them to bottom of hunspell/isocpp.dict, and run
89+
# cat hunspell/isocpp.dic | sort | uniq > hunspell/isocpp.dic2; mv hunspell/isocpp.dic2 hunspell/isocpp.dic
90+
.PHONY: hunspell-list
91+
hunspell-list: $(BUILD_DIR)/plain.txt
92+
hunspell -p hunspell/isocpp.dic -l < build/plain-nohtml.txt
8193

8294
#### Cpplint
8395

@@ -96,6 +108,9 @@ $(BUILD_DIR)/codeblocks: splitfile
96108

97109
$(BUILD_DIR)/plain.txt: splitfile
98110

111+
$(BUILD_DIR)/plain-nohtml.txt: $(BUILD_DIR)/plain.txt
112+
sed 's;<a \(name\|href\)=".*</a>;;g' $(BUILD_DIR)/plain.txt > $(BUILD_DIR)/plain-nohtml.txt
113+
99114
.PHONY: splitfile
100115
splitfile: $(SOURCEPATH) ./python/md-split.py
101116
python ./python/md-split.py $(SOURCEPATH) $(BUILD_DIR)/plain.txt $(BUILD_DIR)/codeblocks

0 commit comments

Comments
 (0)