Exemplo n.º 1
0
oo.text.setString(u'')

refs = [(1, 'a', 'bibtex-a'),
        (2, 'b', 'bibtex-b')]
oo.cite(refs, None)

# check that the citations have been inserted in the document
r = oo.text.getString()
assert r == u'[a][b]', repr(r)

# check that the document can return the existing citations
r = oo.fetch()
assert r == refs, repr(r)

# create the bibliography
insert = oo.update_biblio()
insert.begin_biblio()
for uid, key, extra in refs:
    insert.begin_reference(key)
    r = Store.Record()
    r.add('id', key, Attribute.ID)
    insert(formatter(r))
    insert.end_reference(key)
insert.end_biblio()

r = oo.text.getString()
assert r == u'''\
[a][b]

[a]\xa0This has key a
[b]\xa0This has key b