简体   繁体   中英

Node.js Parsing HTML

OK, I am creating a node.js module that will be a simple and fast HTML parser. Basically I want to be able to parse an HTML file for a certain tag, for example:

<html>
<head>

     <title><%=title%></title>

</head>
<body>

     <h1><%=header%></h1>

     <% for(var x in object){ %>
         <div> <%=object[x].content%> </div>
     <% } %>

</body>
</html>

Any help would be GREATLY appreciated. I am trying to make several Node.js Modules to help out with a open source CMS I am also building on Node. I know there are a few that do this, but they all seem to be using RegExp and are slow. I am wondering if there is a faster way to do this.

Thanks!!!

That example that you posted looks just like EJS . You can also check out Jade .

There literally are a TON of awesome JS templating options out there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM