change figures metadata format

along with some refactoring in flags.py
fix in nodes.py
Make LaTeXNode log analysis more robust.
Add $key{flags} and $key[flags] flagged keys