From aa2e04e6ca8ead771290f892bf36717d3849b4e7 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 3 Nov 2025 19:18:25 -0500 Subject: [PATCH] basic interpolation --- dom.d | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dom.d b/dom.d index c13fa2e..5ac7d13 100644 --- a/dom.d +++ b/dom.d @@ -1,3 +1,5 @@ +// FIXME: i want css nesting via the new standard now. + // FIXME: xml namespace support??? // FIXME: https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML // FIXME: parentElement is parentNode that skips DocumentFragment etc but will be hard to work in with my compatibility... @@ -2695,6 +2697,47 @@ class Element : DomParent { return m; } + /++ + Makes an element from an interpolated sequence. + + FIXME: add a type interpolator thing that can be replaced + FIXME: syntax check at compile time? + FIXME: allow a DocumentFragment in some cases + +/ + static Element make(Args...)(arsd.core.InterpolationHeader head, Args args, arsd.core.InterpolationFooter foot) { + string html; + + import arsd.core; + foreach(arg; args) { + static if(is(typeof(arg) == InterpolationHeader)) + {} + else + static if(is(typeof(arg) == InterpolationFooter)) + {} + else + static if(is(typeof(arg) == InterpolatedLiteral!h, string h)) + html ~= h; + else + static if(is(typeof(arg) == InterpolatedExpression!code, string code)) + {} + else + static if(is(typeof(arg) : iraw)) + html ~= arg.s; + else + // FIXME: what if we are inside a