Flatten attribute for publish plugins

plus move examples to tests

Change-Id: Ia785afe40da81c77abe643f3c788e5d4faefbf5d
Merge "Flatten attribute for publish plugins"