Chris's Wiki :: blog/programming/OnHTMLViaStringTemplates Commentshttps://utcc.utoronto.ca/~cks/space/blog/programming/OnHTMLViaStringTemplates?atomcommentsDWiki2023-05-27T05:55:41ZRecent comments in Chris's Wiki :: blog/programming/OnHTMLViaStringTemplates.By Michael on /blog/programming/OnHTMLViaStringTemplatestag:CSpace:blog/programming/OnHTMLViaStringTemplates:63e19cd6264549f8736a06862fadc2c2d0f5aecbMichael<div class="wikitext"><p>I would say that even if writing an entire template needs handling the «code» parts, modifying the «layout» and «text» parts can be done without learning too much about the details about the code.</p>
<p>Once I have chosen to use text-based auto-escaping templating and not structured options in Common Lisp exactly because sometimes for some people (not developing the system but closely working with it) just experimenting with a copy of a template and seeing the changes live was a faster turnaround than formulating each change for me to make. The code parts of the template were just moved around without modification, there discussing the changes was a better idea.</p>
<p>It's also a kind of scaling down: if a lot of things are not yet decided and are going to be decided by what power users are happy with, and the development team is small (or just one person)…</p>
</div>2023-05-27T05:55:41ZBy K on /blog/programming/OnHTMLViaStringTemplatestag:CSpace:blog/programming/OnHTMLViaStringTemplates:e486c06a1a6ad64e75894ec6721f8bee90c579a4K<div class="wikitext"><p>What it tells me is that their programming languages aren't good at structured data generation, but are <em>good enough</em> at string templating.</p>
<p>In homoiconic languages like Lisp, by contrast, structured generation of HTML (e.g., Hiccup in Clojure) works far better than string templating, and also happens to be the most common way to generate HTML there. Lisp has been doing structured generation of source code for over 50 years, so HTML is a piece of cake.</p>
<p>String templating is a classic New Jersey style technique, which is why it Won Big. That's the only "real advantage" it needs. You may as well ask why Unix or C or insects are so prevalent if they're so minimalist. They're prevalent <em>because</em> they require so little of their environment.</p>
</div>2023-05-27T02:15:41ZBy sapphirepaw on /blog/programming/OnHTMLViaStringTemplatestag:CSpace:blog/programming/OnHTMLViaStringTemplates:8ddac02e9b75a66020e1ca0989018118f9a3a767sapphirepawhttps://www.sapphirepaw.org/<div class="wikitext"><p>At one point, it was popular to expect "designers" to write "templates", and assume these designers did not understand the DOM structure or "real code." The advertising and docs for Smarty or Twig would have sections oriented toward these design-only users.</p>
<p>In theory, there's a separation of labor possible, but in practice, I've never worked in an environment where this is reality. The templates are still code, but expressed in a different language than the host programming environment.</p>
<p>I had an aside drafted here, but Landau acknowledged it already: that strings were considered faster. That's pretty much all <em>I</em> cared about in 2007. So I can see how strings would 'win' given these cultural forces.</p>
</div>2023-05-26T20:47:46ZBy HundredPickles on /blog/programming/OnHTMLViaStringTemplatestag:CSpace:blog/programming/OnHTMLViaStringTemplates:b96b4a4320b49b7e204b2c4a850d270e166c3d3bHundredPickles<div class="wikitext"><p>I think another reason string templating is more popular than a strict system is that people need string templating anyway, just for the text portion of their websites. Things like "written on {date}" or "thank you, {username}". It's an almost universal need, so it feels very natural to just throw in the formatting tags as well.</p>
</div>2023-05-26T13:30:56Z