Code52/pretzel — pull request #157 by miguelerm (2013-09-11 17:41:24+00:00)
Title: Add support to load dlls in "_plugins" path

Add support to recompose the Filters and Tags dependencies in the
LiquidEngine.

## Use Example ##

- Create a new Class Library Project called CustomTags
- Add a reference to the assembly **Pretzel.exe**.
- Add the classes listed above.
- Compile and put the assembly inside the `_plugins` folder of the pretzel site.

> When you run the `pretzel.exe` command, this check if the `_plugins` folder exists and load through MEF the assemblies inside that path and recompose the dependencies.

in your post you can put this filter `{{ 'hola mundo' | md5 }}` that should be rendered as:

`0ad066a5d29f3f2a2a1c7c17dd082a79`

and this block

```
{% dumy %}

Texto que debe aparecer en rojo :)

{% enddummy %}
```

should be rendered as:

```html

Texto que debe aparecer en rojo :)

```

### Md5 Liquid Filter Demo ###

```csharp
[Export(typeof(IFilter))]
public class Md5Filter: IFilter
{
public string Name
{
get { return "Md5"; }
}

public static string Md5(string input)
{
Console.WriteLine("Computing md5 hash...");

// md5 hash algorithm taked from http://stackoverflow.com/a/13806183

MD5 md5Hash = MD5.Create();
// Convert the input string to a byte array and compute the hash.
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));

// Create a new Stringbuilder to collect the bytes
// and create a string.
StringBuilder sBuilder = new StringBuilder();

// Loop through each byte of the hashed data
// and format each one as a hexadecimal string.
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}

Console.WriteLine("md5 hash computed.");

// Return the hexadecimal string.
return sBuilder.ToString();
}

}
```

### Dummy Liquid Block Demo ###

```csharp
[Export(typeof(Tag))]
public class Dummy : Block
{
public override void Render(Context context, System.IO.TextWriter result)
{
result.Write("

");
base.Render(context, result);
result.Write("

");

}
}
```

I hope it can be useful.