Closed pittma closed 10 months ago
Okay, so I figured it out—it was the use of getResourceBody
in the transclude context; that was causing an infinite loop, but it was getting caught the second time around because transclude
was missing as it had been interpolated already. When I included it in the context here, it spins forever trying to compile anything with transclude
used. What I actually need to do is extract the raw body from item
, not use getResourceBody
as it has the (wrong) item
implicitly included.
fwiw, if someone else ends up here by the mention of transclude
, this is what I ended up doing…
transcludeContext :: Context a
transcludeContext =
functionField "transclude" $ \args _ ->
case args of
[id'] ->
compilerUnsafeIO
$ transclude id' <$> readFile ("forest/" ++ id' ++ ".md")
_ -> fail "transclude should receive a single argument"
where
transclude id' content = -- some absolutely filthy formatting and string concatenation
And my noteCompiler
from above stayed the same.
Hi there. I am trying to implement a
transclude
context via a function field, it looks like this:And I'm essentially double-compiling the target:
When the context keys match, I see this:
But when I change either the invocation or the definition, I see this
Note that the function field
wtf
is present. I'm not sure what's going on here!