Histone Acceptance Tests Module

Tests for histone engine

License

License

GroupId

GroupId

com.github.megafonweblab.histone
ArtifactId

ArtifactId

histone-acceptance-test
Last Version

Last Version

1.9.2
Release Date

Release Date

Type

Type

jar
Description

Description

Histone Acceptance Tests Module
Tests for histone engine

Download histone-acceptance-test

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.megafonweblab.histone/histone-acceptance-test/ -->
<dependency>
    <groupId>com.github.megafonweblab.histone</groupId>
    <artifactId>histone-acceptance-test</artifactId>
    <version>1.9.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.megafonweblab.histone/histone-acceptance-test/
implementation 'com.github.megafonweblab.histone:histone-acceptance-test:1.9.2'
// https://jarcasting.com/artifacts/com.github.megafonweblab.histone/histone-acceptance-test/
implementation ("com.github.megafonweblab.histone:histone-acceptance-test:1.9.2")
'com.github.megafonweblab.histone:histone-acceptance-test:jar:1.9.2'
<dependency org="com.github.megafonweblab.histone" name="histone-acceptance-test" rev="1.9.2">
  <artifact name="histone-acceptance-test" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.megafonweblab.histone', module='histone-acceptance-test', version='1.9.2')
)
libraryDependencies += "com.github.megafonweblab.histone" % "histone-acceptance-test" % "1.9.2"
[com.github.megafonweblab.histone/histone-acceptance-test "1.9.2"]

Dependencies

compile (5)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-core jar 2.8.9
com.fasterxml.jackson.core : jackson-databind jar 2.8.9
org.junit.jupiter : junit-jupiter-engine jar 5.0.0-M4
org.apache.commons : commons-lang3 jar 3.5
javax.ws.rs : javax.ws.rs-api jar 2.0.1

Project Modules

There are no modules declared in this project.

Histone Template Engine 2 Build Status Coverage Status Maven Central

Histone — powerful and flexible template engine, which can be used for HTML - code generation as well as any other kind of text - documents. Histone implementations exists for the web - browser as well as for the server (Java and PHP), it allows you to use same templates on the server and on the client. Built - in extension mechanism allows you to extend default template engine features, by adding your own methods and properties for the particular project. Templates has clean and simple syntax and can be stored either as source code or as compiled code that can be executed with the maximum performance wherever it's needed.

Histone Template Engine Java Implementation

Documentation

Using Histone from Maven

To use histone in your maven project you should add new maven dependency to your pom.xml

<dependency>
    <groupId>com.github.megafonweblab.histone</groupId>
    <artifactId>histone-java-v2</artifactId>
    <version>1.0.1</version>
</dependency>

Sources tree

Standart Maven project structure. |- src/ project sources |- assembly/ file with maven-assembly-plugin assembly descriptor |- etc/ file for maven-licence-plugin checks |- main/ main sources |- test/ tests sources

Distribution archive contents

|- libs/ histone-java dependency libraries
|- histone-java-A.B.C.jar histone-java library
|- LICENSE.txt Apache v2.0 license file
|- NOTICE.txt file with copyright info
|- README.md this file

Clone, Build and Run test

For Windows users before clone repo:

git config —global core.autocrlf false

Clone repo:

git clone https://github.com/MegafonWebLab/histone-java2 histone-java2

Go to the repo:

cd histone-java2

Run test:

mvn clean test

Build and Run test:

mvn clean package

Base Example:

import ru.histone.v2.evaluator.Context;
import ru.histone.v2.evaluator.Evaluator;
import ru.histone.v2.evaluator.resource.HistoneResourceLoader;
import ru.histone.v2.evaluator.resource.SchemaResourceLoader;
import ru.histone.v2.parser.Parser;
import ru.histone.v2.parser.node.ExpAstNode;
import ru.histone.v2.property.DefaultPropertyHolder;
import ru.histone.v2.rtti.RunTimeTypeInfo;

import java.util.LinkedHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Example {
    public static void main(String[] args) {
        // for evaluating AST-tree
        final Evaluator evaluator = new Evaluator();
        // for parsing string template
        final Parser parser = new Parser();
        // base executor service
        final ExecutorService executorService = Executors.newFixedThreadPool(10); 
        // base resource loader
        final HistoneResourceLoader loader = new SchemaResourceLoader(executorService);
        // singleton with predefined functions
        final RunTimeTypeInfo runTimeTypeInfo = new RunTimeTypeInfo(executorService, loader, evaluator, parser); 
        final String baseUri = "http://localhost/";
        // context for evaluating
        final Context ctx = Context.createRoot(baseUri, runTimeTypeInfo, new DefaultPropertyHolder()); 
        
        // parsing template and create AST-tree
        final ExpAstNode node = parser.process("{{var x = 'Hello world!!'}}{{x}}", baseUri);
        // evaluate AST-tree
        final String res = evaluator.process(node, ctx);
        
        System.out.println(res);
    }
}
com.github.megafonweblab.histone

Megafon WebLab

Versions

Version
1.9.2
1.9.1
1.9.0
1.8.0
1.7.3
1.7.2
1.7.1
1.7.0
1.6.0
1.5.1
1.5.0
1.4.1
1.4.0