5 # Download a random, recent paper from arXiv and try to run llf on it.
7 # Note the most common problems are unmatched {, which LLF rejects,
8 # or an encoding other than UTF-8. These are not considered errors
11 root
=$
(dirname $
(readlink
-f "$0") )
14 discipline
=$
(dd if=/dev
/urandom count
=1 bs
=1 2>/dev
/null |
od -A none
-d)
15 discipline
=$
(( ${discipline} % 20 ))
17 0) discipline
="astro-ph"; ;;
18 1) discipline
="cond-mat"; ;;
19 2) discipline
="cs"; ;;
20 3) discipline
="econ"; ;;
21 4) discipline
="eess"; ;;
22 5) discipline
="gr-qc"; ;;
23 6) discipline
="hep-ex"; ;;
24 7) discipline
="hep-lat"; ;;
25 8) discipline
="hep-ph"; ;;
26 9) discipline
="hep-th"; ;;
27 10) discipline
="math"; ;;
28 11) discipline
="math-ph"; ;;
29 12) discipline
="nlin"; ;;
30 13) discipline
="nucl-ex"; ;;
31 14) discipline
="nucl-th"; ;;
32 15) discipline
="physics"; ;;
33 16) discipline
="q-bio"; ;;
34 17) discipline
="q-fin"; ;;
35 18) discipline
="quant-ph"; ;;
36 19) discipline
="stat"; ;;
39 absurl
=$
(curl
-s "http://export.arxiv.org/rss/${discipline}" |
grep -Eo '[^"<>]+arxiv.org/abs/[^"<>]+' |
sort -R |
head -n 1)
40 srcurl
=$
(printf %s
\\n
"${absurl}" |
sed -re 's/\/abs\//\/e-print\//')
41 srcname
=$
(printf %s
\\n
"${srcurl}" |
sed -re 's/.*\///')
42 curl
-Ls "${srcurl}" -o "${srcname}"
43 mime
=$
(file -bi "${srcname}" |
sed -re 's/;.*//')
47 tar -xf "${srcname}" 2>/dev/null >/dev/null || gunzip -c "${srcname}" > "${srcname}.raw"
50 tar -xf "${srcname}" 2>/dev/null >/dev/null || gunzip -c "${srcname}" > "${srcname}.raw"
54 printf 'No TeX source for %s\n' "${absurl}"
55 printf 'tmpdir = %s\n' "${tmpdir}"
59 printf 'Unknown mimetype %s at %s\n' "${mime}" ${tmpdir}
60 printf 'tmpdir = %s\n' "${tmpdir}"
70 mime
=$
(file -bi "${f}" |
sed -re 's/;.*//')
71 [ "${mime}" = "text/x-tex" ] ||
continue
77 "${root}/llf.lua" -c "${root}/llfrc.lua" < "${f}" 2>/dev
/null
> /dev
/null
&& continue
79 printf 'LLF could not handle %s\n' "${f}"
82 if [ "${err}" -eq 0 ]; then
83 printf 'All okay for %s\n' "${absurl}"
88 printf 'There were some errors for %s\n' "${absurl}"
89 printf 'tmpdir = %s\n' "${tmpdir}"