File tree Expand file tree Collapse file tree 6 files changed +57
-6
lines changed Expand file tree Collapse file tree 6 files changed +57
-6
lines changed Original file line number Diff line number Diff line change 5151 cp -r fonts/ /usr/share/fonts/
5252 fc-cache
5353 make all
54- - name : Check layouts
54+ - name : Run checks
5555 run : |
56- set -x
57- [[ "$(pdfinfo cheatsheets.pdf | grep Pages | awk '{print $2}')" == "2" ]] || exit 1
58- [[ "$(pdfinfo handout-tips.pdf | grep Pages | awk '{print $2}')" == "1" ]] || exit 1
59- [[ "$(pdfinfo handout-beginner.pdf | grep Pages | awk '{print $2}')" == "1" ]] || exit 1
60- [[ "$(pdfinfo handout-intermediate.pdf | grep Pages | awk '{print $2}')" == "1" ]] || exit 1
56+ make check
6157 - uses : actions/upload-artifact@v2
6258 if : ${{ always() }}
6359 with :
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ handouts:
3636 convert -density 150 handout-beginner.pdf handout-beginner.png
3737 convert -density 150 handout-intermediate.pdf handout-intermediate.png
3838
39+ .PHONY : check
40+ check :
41+ ./check-num-pages.sh cheatsheets.pdf 2
42+ ./check-num-pages.sh handout-tips.pdf 1
43+ ./check-num-pages.sh handout-beginner.pdf 1
44+ ./check-num-pages.sh handout-intermediate.pdf 1
45+ ./check-links.py cheatsheets.pdf
46+
3947.PHONY : fonts
4048fonts :
4149 make -C fonts/
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ import sys
3+
4+ import pdfx
5+
6+
7+ pdf = pdfx .PDFx (sys .argv [1 ])
8+
9+ refs = [ref for ref in pdf .get_references () if ref .reftype == 'url' ]
10+
11+ status_codes = list (map (lambda ref : pdfx .downloader .get_status_code (ref .ref ), refs ))
12+
13+ broken_links = [refs [idx ].ref for idx in range (len (refs )) if status_codes [idx ] != 200 ]
14+
15+ # it seems that Twitter does not respond well to the link checker and throws a 400
16+ if all (['twitter.com' in url for url in broken_links ]):
17+ sys .exit (0 )
18+ else :
19+ print ('Broken links:' , broken_links )
20+ sys .exit (1 )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # Check that a given pdf has a certain number of pages.
4+ # Usage:
5+ # check-num-pages.sh [pdffile] [num_pages]
6+
7+ set -x
8+ pdffile=$1
9+ num_pages=$2
10+ [[ " $( pdfinfo $pdffile | grep Pages | awk ' {print $2}' ) " == " $num_pages " ]] || exit 1
Original file line number Diff line number Diff line change 11bump2version
22cartopy==0.19.0.post1
33matplotlib==3.4.2
4+ pdfx
45pip-tools
56pre-commit
67scipy
Original file line number Diff line number Diff line change @@ -12,10 +12,18 @@ bump2version==1.0.1
1212 # via -r requirements.in
1313cartopy == 0.19.0.post1
1414 # via -r requirements.in
15+ cffi == 1.15.0
16+ # via cryptography
1517cfgv == 3.2.0
1618 # via pre-commit
19+ chardet == 4.0.0
20+ # via
21+ # pdfminer.six
22+ # pdfx
1723click == 8.0.0
1824 # via pip-tools
25+ cryptography == 35.0.0
26+ # via pdfminer.six
1927cycler == 0.10.0
2028 # via matplotlib
2129distlib == 0.3.1
@@ -40,6 +48,10 @@ numpy==1.19.5
4048 # cartopy
4149 # matplotlib
4250 # scipy
51+ pdfminer.six == 20201018
52+ # via pdfx
53+ pdfx == 1.4.1
54+ # via -r requirements.in
4355pep517 == 0.10.0
4456 # via pip-tools
4557pillow == 8.1.2
@@ -48,6 +60,8 @@ pip-tools==6.1.0
4860 # via -r requirements.in
4961pre-commit == 2.11.1
5062 # via -r requirements.in
63+ pycparser == 2.20
64+ # via cffi
5165pyparsing == 2.4.7
5266 # via matplotlib
5367pyshp == 2.1.3
@@ -65,6 +79,8 @@ six==1.15.0
6579 # cycler
6680 # python-dateutil
6781 # virtualenv
82+ sortedcontainers == 2.4.0
83+ # via pdfminer.six
6884toml == 0.10.2
6985 # via
7086 # pep517
You can’t perform that action at this time.
0 commit comments