Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response/xexpr should respect current-unescaped-tags #122

Open
massung opened this issue Sep 10, 2022 · 0 comments
Open

response/xexpr should respect current-unescaped-tags #122

massung opened this issue Sep 10, 2022 · 0 comments

Comments

@massung
Copy link

massung commented Sep 10, 2022

Because

is a function, when it is called any parameterized change to current-unescaped-tags is completely ignored or must be set at a much more global level, which is undesirable.

Example:

(define (start req)
  (parameterize ([current-unescaped-tags html-unescaped-tags])
    (response/xexpr
     `(html (head (script "let x = 1 < 2;"))))))

When run, the above will fail because it will convert the < to &lt; when that isn't the intention. I'd recommend changing the output function to first capture - and then reuse - the value:

(let ([unescaped-tags (current-unescaped-tags)])
  (λ (out)
    (parameterize ([current-unescaped-tags unescaped-tags])
      (write-bytes preamble out)
      (write-xexpr xexpr out))))

But there may be something a bit lower level that could work as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant