chore(pdf): fix build, switch latex package

This commit is contained in:
Steffen Jost 2022-06-07 12:59:02 +02:00
parent 6848758ee4
commit e95eb73d87
6 changed files with 28 additions and 21 deletions

View File

@ -22,8 +22,8 @@ let
uniworx.uniworx.components.exes.uniworx uniworx.uniworx.components.exes.uniworx
prev.dockerTools.binSh findutils coreutils prev.dockerTools.binSh findutils coreutils
cups # needed for interface with print center cups # needed for interface with print center
# texlive.combined.scheme-medium # Causes container to be too large! However, might be needed by the pandoc library to produce PDFs, but nix ought to include the necessary parts already texlive.combined.scheme-medium # Causes container to be too large! However, might be needed by the pandoc library to produce PDFs, but nix ought to include the necessary parts already
texlive.combined.scheme-basic # for PDFLaTeX for pandoc PDF creation #texlive.combined.scheme-basic # for PDFLaTeX for pandoc PDF creation
# pandoc # just for manual testing within the pod, remove for production, since we use the library instead! # pandoc # just for manual testing within the pod, remove for production, since we use the library instead!
curl wget netcat # just for manual testing within the pod, remove for production! curl wget netcat # just for manual testing within the pod, remove for production!
openldap # just for manual testing within the pod, remove for production! openldap # just for manual testing within the pod, remove for production!

20
routes
View File

