C#网页模板引擎 SharpDOM

openkk 12年前
     <p>SharpDOM 可以让你直接使用 C# 的语法来编写网页,举个例子:</p>    <p>下面是一段HTML代码:</p>    <pre class="brush:html; toolbar: true; auto-links: false;"><html>     <head>         <title>Title of the page</title>         <meta http-equiv="Content-Type" content="text/html;charset=utf-8">         <link href="css/style.css" rel="stylesheet" type="text/css">         <script href="/JavaScripts/jquery-1.4.2.min.js" type="text/javascript">     </head>     <body>         <div>             <h1>Test Form to Test</h1>             <form id="Form1" type="post">                 <label>Parameter</label> =                 <input type="text">Enter value</input>                 <input type="submit" text="Submit !" />             </form>             <div>                 <p>Textual description of the footer</p>                 <a href="http://google.com">                     <span>You can find us here</span>                 </a>                 <div>                     Another nested container                 </div>             </div>         </div>     </body> </html></pre>使用 SharpDOM 来编写的话,就变成了    <pre class="brush:html; toolbar: true; auto-links: false;">html[     head[         title[ "Title of the page" ],         meta.attr(http-equiv: "contenttype", content: "html", charset: "utf-8"),         link.attr(href: "css/style.css", rel: "stylesheet", type: "css"),         script.attr(href:"/JavaScripts/jquery-1.4.2.min.js", type: "javascript")     ],     body[         div[             h1[ "Test Form to Test" ],             form.attr(id: "Form1", type: "post")[                 label[ "Parameter" ], "=", input.attr(type:"text", value: "Enter value"), br,                 input.attr(type: "submit", value: "Submit !")             ],             div[                 p[ "Textual description of the footer" ],                 a.attr(href: "http://google.com" )[                     span[ "You can find us here"]                 ]             ],             div[ "Another nested container" ]         ]     ] ]</pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1322965260296" target="_blank">http://www.open-open.com/lib/view/home/1322965260296</a></p>    <p></p>