Coder Social home page Coder Social logo

kanathan9 / js-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from osscameroon/js-generator

0.0 0.0 0.0 2.89 MB

Generates JS code from syntatically correct HTML code... following the DOM mapping methods of JS

Home Page: https://osscameroon.github.io/js-generator/

License: MIT License

Shell 2.15% Java 96.20% HTML 1.66%

js-generator's Introduction

Maven Build codecov License: MIT Contributors

Table of Contents

From Html to Js through Java

About

Translating from HTML to JS.

This project is different from the JavaScript Generator Object.

The goal is to generate JS from HTML following the JavaScript DOM structure. Sometimes, we forget how to write JavaScript to build dynamic web apps. Even if we know JS, it happens that we don't always have enough time to generate JS from a big HTML code. Thus, the goal of this project is helping developers gaining time by producing JS code as Output based on HTML as Input. This project will be very useful for beginners learning HTML and JavaScript. Also, it will help more experienced developers whenever they want to use JS instead of HTML.

The project is based on jsoup library, a Java HTML parser / jsoup GitHub Repository. It's all about using Nodes (not Node JS) to generate JavaScript.

How does it work in a nutshell ?

Getting Started

CLI

jsgenerator has several options that can be used in a console here is an example of use below

$ jsgenerator --tty --inline '<div>I am a <strong>tea pot</strong>'

let div_000 = document.createElement('div');
let text_000 = document.createTextNode(`I am a `);
div_000.appendChild(text_000);

let strong_000 = document.createElement('strong');
let text_001 = document.createTextNode(`tea pot`);
strong_000.appendChild(text_001);
div_000.appendChild(strong_000);
document.appendChild(div_000);

Clients

CLI

Usage: jsgenerator [-htV] [-e=<extension>] [--inline-pattern=<inlinePattern>]
                   [--path-pattern=<pathPattern>]
                   [--stdin-pattern=<stdinPattern>] [-i=<inlineContents>...]...
                   [--] [<paths>...]
Translating files, stdin or inline from HTML to JS
      [<paths>...]        file paths to translate content, parsed as HTML
  -e, --ext=<extension>   output files' extension
  -h, --help              Show this help message and exit.
  -i, --inline=<inlineContents>...
                          args as HTML content, not files
      --inline-pattern=<inlinePattern>
                          Pattern for inline output filename
      --path-pattern=<pathPattern>
                          pattern for path-based output filenames
      --stdin-pattern=<stdinPattern>
                          pattern for stdin output filenames
  -t, --tty               output to stdin, not files
  -V, --version           Print version information and exit.

WEB

TODO: Not yet implemented.

DESKTOP

TODO: Not yet implemented.

CODE API

TODO: Not yet implemented. See Wiki.

Stack

  • Java 11 (or GraalVM JDK 11, for native CLI client)
  • Maven 3
  • Spring 5.3.22
  • Spring Boot 2.7.3

Contribute

# 1. Clone
git clone [email protected]:osscameroon/js-generator.git

# 2. Move to root directory
cd js-generator

# 3. Tests & Build
mvn clean package

# 4. Build Native CLI (Requires GraalVM JDK 11)
./cli-build.sh # if provided, first argument will be the file name (useful for version tagging) 

# 5. Browse through code
# 6. Run CLI with --help and play with it
# 7. Fork the project, build, test, open a pull request

All your contributions are welcome! Do not hesitate to open an issue on this repository and/or create a pull request (PR). In order to create a PR, just fork first.

Thanks for your commitment, we really appreciate! Happy Coding! ๐Ÿ˜Š๐ŸŽ‰๐Ÿ’ฏ

Back To The Top

js-generator's People

Contributors

fanjups avatar salathielgenese avatar elroykanye avatar ngdream avatar mofirojean avatar dependabot[bot] avatar elhmn 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.