Second tutorial: #lang line appears in output with custom template
#146
Closed
opened 8 years ago by clartaq
·
3 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Working through the tutorials, it is unclear if
fallback.html.p
should start with a#lang pollen
statement. I have assumed so since it is a pollen file and DrRacket does not provide the button to insert the lozenge character without it. It does not have the line in the tutorial though.However, when the
#lang pollen
line is included, it appears as the first line in the output. Things actually work fine without it, but there is no way to insert the lozenge without resorting to keyboard calisthenics.Could you clarify the intention for this type of file?
Windows 10 Pro, 64-bit
Racket 6.9
Pollen 1.2.1380.975
I meant
template.html.p
too.Correct. Template files do not start with
#lang pollen
.Here's how I explain it in the docs: [1]
“So a template is also a Pollen source file?” Not quite. More accurately, it’s a fragment of Pollen source that is completed by adding the X-expression that comes out of one of your source files. Because of this, there are a few extra limitations on the code you can put in a template, though with easy workarounds (for instance, you can’t use
require
in a template, but you can uselocal-require
, which accomplishes the same thing).Yes, that is a shortcoming. I don't love the way Pollen templates work, but I haven't figured out a better way. (It would be nice to make them work the same way a self-contained source files, but because they are, by design, not self-contained source files, it's difficult.)
As a workaround, I suppose you can just copy and paste the lozenge. Or put
#lang pollen
at the top temporarily just to show the button, and remove it when you're done editing the template.[1] http://docs.racket-lang.org/pollen/second-tutorial.html#%28part.tutorial-2..Templates%29 http://docs.racket-lang.org/pollen/second-tutorial.html#(part._tutorial-2._.Templates)
Thanks for the clarification.