Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 1.1 KB

post.md

File metadata and controls

30 lines (24 loc) · 1.1 KB

Repositioning HTML for CSS and javascript links {#html-post}

Modern HTML commonly uses CSS and Javascript. This requires elements in the HTML element or <script> elements in the . Unfortunately this seriously harms re-using HTML DCG rules as components as each of these components may rely on their own style sheets or JavaScript code. We added a `mailing' system to reposition and collect fragments of HTML. This is implemented by html_post//2, html_receive//1 and html_receive//2.

* [[html_post//2]]
* [[html_receive//1]]
* [[html_receive//2]]

The library predefines the receiver channel =head= at the end of the =head= element for all pages that write the html =head= through this library. The following code can be used anywhere inside an HTML generating rule to demand a javascript in the header:

== js_script(URL) --> html_post(head, script([ src(URL), type('text/javascript') ], [])).

This mechanism is also exploited to add XML namespace (=xmlns=) declarations to the (outer) =html= element using xhml_ns//2:

* [[xhtml_ns//2]]