Chunk


Source link: https://github.com/tomj74/chunk-templates

Chunk Templates for Java

Full documentation at http://www.x5software.com/chunk/

Chunk is a Java Template Engine for applications that serve HTML or XML. It's the little engine that can handle any templating job, plain text, markup, markdown, whatever, wherever.

Chunk is compact and speedy, easy to learn yet very powerful.

Chunk templates provide a rich featureset: in-tag filters, in-tag default values, includes, looping and branching, defining multiple snippets per template file, layered themes, macros, and much much more.

Quick Start

Browse the fabulous documentation chock full of examples and recipes.

Download the latest chunk-template jar. Works with Java 1.5 and up.

Available from Maven Central:


 <dependency>

 <groupId>com.x5dev</groupId>

 <artifactId>chunk-templates</artifactId>

 <version>3.3.1</version>
  </dependency> 

Features

  • Compatible with Android, GAE (Google App Engine), Spring MVC.
  • Nestable looping and branching (if/elseIf/else).
  • Macros, includes and conditional includes.
  • Speedy rendering engine that pre-parses templates.
  • Curly-brace { $tags } pop nicely in a backdrop full of <AngleBrackets> (and your xml/html can still validate).
  • Flexible null-handling; template designer may easily specify default tag values.
  • Swiss army knife of chainable filters a la { $tag|trim } , including regex (regular expressions), sprintf.
  • Localization framework.
  • Rapid MVC: Glue a "model" object (or objects) to a "view" template with a single line of controller code.
  • Define multiple composable snippets per template file.
  • Stateless tags - encourages cleaner code via separation of concerns.
  • Support for theme layers with layered inheritance.
  • Hooks for extending - add your own filters, template loader, or tag protocol.
  • Eclipse Template Editor plugin available with syntax highlighting & more.

An Eclipse plugin provides syntax highlighting, outline navigation pane for snippets in .chtml files, and auto-hyperlinks of snippet references. Requires Eclipse Helios (3.6) or better. Get the plugin.


Dependencies

Most features work fully with the standalone jar. A couple advanced features can be unlocked by adding these libraries to the classpath:


 <dependency>

 <groupId>net.minidev</groupId>

 <artifactId>json-smart</artifactId>

 <version>1.1.1</version>
  </dependency> 
  • Enable jeplite-powered math expression evaluation via the |calc(...) filter - download jeplite jar or fetch via maven:

 <dependency>

 <groupId>org.cheffo</groupId>

 <artifactId>jeplite</artifactId>

 <version>0.8.7a</version>
  </dependency> 

Android: Binding Beans to Template

Note: on Android (optional) - to make use of chunk.setToBean("tag",bean) binding, just make sure to include this additional dependency in your project:


 <dependency>

 <groupId>com.madrobot</groupId>

 <artifactId>madrobotbeans</artifactId>

 <version>0.1</version>
  </dependency> 

Or download madrobotbeans-0.1.jar from the Downloads area. Thanks to Elton Kent and the Mad Robot project.

Resources

Output per-package method counts.

Secure and easy storage for Android.

Hawk uses:

  • AES for the crypto
  • SharedPreferences for the storage
  • Gson

Hawk provides:

  • Secure data persistence
  • Save any type
  • Save list of any type

A SharedPreferences injection library for Android. Using annotation processing, this library makes it easy to load SharedPreferences values and listen for changes.

WearPrefs allows you to easily sync SharedPreferences files between an Android app and a paired Android Wear app. Useful for creating settings that apply across devices.

Separating data and state handling from Fragments or Activities without lots of boilerplate-code. Reducing them to simple dumb views.

A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes