Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashawley/vtl-examples
Velocity template language
https://github.com/ashawley/vtl-examples
Last synced: 5 days ago
JSON representation
Velocity template language
- Host: GitHub
- URL: https://github.com/ashawley/vtl-examples
- Owner: ashawley
- License: apache-2.0
- Created: 2018-11-14T14:31:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-14T15:59:29.000Z (about 6 years ago)
- Last Synced: 2024-10-31T12:46:47.739Z (about 2 months ago)
- Language: Scala
- Homepage: https://velocity.apache.org
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Velocity template language examples
===================================These examples are from [Apache Velocity Project](https://velocity.apache.org/)'s
source repository. They are converted from Java and shell scripts to
[Scala](https://scala-lang.org/) and can be run from the
[sbt](https://scala-sbt.org/) build tool.Starting sbt:
```
$ sbt
```You can compile all the examples from the sbt console:
```
> compile
```How to run each of the examples is shown below.
app_example1
------------This simple example shows how to use the Velocity Template Engine
in a standalone program.```
> app_example1/run example.vm
```app_example2
------------Another simple example showing how to use Velocity in a standalone
program. This examples uses the `org.apache.velocity.app.Velocity`
application utility class, which provides a few convenient methods for
application programmers.```
> app_example2/run
```logger_example
--------------This 'toy' example shows how to use the Velocity logger interface
to have any class function as a logging facility.```
> logger_example/runMain LoggerExample
```This class demonstrates how to configure Velocity to use an
existing log4j logger for logging.You will see that the log4j output will contain the output from
velocity's initialization.```
> logger_example/runMain Log4jLoggerExample
```context_example
---------------This is a demonstration of 2 different context implementations:
- a context implementation that uses a database as the storage.
Use the `DBContextTest` program to test. See the DBContextTest.scala file for the
db table info. Unsupported demonstration code. You may need to futz with
it to get it to work in your environment.
- a context implementation that uses a `TreeMap` for storage. Very simple.```
> context_example/run dbtest.vm
```event_example
-------------This simple example demonstrates the event handling features of
the Velocity Template Engine.```
> event_example/run
```xmlapp_example
--------------Another simple example showing how to use Velocity in a standalone
program. This example shows how to use Velocity to access XML data
directly from an XML input file within the template. It also
demonstrates velocimacro recursion.```
> xmlapp_example/run xml.vm
```Provenance
----------These examples are based on checking out from version 1.7:
```
git svn clone -r1035365
--ignore-paths="^(branches|tags)"
--stdlayout
http://svn.apache.org/repos/asf/velocity/engine/ ./velocity
```