Skip to content

Commit

Permalink
Setup lib-kotlin and base-kotlin modules #222 (#227)
Browse files Browse the repository at this point in the history
* Setup lib-kotlin and base-kotlin modules #222

* Added documentation  #222

* Added DocKotlinParser  #222

* Sonar issue #222

* Coverage #222

* Coverage #222

* Added kotlin freemarker step #222

(it does not actually use freemarker, but it relies on FreemarkerDocProcessConfig architecture).

* Removed sonar and codacy issues #222

* Script evaluation now depends on fj-script-helper #222

* Fix fj-script-helper version #222

* Kotlin generation constructors documentation #222

* Kotlin generation constructors documentation #222

* Kotlin generation attribute documentation #222

* Kotlin generation class documentation #222

* Kotlin generation additional documentation #222

* Codacy issues #222

* Snyk scan removed (free limit reached) #222

* Kotlin generation additional documentation #222

* playground review with doc kotlin parser #222

* Fix link

* Kotlin step documentation #222

* Kotlin parser documentation #222
  • Loading branch information
fugerit79 authored Oct 23, 2024
1 parent 95a66f2 commit cecfa99
Show file tree
Hide file tree
Showing 75 changed files with 3,670 additions and 45 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build_maven_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
snyk-token: ${{ secrets.SNYK_TOKEN }}
snyk-image: fj-doc-playground-quarkus
snyk-args: --file=fj-doc-playground-quarkus/Dockerfile
snyk-dockercontext: fj-doc-playground-quarkus
snyk-dockertag: fj-doc-playground-quarkus
#snyk-token: ${{ secrets.SNYK_TOKEN }}
#snyk-image: fj-doc-playground-quarkus
#snyk-args: --file=fj-doc-playground-quarkus/Dockerfile
#snyk-dockercontext: fj-doc-playground-quarkus
#snyk-dockertag: fj-doc-playground-quarkus
maven-additional-profiles: ',buildreact'
disable-maven-dependency-submission: ${{ vars.DISABLE_MAVEN_DEPENDENCY_SUBMISSION }}
disable-upload-sarif: ${{ vars.DISABLE_UPLOAD_SARIF }}
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- [fj-doc-freemarker] new step type 'kotlin' <https://github.com/fugerit-org/fj-doc/issues/222>
- [fj-doc-base-kotlin] support to use kotlin script (KTS) as source <https://github.com/fugerit-org/fj-doc/issues/222>
- [fj-doc-lib-kotlin] kotlin utilities <https://github.com/fugerit-org/fj-doc/issues/222>

## [8.9.7] - 2024-10-20

