项目作者: app-generator

项目描述 :
Html Parser - Html to Pug, Jinja2, Blade Converter | AppSeed
高级语言: CSS
项目地址: git://github.com/app-generator/html-parser.git
创建时间: 2019-07-21T07:40:07Z
项目社区:https://github.com/app-generator/html-parser

开源协议:MIT License

下载


HTML parser

Interactive tool to convert flat HTML (themes or stand-alone files) to Pug, Jinja2 and Blade templates.


What is an HTML Parser

According to Wikipedia, Parsing or syntactic analysis is the process of analyzing a string of symbols, either in natural language or in computer languages, according to the rules of a formal grammar. The meaning of HTML parsing applied here consist into load the HTML, extract and process the relevant information like head title, page assets, main sections and later on, save the processed file.


Tool Features

The goal of this tool is to automate the UI integration into existing apps, written in different technologies and frameworks. Starting from flat HTML, the tool can be used by anyone to extract components, edit attributes and traverse the HTML tree using an interactive console.


Use-cases

  • normalize the HTML file to load the assets from a standard directories ( /assets/ [ img, js, css ] ) making the integration in webpack related tools much easier
  • edit / traverse the HTML tree
  • edit attributes like anchor href’s, span texts, remove elements, edit class names
  • extract components for production use for various engines like PUG, Jinja2, Blade
  • migrate legacy Bootstrap layouts to Bulma and Tailwind CSS frameworks


HTML Parser Work-flow

Load the HTML theme / page

HTML Parser - Load the HTML theme.

HTML Parser - Select the HTML page.


Select Components

HTML Parser - Select components.


Edit Elements

HTML Parser - Edit elements.

HTML Parser - Edit elements.


Real life sample

The sample, extracted from Stellar HTML5Up theme is a simple navigation bar, extracted from this file

Pug version

  1. nav#nav
  2. ul
  3. li
  4. a.active.newclass(href='https://appseed.us/html-parser').
  5. Introduction
  6. li
  7. a(href='#first').
  8. First Section
  9. li
  10. a(href='#second').
  11. Second Section
  12. li
  13. a(href='#cta').
  14. Get Started


PHP version

  1. <nav id="nav">
  2. <ul>
  3. <li>
  4. <a class="active newclass" href="https://appseed.us/html-parser">
  5. <?php echo $var_1?>
  6. </a>
  7. </li>
  8. <li>
  9. <a href="#first">
  10. <?php echo $var_2?>
  11. </a>
  12. </li>
  13. <li>
  14. <a href="#second">
  15. <?php echo $var_3?>
  16. </a>
  17. </li>
  18. <li>
  19. <a href="#cta">
  20. <?php echo $var_4?>
  21. </a>
  22. </li>
  23. </ul>
  24. </nav>


Projects built with this tool

All are open-source, with live DEMO.


License & Usage

The tool is not open-source. For licenses, please contact AppSeed - support [ @ ] appseed.us



HTML parser tool provided by AppSeed