TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Producing HTML using string templates has always been the wrong solution

21 pointsby llimllibover 2 years ago

4 comments

pjc50over 2 years ago
What I would like to see: <i>client-side</i> template ability to insert a chunk of DOM nodes into the page from a URL, without having to invoke Javascript.<p>You can insert an image, a video, a SVG, or even an iframe from a URL, but you can&#x27;t insert a &lt;div&gt;.
评论 #34400574 未加载
alganetover 2 years ago
I wish CSS selector based templating existed as a popular practice. Something like:<p><pre><code> a#products { --text: name_of_my_variable; --attr-href: other_variable; } ul { --list: iterate(my_list_variable); } ul li { --text: item().name; } </code></pre> I want something that allows my HTML template to be pure HTML. No template {vars}, no weird attributes, no language tags, etc. Just let me use plain HTML and target its DOM externally. XSLT can do that, but it feels like it wasn&#x27;t meant to be written by humans.
quechimbaover 2 years ago
I&#x27;m using Haml kinda like JSX in my framework, it&#x27;s really nice. I&#x27;m using <a href="https:&#x2F;&#x2F;github.com&#x2F;ruby-syntax-tree&#x2F;syntax_tree-haml">https:&#x2F;&#x2F;github.com&#x2F;ruby-syntax-tree&#x2F;syntax_tree-haml</a> to transform Haml into Ruby. Works great.
nicwolffover 2 years ago
I have a very simple Python library in PyPI [0] that generates XML from a data structure representing the AST.<p>[0] <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;xml-from-seq&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;xml-from-seq&#x2F;</a>