Skip to content

undur/Parsley

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

🌿 Parsley

Parsley is a template parser for WO. It's based on WOOgnl and thus supports it's inline binding syntax. It's a pure WO project, meaning it does not require Project Wonder (although, of course, it works fine with Project Wonder as well).

Why?

To get nice inline error messages when template parser errors occur (rather than huge stack-tracey exception pages). Currently, this only applies when you attempt to use an element/component that doesn't exist and for handling UnknownKeyEception (badly formed keypaths in bindings) and WODynamicElementCreationException which for well designed elements will cover things like wrong binding configuration.

parsley_inline_error_screenshot unknowkeyexception

A little video demonstration

IMAGE ALT TEXT HERE

Actually, this isn't the real "why" of the project. But it's currently the nicest byproduct visible to the user, making for a good cover story.

Usage

Development version

To use the current development version of the parser, clone this repo and import the project to your workspace or mvn install it.

Then add this dependency to your pom.xml:

<dependency>
	<groupId>is.rebbi</groupId>
	<artifactId>parsley</artifactId>
	<version>1.2.0-SNAPSHOT</version>
</dependency>

Latest release

Parsley will soon start releasing to the WOCommunity maven repo.

Enabling Parsley in your project

To enable Parsley, add this somewhere in your application's initialization, for example in the Application class constructor:

public Application() {
	parsley.Parsley.register();
	parsley.Parsley.showInlineRenderingErrors( isDevelopmentModeSafe() ); // For enabling inline error reporting in dev mode
}

Differences from WOOgnl

  • We don't support OGNL expressions in binding paths. Support could be added as a plugin, but I'm not a fan of it myself so...
  • We don't support WOOGnl's parseStandardTags behaviour. Might be looked into if anyone actually uses it, which I doubt.
  • We don't support tag processors (WOOgnl's <wo:not> being an example use). Never used them but the idea isn't that bad. However functionality of that kind needs work in the parser so that's for later.
  • For inline bindings, only exactly $true and $false will get interpreted as booleans.

Release notes

1.1.0 - 2025-03-30

  • Only handle rendering exceptions inline that we excplicitly know how to handle

1.0.0 - 2025-03-27

  • Initial release

About

🌿 WO template parser based on WOOgnl

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages