mbutterick/pollen

Incorrect render behaviour

Closed this issue · 9 comments

After the render update, raco pollen render has been behaving strange; in version 2.0.2134.450 I still experience the following problem.

I have several .poly files in my project (exporting into markdown, tex, pdf and html), all of which work perfectly when I load the respective files on a pollen server. When I run render, though, some of the files compile, while others throw the following error:

doc/biopolymery/compiled/pollen/notes.poly.pm.rktd::15: read: bad syntax `#<'
  context...:
   /Applications/Racket v6.12/collects/racket/private/more-scheme.rkt:373:13: hash-ref!
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/cache.rkt:39:4: cached-require-base
   .../more-scheme.rkt:261:28
   get-template-for44
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/render.rkt:251:0: render-markup-or-markdown-source38
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/render.rkt:172:25: render31
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/private/cache-utils.rkt:100:2: generate-dest-file
   /Applications/Racket v6.12/collects/file/cache.rkt:63:2: fetch-and-continue
   /Applications/Racket v6.12/collects/racket/contract/private/arrow-val-first.rkt:428:3
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/private/cache-utils.rkt:91:0: cache-ref!14
   render-to-file-if-needed
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/render.rkt:105:25: render-from-source-or-output-path
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/render.rkt:49:25: render-batch4
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/render.rkt:105:25: render-from-source-or-output-path
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/render.rkt:49:25: render-batch4
   /Users/eugen/Library/Racket/6.12/pkgs/pollen/pollen/private/command.rkt:106:9: render-one-dir
   ...

This could seem rather cryptic, but the real problem is in the .poly.rktd file, which looks like this:

#hasheq((doc . #<void>) ...)

Together with the faulty .poly.rktd file there are two fully functioning files (it seems) in the same directory, namely .html.rktd and .pdf.rktd.

Running render -p doesn't throw any errors, some of my articles don't seem to be compiled, though.

And you have done a raco pollen reset, of course?

The rktd files are written as part of the caching system. Have you tried deactivating the caches in a setup module? (I’m not suggesting this as a permanent workaround, but it will help me refine where the problem is occurring.)

The problem seems to be that notes.poly.pmis exporting <#void> as the value for doc. I can’t see your source, so it’s hard for me to really test this. If you could post an example, it would be helpful.

I did just now. After disabling the compile cache, the error changes to:

render-markup-or-markdown-source: contract violation
expected: valid template path
given: #f
…

Which is weird, given that I have a template.md.p file in the project root directory (which reads simply ◊doc). EDIT: And given that .md files show just fine when accessing them via pollen server.

Yes, sounds weird. Well, if you want to give me access to the project repo, I will clone it & try to reproduce the problem.

The repo is private. I've added you as a collaborator. Thanks for help.

Problems:

  1. You have nodes in your pagetree with a poly extension. Pagetrees contain output filenames, so Pollen is trying to render in poly format (which doesn’t exist).

  2. Your root function in "pollen.rkt" has no else case for (current-poly-target), so when Pollen tries to render the poly file, it gets (void).

  3. Pollen’s caching system doesn’t handle void values properly, though it should, so I’ve fixed that.

  4. The error messages could’ve given better clues that there was a problem with the chosen output format, so I’ve fixed that too.

But for this to work correctly, you should fix problems 1 & 2.

Thanks for the help! And for the fixes, too.