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).
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.parsley</groupId>
<artifactId>parsley</artifactId>
<version>1.4.1</version>
</dependency>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
}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.
- OGNL expressions are supported via the optional
parsley-ognlmodule (see below). - We don't support WOOGnl's
parseStandardTagsbehaviour. - 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
$trueand$falsewill get interpreted as booleans (these were case insensitive in WOOgnl).
- Template parser now fails on duplicate attributes in dynamic tags, e.g.
<wo:str value="yeah" value="wat" />. Previous versions (and WOOgnl) silently ignored duplicate bindings and just used the last declared binding value. - Update ognl version used by
parsley-ognlto 3.4.11
- Breaking: Maven groupId changed from
is.rebbitois.rebbi.parsley - Pluggable association factories via
Parsley.register(factory) - Pluggable element factories per namespace via
Parsley.registerElementFactory(namespace, factory) - New
parsley-ognlmodule providing optional OGNL expression support (prefix~in binding values) - Parser and template model classes now provided by the
ng-template-parserdependency. The parser has been completely rewritten as a single-pass recursive descent parser, replacing the old 3-stage pipeline (NGStringTokenizer โ NGHTMLParser โ callback โ NGTemplateParser). New parser features (via ng-template-parser):<p:raw>...</p:raw>directive โ Wraps content that should be passed through verbatim without any template processing. Supports nesting. Useful for wrapping<script>blocks or any content that might contain characters that could confuse the parser.
<p:comment>...</p:comment>directive โ Developer comments that are stripped entirely from rendered output. Also supports nesting. Unlike HTML comments, these are guaranteed to produce nothing in the output.- Configurable dynamic namespaces โ The old parser hardcoded
wo:(andwebobject). The new parser accepts a configurable set of namespace names. Tags with unrecognized namespaces (e.g.svg:rect,xsl:template) pass through as plain HTML. - Source position tracking โ Every node carries a source range. Error messages now include line and column numbers. The old parser just said "something's wrong"; the new one says "line 42, column 15".
- Boolean (valueless) attributes โ Inline tags now support HTML-style boolean attributes, e.g.
<wo:Widget disabled />. The old parser required every binding to have a value. - Self-closing tag tracking โ The parser now records whether a tag was self-closing (
/>). - Better error detection โ Catches malformed tags like
<wo: Repetition>(space after colon) and</ wo:Conditional>(space after</) with specific error messages, rather than silently misbehaving. - HTML comments no longer specially parsed โ
<!-- -->comments flow through as plain HTML content rather than being tracked by the parser. Use<p:comment>for comments you want stripped from output.
- Exclude ERXWOTemplate from element proxying in dev mode
- Deploy to WOCommunity maven repo
- Nicer messages for UnknownKeyException
- Some generic parser logic cleanup
- Only handle rendering exceptions inline that we excplicitly know how to handle
- Initial release