### Added
Expand Down Expand Up @@ -917,7 +923,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- fj-bom version set to 1.3.1
- Added build metadata to artifacts (https://github.com/fugerit-org/fj-bom/issues/2) (#54)
- Added build metadata to artifacts <https://github.com/fugerit-org/fj-bom/issues/2> (#54)
- Sonar Cloud Maven Build set to use maven profile sonarfugerit and github environmental variable for sonarKey (#54)
- New changelog style based on : <https://github.com/olivierlacan/keep-a-changelog> (#53)
- some link in the README.md
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ There are five kinds of components (each components README.md contains module st
### 1. Framework core :

* [Core library (fj-doc-base)](fj-doc-base/README.md) (contains a simple renderer for [Markdown BASIC](fj-doc-base/src/main/java/org/fugerit/java/doc/base/typehandler/markdown/SimpleMarkdownBasicTypeHandler.java) and [Markdown EXT](fj-doc-base/src/main/java/org/fugerit/java/doc/base/typehandler/markdown/SimpleMarkdownExtTypeHandler.java))
* [Json extension (fj-doc-base-json)](fj-doc-base-json/README.md) (allow for using json as document generator instead of standard xml generator) [since 0.7.0]
* [Yaml extension (fj-doc-base-yaml)](fj-doc-base-yaml/README.md) (allow for using yaml as document generator instead of standard xml generator) [since 0.7.0]
* [Json extension (fj-doc-base-json)](fj-doc-base-json/README.md) (allow using json as document generator instead of standard xml generator) [since 0.7.0]
* [Yaml extension (fj-doc-base-yaml)](fj-doc-base-yaml/README.md) (allow using yaml as document generator instead of standard xml generator) [since 0.7.0]
* [Kotlin extension (fj-doc-base-kotlin)](fj-doc-base-kotlin/README.md) (allow kotlin script, KTS, as document generator instead of standard xml generator) [since 8.10.0]
* Doc format [![xsd](https://img.shields.io/badge/venus%20xsd-doc%202.1-purple.svg)](https://www.fugerit.org/data/java/doc/xsd/doc-2-1.xsd)

### 2. Modules :
Expand Down Expand Up @@ -112,6 +113,7 @@ There are five kinds of components (each components README.md contains module st
* [Simple table (fj-doc-lib-singletable)](fj-doc-lib-simpletable/README.md) - offers a simple API for creating a document made of a table.
* [XSD Autodoc (fj-doc-lib-autodoc)](fj-doc-lib-autodoc/README.md) - offers a simple api for documenting the Venus library (to a limited extent some features can be used on any xsd).
* [Doc type validation (fj-doc-val)](fj-doc-val/README.md) - simple utilities for validating file type.
* [Kotlin utilities (fj-doc-lib-kotlin)](fj-doc-lib-kotlin/README.md) - This library provides some helper for the kotlin language. The first one is a utility to generate a kotlin DSL mapping an XSD.

### 5. Tutorial :
* [Samples and Quickstart (fj-doc-sample)](fj-doc-sample/README.md)
Expand Down
22 changes: 22 additions & 0 deletions fj-doc-base-kotlin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Fugerit Document Generation Framework (fj-doc)

## Core library : json extension (fj-doc-base-kotlin)

[back to fj-doc index](../README.md)

[![Maven Central](https://img.shields.io/maven-central/v/org.fugerit.java/fj-doc-base-kotlin.svg)](https://mvnrepository.com/artifact/org.fugerit.java/fj-doc-base-kotlin)
[![javadoc](https://javadoc.io/badge2/org.fugerit.java/fj-doc-base-kotlin/javadoc.svg)](https://javadoc.io/doc/org.fugerit.java/fj-doc-base-kotlin)

*Description* :
Add the option to use a kotlin script as document generator instead of standard xml source provided by default.

*Status* :
All basic features are implemented (kotlin parsing, conversion from and to xml)

*Since* : fj-doc 8.10.0

*Native support* :
Disabled, native support will be added in a future release.

*Doc Kotlin format*
The xml and kotlin format have inherent differences. For more information [read the documentation](https://venusdocs.fugerit.org/guide/#doc-format-entry-point-kotlin).
116 changes: 116 additions & 0 deletions fj-doc-base-kotlin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>fj-doc-base-kotlin</artifactId>

<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>8.9.8-SNAPSHOT</version>
</parent>

<name>fj-doc-base-kotlin</name>
<description>Module for producting documents from Kotlin script</description>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<fj-script-helper-version>1.0.0</fj-script-helper-version>
<kotlin.version>2.0.21</kotlin.version>
</properties>

<build>

<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>

<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-core</artifactId>
</dependency>

<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc-base</artifactId>
</dependency>

<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-xml-to-json</artifactId>
</dependency>

<dependency>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-script-helper</artifactId>
<version>${fj-script-helper-version}</version>
</dependency>

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-scripting-jsr223</artifactId>
<version>${kotlin.version}</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter-api-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<organization>
<url>https://www.fugerit.org</url>
<name>Fugerit</name>
</organization>

<url>https://www.fugerit.org/perm/venus/</url>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.fugerit.java.doc.base.kotlin.dsl

/**
* Background represents the background element.
*
* This class will provide function to handle all background attributes and kids
*/
class Background : HelperDSL.TagWithText( "background" ) {
/**
* Creates a new default Image instance.
* @return the new instance.
*/
fun image( init: Image.() -> Unit = {} ): Image {
return initTag(Image(), init);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.fugerit.java.doc.base.kotlin.dsl

/**
* Barcode represents the barcode element.
*
* This class will provide function to handle all barcode attributes and kids
*/
class Barcode : HelperDSL.TagWithText( "barcode" ) {

/**
* Function handling size attribute of the Barcode with specific check on type.
* @return the value for the size attribute.
*/
fun size( value: Int ): Barcode = fontSizeType( this, "size", value )
/**
* Function handling type attribute of the Barcode with generic check on type.
* @return the value for the type attribute.
*/
fun type( value: String ): Barcode = setAtt( this, "type", value )
/**
* Function handling text attribute of the Barcode with specific check on type.
* @return the value for the text attribute.
*/
fun text( value: String ): Barcode = altType( this, "text", value )

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package org.fugerit.java.doc.base.kotlin.dsl

/**
* Body represents the body element.
*
* This class will provide function to handle all body attributes and kids
*/
class Body : HelperDSL.TagWithText( "body" ) {
/**
* Creates a new default Para instance.
* @return the new instance.
*/
fun para( text: String = "", init: Para.() -> Unit = {} ): Para {
return initTag(Para(text), init);
}
/**
* Creates a new default Table instance.
* @return the new instance.
*/
fun table( init: Table.() -> Unit = {} ): Table {
return initTag(Table(), init);
}
/**
* Creates a new default List instance.
* @return the new instance.
*/
fun list( init: List.() -> Unit = {} ): List {
return initTag(List(), init);
}
/**
* Creates a new default Image instance.
* @return the new instance.
*/
fun image( init: Image.() -> Unit = {} ): Image {
return initTag(Image(), init);
}
/**
* Creates a new default Phrase instance.
* @return the new instance.
*/
fun phrase( text: String = "", init: Phrase.() -> Unit = {} ): Phrase {
return initTag(Phrase(text), init);
}
/**
* Creates a new default Nbsp instance.
* @return the new instance.
*/
fun nbsp( init: Nbsp.() -> Unit = {} ): Nbsp {
return initTag(Nbsp(), init);
}
/**
* Creates a new default Br instance.
* @return the new instance.
*/
fun br( init: Br.() -> Unit = {} ): Br {
return initTag(Br(), init);
}
/**
* Creates a new default Barcode instance.
* @return the new instance.
*/
fun barcode( init: Barcode.() -> Unit = {} ): Barcode {
return initTag(Barcode(), init);
}
/**
* Creates a new default H instance.
* @return the new instance.
*/
fun h( text: String = "", init: H.() -> Unit = {} ): H {
return initTag(H(text), init);
}
/**
* Creates a new default PageBreak instance.
* @return the new instance.
*/
fun pageBreak( init: PageBreak.() -> Unit = {} ): PageBreak {
return initTag(PageBreak(), init);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.fugerit.java.doc.base.kotlin.dsl

/**
* Bookmark represents the bookmark element.
*
* This class will provide function to handle all bookmark attributes and kids
*/
class Bookmark( text: String = "" ) : HelperDSL.TagWithText( "bookmark" ) {

init { setText(text) }
/**
* Function to set text content for this element.
*/

fun setText( value: String ) { addKid( HelperDSL.TextElement( value ) ) }


/**
* Function handling ref attribute of the Bookmark with specific check on type.
* @return the value for the ref attribute.
*/
fun ref( value: String ): Bookmark = idType( this, "ref", value )

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.fugerit.java.doc.base.kotlin.dsl

/**
* BookmarkTree represents the bookmark-tree element.
*
* This class will provide function to handle all bookmark-tree attributes and kids
*/
class BookmarkTree : HelperDSL.TagWithText( "bookmark-tree" ) {
/**
* Creates a new default Bookmark instance.
* @return the new instance.
*/
fun bookmark( text: String = "", init: Bookmark.() -> Unit = {} ): Bookmark {
return initTag(Bookmark(text), init);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.fugerit.java.doc.base.kotlin.dsl

/**
* Br represents the br element.
*
* This class will provide function to handle all br attributes and kids
*/
class Br : HelperDSL.TagWithText( "br" ) {


}
Loading

0 comments on commit cecfa99

Please sign in to comment.