Fehérke's GitHub Site == glue between Fehérke's GitHub hosted projects

Debug

Sometimes is not simple to guess why the variable set in the YAML front matter is not inserted as expected in the generated document. This plugin was initially written to just display the class name of a variable.

Most of the time looking at output of the generator is easier than looking into the generated document. And always is easier to look at one generator output that looking in all generated documents to check one value in each. That is why this plugin got its second filter, to puts the value to the output.

But the Ruby objects have many handy methods and the Liquid template allows using only a couple of them. So I just deleted everything and wrote a single filter : call.

Note
In version 0.2 the call filter’s name was send. Renamed in version 0.3 because some conflict.

Usage

call is a Liquid filter, so you just put it after the {{ and }} enclosed variable. The first parameter is the method name, the remaining parameters are passed forward to the called method :

sample code – Liquid template

Type of variable is {{ variable | call: 'class' | call: 'name' }}
3rd letter of variable is {{ variable | call: '[]', 2 }}
Print variable to stdout {{ variable | call: 'display' }}

log is a Liquid filter which returns nil. It just writes the variable’s value into the specified file, together with a timestamp.

sample code – Liquid template

{{ variable | log: '/tmp/liquid.log' }}

Configuration

None.

Versions

Plans

Download

You can find the related files on GitHub in my Jekyll-plugin repository’s debug directory :