X-Git-Url: https://git.plutz.net/?p=confetti;a=blobdiff_plain;f=courses%2Fexport_pdf.sh;h=92e10c5f900626b0805da4224f3b5599bcbec039;hp=3e5593d2b8a439a4b13d1dd622ea064a11e765be;hb=HEAD;hpb=92a5321fb50469eeaab98028c8c3afcda24cdf42 diff --git a/courses/export_pdf.sh b/courses/export_pdf.sh index 3e5593d..92e10c5 100755 --- a/courses/export_pdf.sh +++ b/courses/export_pdf.sh @@ -7,16 +7,16 @@ coursefile="${_DATA}/ical/$(GET course)" if [ ! -r "$coursefile" ]; then SET_COOKIE 0 message="Cannot read course file" - REDIRECT /courses/ + REDIRECT "${_BASE}/courses/" return 0 elif ! mkdir -p "$_DATA/export"; then SET_COOKIE 0 message="Cannot create export directory" - REDIRECT /courses/ + REDIRECT "${_BASE}/courses/" return 0 fi ics="$(pdi_load "$coursefile")" -htmlfile="${_DATA}/export/$(pdi_value "$ics" SUMMARY |URL |tr / _).html" +htmlfile="${_DATA}/export/$(pdi_value "$ics" SUMMARY |unescape |tr \\n/ __).html" pdffile=${htmlfile%.html}.pdf pdi_date() { @@ -123,10 +123,10 @@ style_td='style="border: 1pt solid; padding: 1mm 2mm; vertical-align: top;"' ]] EOF -export HOME="$_DATA" +export HOME="$_DATA/" export XDG_CONFIG_HOME="$_DATA/xdg_config" export XDG_CACHE_HOME="$_DATA/xdg_cache" export XDG_DATA_HOME="$_DATA/xdg_local" lowriter --convert-to pdf --outdir "$_DATA/export/" "$htmlfile" >/dev/null -REDIRECT "/export/${pdffile##*/}" +REDIRECT "$(URL "${_BASE}/export/${pdffile##*/}")"