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).

Usage

Note that If you're using wonder-slim you don't have to do do anything to add or enable Parsley. It's already there.

Parsley releases are deployed to the WOCommunity maven repository, so if you've got your environment set up for WO development just add this dependency to your pom.

<dependency>
	<groupId>is.rebbi</groupId>
	<artifactId>parsley</artifactId>
	<version>1.3.0</version>
</dependency>

Enabling Parsley in your project

Parsley is not enabled by default so to use it as your app's default template parser, you'll have to activate it somewhere during your application's initialization. For example in your Application's constructor:

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

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.

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.

parsley_inline_error_screenshot unknowkeyexception

A little video demonstration

IMAGE ALT TEXT HERE

Differences from WOOgnl

  • We don't support OGNL expressions in binding paths. Support could be added as a plugin feature if anyone really wants it.
  • We don't support WOOGnl's parseStandardTags behaviour.
  • 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 a little work in the parser.
  • For inline constant bindings, only exactly $true and $false will get interpreted as booleans (these were case insensitive in WOOgnl).

Release notes

1.3.0 - 2025-11-15

  • Exclude ERXWOTemplate from element proxying in dev mode

1.2.0 - 2025-10-15

  • Deploy to WOCommunity maven repo
  • Nicer messages for UnknownKeyException
  • Some generic parser logic cleanup

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