Giter Site home page Giter Site logo

jictyvoo / moonstar Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 93 KB

Is a program that helps Lapis User to convert html pages to Moonscript pages. If has a problem with your HTML, MoonStar tries to fix it, and work properly

License: GNU General Public License v3.0

Lua 97.17% Shell 2.83%
html-tree moonscript-pages parser html-parser crawl-pages

moonstar's Introduction

MoonStar

Is a program that helps Lapis User to convert html pages to Moonscript pages. If has a problem with your HTML, MoonStar tries to fix it, and work properly

Components

ParserHTML

Is a html parser that helps to find elements by id and also by tag type. This parser was designed to accept anytime of tag. Obs, comment tags are ignored.

Usage

Run the binary file with your html file as argument. You can too import the program source and use it to parse a specific part of an HTML.

Importing as a library

To use library in your project, execute command below on your project repository

git submodule add https://github.com/Jictyvoo/MoonStar

After that you can import the library easily, like

    require "libs.MoonStar"

Below you can see all methods

  • __call = function(self, isFile, ...) - This function allows you to get the generated object calling MoonStar table. Here's a example
    local MoonStar = require "libs.MoonStar"
    MoonStar(false, "<html><head><meta charset='utf-8'></head></html>")
    --[[ starting scrapping --]]
    MoonStar.getHTMLTree().getDocument() --this will return all document
  • parse(data, isFile) - This function is the main function called, is the same function called in __call

  • deepParse(data) - This function is when you don't have all html data complete at once. So, you can use this function a lot of times to parse your splited file.

  • getHTMLTree() - This Function return the HTML Tree of the data passed. The HTML Tree returned has the main method "getDocument" that will returns the root tag, it is, the first tag in your document, or a DIV auto-generated to help parse document.

  • getElementsBy... - Based on all tags in your HTML, if has a Lua tag in your HTML, MoonStar will generate in HTML Tree a function named getLua(), that return a table with all Lua tags. The same occurs to getElementsBy, but this returns elements selected by attributes, like: getElementsById(). This function can also be called using a identifier, like getElementsById("someId"), whitch returns a Tag element.

Goals

  • Fix a bug when have a tag that can be closed or not closed

moonstar's People

Contributors

jictyvoo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.