Welcome to PBars

PBars offers simple handlebars-style templating for the .NET platform.

Key features

Why a new library?

There are good implementations for handlebars style templating, mostly known is probably mustachesharp. I did a small projects, where I needed templating to scaffold unit tests and used mustachesharp for it. Though it worked, I came to the conclusion, that the library hat some drawbacks for me since it's targeted towards rendering HTML. You do not have (and for that matter need) as strict control over line breaks and spaces, or - if you aim at an exact output, your templates look cluttered and get hard to maintain.
The idea behind PBars is to make raw text output for those cases somehow easier. You can still use it to render HTML, however the real power comes when you want to render something else (like source code). Another library that really inspred me is Markup.js. It introduces the concept of Pipes, which are used to transform the raw contents of the model into something else. Pipes can for instance be used to format output and are really versatile and easy to use. PBars uses this concept too, there are some good pipes included and writing your own is really easy.

Limitiations

Disclaimer

This is an early version of the library - you should probably not use it for production code at this point!

If you have any feedback or comments, mail me: info@aschommer.de.

Acknowledgements

This library uses TinyIoC for dependency injection. Concepts are heavily inspired by Markup.js. Thanks to the authors of these fine libraries. Without them, this project would not have happened.

License

The MIT License (MIT)

Copyright (c) 2015 Andreas Schommer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.