+ inspect the 'docinfo' metadata stored in the first node of the document.
+ Note this doesn't give us access to data stored in subsequence blocks
+ that might be considered document metadata, such as 'abstract' or
+ 'dedication' blocks, or the 'meta' role. Doing otherwise is probably more
+ messing with the internals of sphinx than this rare use case merits.
exampledocinfo = env.metadata['metadata']
'author': u'David Goodger',
- u'field name': u'This is a generic bibliographic field.',
- u'field name 2': u'Generic bibliographic fields may contain multiple body elements.\n\nLike this.'}
+ 'authors': [u'Me', u'Myself', u'I'],
+ 'address': u'123 Example Street\nExample, EX Canada\nA1B 2C3',
+ 'field name': u'This is a generic bibliographic field.',
+ 'field name 2': u'Generic bibliographic fields may contain multiple body elements.\n\nLike this.',
+ 'status': u'This is a "work in progress"',
+ 'copyright': u"This document has been placed in the public domain. You\nmay do with it as you wish. You may copy, modify,\nredistribute, reattribute, sell, buy, rent, lease,\ndestroy, or improve it, quote it at length, excerpt,\nincorporate, collate, fold, staple, or mutilate it, or do\nanything else to it that your or anyone else's heart\ndesires.",
+ 'contact': email@example.com',
+ 'organization': u'humankind',
# I like this way of comparing dicts - easier to see the error.
for key in exampledocinfo:
- yield assert_equals, exampledocinfo
[key ], expected_metadata [key ]
+ yield assert_equals, exampledocinfokey, expected_metadatakey
#but then we still have to check for missing keys
yield assert_equals, set(expected_metadata.keys()), set(exampledocinfo.keys())