Prime Transformer

Fast Java8 BBCode parser and transformation library.

License

License

Categories

Categories

ORM Data
GroupId

GroupId

com.inversoft
ArtifactId

ArtifactId

prime-transformer
Last Version

Last Version

2.1.5
Release Date

Release Date

Type

Type

jar
Description

Description

Prime Transformer
Fast Java8 BBCode parser and transformation library.
Project URL

Project URL

http://www.inversoft.org
Source Code Management

Source Code Management

https://github.com/inversoft/prime-transformer

Download prime-transformer

How to add to project

<!-- https://jarcasting.com/artifacts/com.inversoft/prime-transformer/ -->
<dependency>
    <groupId>com.inversoft</groupId>
    <artifactId>prime-transformer</artifactId>
    <version>2.1.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.inversoft/prime-transformer/
implementation 'com.inversoft:prime-transformer:2.1.5'
// https://jarcasting.com/artifacts/com.inversoft/prime-transformer/
implementation ("com.inversoft:prime-transformer:2.1.5")
'com.inversoft:prime-transformer:jar:2.1.5'
<dependency org="com.inversoft" name="prime-transformer" rev="2.1.5">
  <artifact name="prime-transformer" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.inversoft', module='prime-transformer', version='2.1.5')
)
libraryDependencies += "com.inversoft" % "prime-transformer" % "2.1.5"
[com.inversoft/prime-transformer "2.1.5"]

Dependencies

compile (2)

Group / Artifact Type Version
org.freemarker : freemarker jar 2.3.19
org.slf4j : slf4j-api jar 1.7.7

test (6)

Group / Artifact Type Version
org.testng : testng jar 6.8.7
com.fasterxml.jackson.core : jackson-annotations jar 2.10.3
com.fasterxml.jackson.core : jackson-core jar 2.10.3
com.fasterxml.jackson.core : jackson-databind jar 2.10.3
org.spockframework : spock-core jar 0.7-groovy-2.0
org.codehaus.groovy : groovy-all jar 2.4.6

Project Modules

There are no modules declared in this project.

Prime Transformer semver 2.0.0 compliant

Prime Transformer is a BBCode parser and transformation library. Additional implementations may be added support additional source or target markup languages. The parser returns a light weight document object model of the source BBCode consisting mostly of index values and offsets that can be utilized by the transformer.

Prime Transformer is actively developed and is being utilized in high performance commercial products.

Example:
String source = "[b]Hello World![/b]";
Document document = new BBCodeParser().buildDocument(source, null);
String html = new BBCodeToHTMLTransformer().transform(document, (node) -> {
  // transform predicate, returning false will cause this node to not be transformed
  return true;
}, new HTMLTransformFunction(), null);

Assert.assertEquals(html, "<strong>Hello World!</strong>");

In the above example, we also provided a transform function as the third parameter. This parameter is optional, but most users will wish to escape HTML characters. This function is provided in the library, the caller can provide their own implementation as well.

Features:
  • Written in Java 8
  • No regular expressions, implementation uses a finite state machine... it's fast
  • Supports tag attributes
  • Tag does not require a closing tag. (e.g. [*])
  • Tag has a pre-formatted body (e.g. [code] or [noparse])
  • Supports escape character.
  • Normal: [b]foo\[/b] --> foo
  • Escaped: \[b]foo\[/b] --> [b]foo[/b]

Download from Maven

<dependency>
  <groupId>com.inversoft</groupId>
  <artifactId>prime-transformer</artifactId>
  <version>2.1.4</version>
</dependency>

Building in Maven

$ mvn install

Downloading from Savant

Released versions can be downloaded from the Savant Repository.

Building in Savant

Note: This project uses the Savant build tool. To compile using using Savant, follow these instructions:

$ mkdir ~/savant
$ cd ~/savant
$ wget http://savant.inversoft.org/org/savantbuild/savant-core/1.0.0/savant-1.0.0.tar.gz
$ tar xvfz savant-1.0.0.tar.gz
$ ln -s ./savant-1.0.0 current
$ export PATH=$PATH:~/savant/current/bin/

Then, perform an integration build of the project by running:

$ sb int

For more information, checkout savantbuild.org.

com.inversoft

Inversoft

Versions

Version
2.1.5
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.8