No, snippets do not have access to any data about the book. They only know about the text in their templates. Someday I will add a more general macro system to the editor for which it would be possible to define your own arbitrary python code to do things. But not for a while