Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. var cheerio = require('cheerio');
  2. var multiline = require('multiline');
  3. var domify = require('domify');
  4.  
  5. var tmpl = multiline(function() {/*
  6.  
  7. <body>
  8. <header>
  9. <hgroup>
  10. <h1>Header in h1</h1>
  11. <h2>Subheader in h2</h2>
  12. </hgroup>
  13. </header>
  14. <nav>
  15. <ul>
  16. <li><a href="#">Menu Option 1</a></li>
  17. <li><a href="#">Menu Option 2</a></li>
  18. <li><a href="#">Menu Option 3</a></li>
  19. </ul>
  20. </nav>
  21. <section>
  22. <article>
  23. <header>
  24. <h1>Article #1</h1>
  25. </header>
  26. <section>
  27. This is the first article. This is <mark>highlighted</mark>.
  28. </section>
  29. </article>
  30. <article>
  31. <header>
  32. <h1>Article #2</h1>
  33. </header>
  34. <section>
  35. This is the second article. These articles could be blog posts, etc.
  36. </section>
  37. </article>
  38. </section>
  39. <aside>
  40. <section>
  41. <h1>Links</h1>
  42. <ul>
  43. <li><a href="#">Link 1</a></li>
  44. <li><a href="#">Link 2</a></li>
  45. <li><a href="#">Link 3</a></li>
  46. </ul>
  47. </section>
  48. </aside>
  49. <footer>Footer - Copyright 2011</footer>
  50. </body>
  51.  
  52. */});
  53.  
  54. var $ = cheerio.load(tmpl);
  55. var html = $.html();
  56. document.body.appendChild(domify(html));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement