Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sangupta/html-gen
Strongly typed HTML generation library in Java
https://github.com/sangupta/html-gen
Last synced: 4 days ago
JSON representation
Strongly typed HTML generation library in Java
- Host: GitHub
- URL: https://github.com/sangupta/html-gen
- Owner: sangupta
- License: other
- Created: 2014-11-27T11:02:35.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-12-08T18:18:26.000Z (almost 4 years ago)
- Last Synced: 2024-04-16T11:17:28.133Z (7 months ago)
- Language: Java
- Homepage: http://sangupta.com/projects/html-gen
- Size: 62.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
html-gen
========Strongly typed HTML generation library for Java.
`html-gen` helps you create HTML code snippets using Java objects. It is useful in situations where
using templating engines may be an overkill. Support all HTML5 elements as listed by Mozilla
Developer Network at https://developer.mozilla.org/en/docs/Web/Guide/HTML/HTML5/HTML5_element_list`html-gen` is an extremely lightweight and independent library - no external dependencies. `JDK 1.6+ compatible`.
Usage
-----Generating a complete HTML file:
```java
// create new HTML object
Html html = new Html().docType(DocType.HTML5);// write values to head
html.head()
.title("Sample title page").meta("charset", "utf8")
.meta("charset", "utf8")
.meta("another meta tag", "some value");// generate the body
html.body().div().addClass("bold").text("Sample Heading");// Build HTML
System.out.println(html.asString());
```This will generate the HTML output as
```html
```### Generating a table
```java
Html html = new Html();
html.body().table()
.thead()
.tr().th("head1").th("head2").th("head3")
.parentTable().tbody()
.tr().td("1").td("2").td("3")
.newRow().td("a").td("b").td("c");
System.out.println(html.asString());
```
generating HTML code as:
```html
head1
head2
head3
1
2
3
a
b
c
```
Changelog
---------**Current Development**
* Iniital support for all HTML elements
Downloads
---------The library can be downloaded from Maven Central using:
```xml
com.sangupta
html-gen
0.0.1-SNAPSHOT```
Versioning
----------For transparency and insight into our release cycle, and for striving to maintain backward compatibility,
`html-gen` will be maintained under the Semantic Versioning guidelines as much as possible.Releases will be numbered with the follow format:
..
And constructed with the following guidelines:
* Breaking backward compatibility bumps the major
* New additions without breaking backward compatibility bumps the minor
* Bug fixes and misc changes bump the patchFor more information on SemVer, please visit http://semver.org/.
License
-------
```
html-gen - HTML generation library
Copyright (c) 2014, Sandeep Guptahttp://sangupta.com/projects/htmlgen
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```