-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script to help diff rendered books
- Loading branch information
1 parent
3ff9591
commit 9aacfcc
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
# Remove files that are never affected by rustfmt or are otherwise uninteresting | ||
rm -rf tmp/book-before/css/ tmp/book-before/theme/ tmp/book-before/img/ tmp/book-before/*.js \ | ||
tmp/book-before/FontAwesome tmp/book-before/*.css tmp/book-before/*.png \ | ||
tmp/book-before/*.json tmp/book-before/print.html | ||
|
||
rm -rf tmp/book-after/css/ tmp/book-after/theme/ tmp/book-after/img/ tmp/book-after/*.js \ | ||
tmp/book-after/FontAwesome tmp/book-after/*.css tmp/book-after/*.png \ | ||
tmp/book-after/*.json tmp/book-after/print.html | ||
|
||
# Get all the html files before | ||
ls tmp/book-before/*.html | \ | ||
# Extract just the filename so we can reuse it easily. | ||
xargs -n 1 basename | \ | ||
while IFS= read -r filename; do | ||
# Remove any files that are the same before and after | ||
diff "tmp/book-before/$filename" "tmp/book-after/$filename" > /dev/null \ | ||
&& rm "tmp/book-before/$filename" "tmp/book-after/$filename" | ||
done |