Histone Core Module

Implementation of histone engine

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.github.megafonweblab.histone
ArtifactId

ArtifactId

histone-java-v2
Last Version

Last Version

1.9.2
Release Date

Release Date

Type

Type

jar
Description

Description

Histone Core Module
Implementation of histone engine

Download histone-java-v2

How to add to project

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

Dependencies

compile (13)

Group / Artifact Type Version
com.github.megafonweblab.histone : histone-acceptance-test jar 1.9.2
com.fasterxml.jackson.core : jackson-core jar 2.8.9
com.fasterxml.jackson.core : jackson-databind jar 2.8.9
javax.ws.rs : javax.ws.rs-api jar 2.0.1
org.apache.cxf : cxf-rt-rs-client jar 3.1.12
com.fasterxml.jackson.jaxrs : jackson-jaxrs-json-provider jar 2.8.9
org.apache.httpcomponents : httpclient jar 4.5.3
commons-io : commons-io jar 2.5
org.apache.commons : commons-lang3 jar 3.5
commons-collections : commons-collections jar 3.2.2
com.google.guava : guava jar 21.0
org.testng : testng jar 6.11
org.slf4j : slf4j-api jar 1.7.25

test (16)

Group / Artifact Type Version
org.eclipse.jetty : jetty-server jar 9.4.6.v20170531
org.eclipse.jetty : jetty-webapp jar 9.4.6.v20170531
org.eclipse.jetty : jetty-util jar 9.4.6.v20170531
org.eclipse.jetty : jetty-http jar 9.4.6.v20170531
org.eclipse.jetty : jetty-io jar 9.4.6.v20170531
org.slf4j : log4j-over-slf4j jar 1.7.25
org.slf4j : jcl-over-slf4j jar 1.7.25
ch.qos.logback : logback-classic jar 1.2.3
org.junit.jupiter : junit-jupiter-api jar 5.0.0-M4
org.junit.jupiter : junit-jupiter-engine jar 5.0.0-M4
org.junit.vintage : junit-vintage-engine jar 4.12.0-M4
org.junit.platform : junit-platform-launcher jar 1.0.0-M4
org.mockito : mockito-all jar 1.10.19
javax.servlet : javax.servlet-api jar 3.1.0
org.eclipse.jetty.aggregate : jetty-server jar 8.1.8.v20121106
org.reflections : reflections jar 0.9.8

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
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0