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 51
51
cp -r fonts/ /usr/share/fonts/
52
52
fc-cache
53
53
make all
54
- - name : Check layouts
54
+ - name : Run checks
55
55
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
61
57
- uses : actions/upload-artifact@v2
62
58
if : ${{ always() }}
63
59
with :
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ handouts:
36
36
convert -density 150 handout-beginner.pdf handout-beginner.png
37
37
convert -density 150 handout-intermediate.pdf handout-intermediate.png
38
38
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
+
39
47
.PHONY : fonts
40
48
fonts :
41
49
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 1
1
bump2version
2
2
cartopy==0.19.0.post1
3
3
matplotlib==3.4.2
4
+ pdfx
4
5
pip-tools
5
6
pre-commit
6
7
scipy
Original file line number Diff line number Diff line change @@ -12,10 +12,18 @@ bump2version==1.0.1
12
12
# via -r requirements.in
13
13
cartopy == 0.19.0.post1
14
14
# via -r requirements.in
15
+ cffi == 1.15.0
16
+ # via cryptography
15
17
cfgv == 3.2.0
16
18
# via pre-commit
19
+ chardet == 4.0.0
20
+ # via
21
+ # pdfminer.six
22
+ # pdfx
17
23
click == 8.0.0
18
24
# via pip-tools
25
+ cryptography == 35.0.0
26
+ # via pdfminer.six
19
27
cycler == 0.10.0
20
28
# via matplotlib
21
29
distlib == 0.3.1
@@ -40,6 +48,10 @@ numpy==1.19.5
40
48
# cartopy
41
49
# matplotlib
42
50
# scipy
51
+ pdfminer.six == 20201018
52
+ # via pdfx
53
+ pdfx == 1.4.1
54
+ # via -r requirements.in
43
55
pep517 == 0.10.0
44
56
# via pip-tools
45
57
pillow == 8.1.2
@@ -48,6 +60,8 @@ pip-tools==6.1.0
48
60
# via -r requirements.in
49
61
pre-commit == 2.11.1
50
62
# via -r requirements.in
63
+ pycparser == 2.20
64
+ # via cffi
51
65
pyparsing == 2.4.7
52
66
# via matplotlib
53
67
pyshp == 2.1.3
@@ -65,6 +79,8 @@ six==1.15.0
65
79
# cycler
66
80
# python-dateutil
67
81
# virtualenv
82
+ sortedcontainers == 2.4.0
83
+ # via pdfminer.six
68
84
toml == 0.10.2
69
85
# via
70
86
# pep517
You can’t perform that action at this time.
0 commit comments