Escaping of template literals

Any character that has special meaning in pkg-config confinguration
files, is now escaped during serialization. This way anything that gets
in to literal template fragment is treated as is.

This code is based on pkg-config code and should be consistent with
their implementation.