@ -54,8 +54,8 @@
!/users/functionary-invite AdminFunctionaryInviteR GET POST !/users/functionary-invite AdminFunctionaryInviteR GET POST
!/users/add AdminUserAddR GET POST !/users/add AdminUserAddR GET POST
/admin AdminR GET /admin AdminR GET
/admin/test AdminTestR GET POST /admin/test AdminTestR GET POST
/admin/test/pdf AdminTestPdfR GET /admin/test/pdf AdminTestPdfR GET
/admin/errMsg AdminErrMsgR GET POST /admin/errMsg AdminErrMsgR GET POST
/admin/tokens AdminTokensR GET POST /admin/tokens AdminTokensR GET POST
/admin/crontab AdminCrontabR GET /admin/crontab AdminCrontabR GET
@ -69,7 +69,7 @@
/info/glossary GlossaryR GET !free /info/glossary GlossaryR GET !free
/info/faq FaqR GET !free /info/faq FaqR GET !free
/version VersionR GET !free /version VersionR GET !free
/status StatusR GET !free /status StatusR GET !free
/help HelpR GET POST !free /help HelpR GET POST !free
@ -96,7 +96,7 @@
/grades EEGradesR GET POST !exam-office /grades EEGradesR GET POST !exam-office
/staff-invite EEStaffInviteR GET POST /staff-invite EEStaffInviteR GET POST
/correct EECorrectR GET POST /correct EECorrectR GET POST
/term TermShowR GET !free /term TermShowR GET !free
/term/current TermCurrentR GET !free /term/current TermCurrentR GET !free
@ -110,7 +110,7 @@
!/school/new SchoolNewR GET POST !/school/new SchoolNewR GET POST
/school/#SchoolId SchoolR: /school/#SchoolId SchoolR:
/ SchoolEditR GET POST / SchoolEditR GET POST
/allocation/ AllocationListR GET !free /allocation/ AllocationListR GET !free
!/allocation/new AllocationNewR GET POST !allocation-admin !/allocation/new AllocationNewR GET POST !allocation-admin
@ -255,17 +255,17 @@
!/*WellKnownFileName WellKnownR GET !free !/*WellKnownFileName WellKnownR GET !free
-- for users -- for users
/qualification QualificationAllR GET !free /qualification QualificationAllR GET !free
/qualification/#SchoolId QualificationSchoolR GET !free /qualification/#SchoolId QualificationSchoolR GET !free -- TODO
/qualification/#SchoolId/#QualificationShorthand QualificationR GET !free -- must be logged in though /qualification/#SchoolId/#QualificationShorthand QualificationR GET !free -- must be logged in though
-- OSIS CSV Export Demo -- OSIS CSV Export Demo
/lms LmsAllR GET POST /lms LmsAllR GET POST
/lms/#SchoolId LmsSchoolR GET /lms/#SchoolId LmsSchoolR GET
/lms/#SchoolId/#QualificationShorthand LmsR GET POST /lms/#SchoolId/#QualificationShorthand LmsR GET POST
/lms/#SchoolId/#QualificationShorthand/edit LmsEditR GET POST /lms/#SchoolId/#QualificationShorthand/edit LmsEditR GET POST
/lms/#SchoolId/#QualificationShorthand/users LmsUsersR GET /lms/#SchoolId/#QualificationShorthand/users LmsUsersR GET
/lms/#SchoolId/#QualificationShorthand/users/direct LmsUsersDirectR GET /lms/#SchoolId/#QualificationShorthand/users/direct LmsUsersDirectR GET
/lms/#SchoolId/#QualificationShorthand/userlist LmsUserlistR GET POST /lms/#SchoolId/#QualificationShorthand/userlist LmsUserlistR GET POST
/lms/#SchoolId/#QualificationShorthand/userlist/upload LmsUserlistUploadR GET POST /lms/#SchoolId/#QualificationShorthand/userlist/upload LmsUserlistUploadR GET POST
/lms/#SchoolId/#QualificationShorthand/userlist/direct LmsUserlistDirectR POST /lms/#SchoolId/#QualificationShorthand/userlist/direct LmsUserlistDirectR POST

View File

@ -71,6 +71,6 @@ let
in pkgs.mkShell { in pkgs.mkShell {
name = "uni2work"; name = "uni2work";
nativeBuildInputs = [develop inDevelop killallUni2work diffRunning] nativeBuildInputs = [develop inDevelop killallUni2work diffRunning]
++ (with pkgs; [ nodejs-14_x postgresql_12 openldap google-chrome exiftool memcached minio minio-client gup skopeo texlive.combined.scheme-basic ]) ++ (with pkgs; [ nodejs-14_x postgresql_12 openldap google-chrome exiftool memcached minio minio-client gup skopeo texlive.combined.scheme-medium ])
++ (with pkgs.haskellPackages; [ stack yesod-bin hlint cabal-install weeder profiteur ]); ++ (with pkgs.haskellPackages; [ stack yesod-bin hlint cabal-install weeder profiteur ]);
} }

View File

@ -276,8 +276,8 @@ postAdminTestR = do
getAdminTestPdfR :: Handler TypedContent getAdminTestPdfR :: Handler TypedContent
getAdminTestPdfR = do getAdminTestPdfR = do
let -- typePDF = "application/pdf" :: ContentType -- let -- typePDF = "application/pdf" :: ContentType
-- typePDF = Settings.Mime.mimeLookup "pdfdemo.pdf" -- typePDF = Settings.Mime.mimeLookup "pdfdemo.pdf"
content <- liftIO . P.runIO $ do content <- liftIO . P.runIO $ do
tmpl <- P.compileDefaultTemplate "latex" tmpl <- P.compileDefaultTemplate "latex"
let let
@ -285,7 +285,8 @@ getAdminTestPdfR = do
texopts = [] texopts = []
writeropts = def { P.writerTemplate = Just tmpl } writeropts = def { P.writerTemplate = Just tmpl }
doc <- P.readMarkdown def md doc <- P.readMarkdown def md
P.makePDF "pdflatex" texopts P.writeLaTeX writeropts doc P.makePDF "pdflatex" texopts P.writeLaTeX writeropts doc -- xcolor.sty not found
-- P.makePDF "lualatex" texopts P.writeLaTeX writeropts doc -- unicode-math.sty not found
case content of case content of
Right (Right bs) -> do Right (Right bs) -> do
liftIO $ L.writeFile "generated.pdf" bs liftIO $ L.writeFile "generated.pdf" bs

View File

@ -66,6 +66,9 @@
Some icons: ^{isVisible False} ^{hasComment True} Some icons: ^{isVisible False} ^{hasComment True}
<section> <section>
<h2>Download a generated PDF <h2>
Here is a Erzeugtes PDF herunterladen:
<a href=@{AdminTestPdfR}>Download-Link Hier ist ein
<a href=@{AdminTestPdfR}>
Download-Link
für eine PDF Vorschau.

View File

@ -67,6 +67,9 @@
Some icons: ^{isVisible False} ^{hasComment True} Some icons: ^{isVisible False} ^{hasComment True}
<section> <section>
<h2>Download a generated PDF <h2>
Download a generated PDF
Here is a Here is a
<a href=@{AdminTestPdfR}>Download-Link <a href=@{AdminTestPdfR}>
Download-Link
for a preview.