Skip to content

Commit

Permalink
Merge pull request #3 from gyawaliamit7/feature/tags-enhancement
Browse files Browse the repository at this point in the history
Feature/tags enhancement
  • Loading branch information
gyawaliamit7 committed Aug 23, 2023
2 parents 3302c8b + c1b941a commit 76dfdc6
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 11 deletions.
98 changes: 97 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,36 @@

<groupId>com.gyawaliamit</groupId>
<artifactId>spring-html-generator</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.0</version>
<name>spring-html-generator</name>
<description>Spring HTML Generator is a simple and lightweight Java application that empowers you to create HTML pages using the Builder pattern. This application is deliberately minimalistic, with no external dependencies other than Java itself. It has been crafted with a singular purpose: to facilitate the creation of HTML templates via Java code.
</description>
<url>http://gyawaliamit.com</url>
<licenses>
<license>
<name>The MIT License</name>
<url>https://github.com/gyawaliamit7/spring-html-generator/blob/main/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<id>gyawaliamit99</id>
<name>Amit Gyawali</name>
<email>gyawaliamit99@gmail.com</email>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/gyawaliamit7/spring-html-generator.git</connection>
<developerConnection>scm:git:git://github.com/gyawaliamit7/spring-html-generator.git</developerConnection>
<url>https://github.com/gyawaliamit7/spring-html-generator</url>
<tag>HEAD</tag>
</scm>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand All @@ -22,5 +50,73 @@
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.15</version> <!-- apparently this needs to be exactly this version -->
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
17 changes: 11 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ Spring HTML Generator can be incredibly useful in various scenarios where you ne

To get started with Spring HTML Generator, follow these steps:

1. **Clone the Repository**: Clone this repository to your local machine.

```shell
https://github.com/gyawaliamit7/spring-html-generator.git
1. **Add Dependency**: Add the following dependency in your project.

```xml
<dependency>
<groupId>com.gyawaliamit</groupId>
<artifactId>spring-html-generator</artifactId>
<version>1.0.0</version>
</dependency>
```


## Example
Expand Down Expand Up @@ -121,7 +126,7 @@ public static void main(String[] args) {

You can find the complete source code for this HTML email template in the following Java class:

[SuccessfulRegistration.java](src/main/java/com/gyawaliamit/spring/html/generator/templates/email/SuccessfulRegistration.java)
[RegistrationSuccessBasic.java](src/main/java/com/gyawaliamit/spring/html/generator/templates/email/RegistrationSuccessBasic.java)

Feel free to use this template as a starting point for your own email notifications.

Expand Down Expand Up @@ -182,7 +187,7 @@ public static void main(String[] args) {

You can find the complete source code for this HTML email template in the following Java class:

[SuccessfulRegistration.java](src/main/java/com/gyawaliamit/spring/html/generator/templates/email/SuccessfulRegistration.java)
[NewsLetterBasicTemplate.java](src/main/java/com/gyawaliamit/spring/html/generator/templates/email/NewsLetterBasicTemplate.java)

Feel free to use this template as a starting point for your own email notifications.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class BodyBuilder {

private Queue<BodyTags> bodyTags;
private StringBuilder content;
private List<HeadingBuilder> headingBuilder;
private Map<String, Handler> handlers;

public BodyBuilder(StringBuilder content, Queue<BodyTags> bodyTags, Map<String, Handler> styleHandler) {
Expand Down Expand Up @@ -64,9 +63,12 @@ public BodyBuilder div(DivBuilder divBuilder) {
return this;
}

public BodyBuilder heading(HeadBuilder headBuilder, Heading headingConstants) {
this.headingBuilder = headingBuilder;
return null;
public BodyBuilder heading(HeadingBuilder headBuilder) {
if(this.bodyTags == null) {
this.bodyTags = new LinkedList<>();
}
this.bodyTags.add(headBuilder);
return this;
}

public BodyBuilder paragraph(ParagraphBuilder paragraphBuilder) {
Expand All @@ -86,6 +88,14 @@ public BodyBuilder ahref(AhrefBuilder ahrefBuilder) {
return this;
}

public BodyBuilder image(ImageBuilder imageBuilder) {
if(this.bodyTags == null) {
this.bodyTags = new LinkedList<>();
}
this.bodyTags.add(imageBuilder);
return this;
}

public BodyBuilder table(TableBuilder tableBuilder) {
if(this.bodyTags == null) {
this.bodyTags = new LinkedList<>();
Expand Down

0 comments on commit 76dfdc6

Please sign in to comment.