Skip to content

tekrat/eSugar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

eSugar

Syntax generator for building HTML and XML strings

Example Usage:

ES(Tag Name, Inner Content [optional], JSON List of Tab Attributes [optional], Prefix String to a Tag [optional], Sufix String to a Tag [optional], ) returns a string

  ES("br") generates <br />
  ES("div", "Hello World!") generates <div>Hello World!</div>
  ES("span", "Hello World in RED!", {style: "color: red;", id: "MySPAN"}) generates 
    <span style="color: red;" id="MySPAN">Hello World in RED!</span>

Don't forget you can encapsulate tags:

ES("div",
  ES("p", "This is a paragraph") +
  ES("p", "This is a blue paragraph", {style: "color: blue;"})
  {style="margin-left: 10pt; padding: 5px; border: solid 1px blue;"}
);

You can see the code in action at: https://jsfiddle.net/ervkosch/kz7edvqL/

Disclaimer

This code is provided without warranty. While I strive to maintain backwards compatibility with previous versions, the code is still under active development. As this is the case, some revisions may break compatibility with earlier versions of the library. Please keep this in mind when using eSugar.

Copyright and Licensing

Copyright (c) 2012, 2016 Ervin Kosch, released under the GPL 3 license

About

JavaScript syntax generator for building HTML and XML strings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published