Search code examples
prologswi-prologframeworkbenchmarks

Remove meta from reply_html_page


How do I remove the meta tag that is automatically inserted by reply_html_page?

reply_html_page(
    [title('Fortunes')],
    [table([
        ...
    ])]
).

The generate code looks like this:

<!DOCTYPE html>
<HTML>
  <head>
    <title>Fortunes</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    ...
  </body>
</html>

Additionally: Is there a way to send the Content-Length header with the response?

Cross-Post: https://swi-prolog.discourse.group/t/remove-meta-from-reply-html-page/4189


Solution

  • This is what worked for me (answered by @jan-wielemaker here: https://swi-prolog.discourse.group/t/remove-meta-from-reply-html-page/4189/8)

    reply(_Request) :-
        ...,
        phrase(page([ head(title('Fortunes')),
                      body(table(\sequence(row, Rows)))
                    ]),
               Tokens),
        print_html(Tokens).
    
    row(row(N, C)) -->
        html(tr([td(N), td(C)])).