Fix bugs with saving tags in yaml.
- now saves tag set as list (maybe the save_meta function should be moved to paper.py) - updates test to actually test storing of metadata
This commit is contained in:
parent
467e9f4713
commit
e017ffef20
@ -108,7 +108,10 @@ def save_bibdata(bib_data, filepath):
|
|||||||
|
|
||||||
|
|
||||||
def save_meta(meta_data, filepath):
|
def save_meta(meta_data, filepath):
|
||||||
write_yamlfile(filepath, meta_data)
|
new_meta = meta_data.copy()
|
||||||
|
# Cannot store sets in yaml
|
||||||
|
new_meta['tags'] = list(new_meta['tags'])
|
||||||
|
write_yamlfile(filepath, new_meta)
|
||||||
|
|
||||||
|
|
||||||
# is this function ever used? 08/06/2013
|
# is this function ever used? 08/06/2013
|
||||||
|
@ -20,7 +20,7 @@ CITEKEY_EXCLUDE_RE = re.compile('[%s]'
|
|||||||
|
|
||||||
BASE_META = {
|
BASE_META = {
|
||||||
'external-document': None,
|
'external-document': None,
|
||||||
'tags': [],
|
'tags': set(),
|
||||||
'notes': [],
|
'notes': [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ turing1950.bibentry.fields['title'] = u'Computing machinery and intelligence.'
|
|||||||
turing1950.bibentry.fields['year'] = u'1950'
|
turing1950.bibentry.fields['year'] = u'1950'
|
||||||
turing1950.bibentry.persons['author'] = [Person(u'Alan Turing')]
|
turing1950.bibentry.persons['author'] = [Person(u'Alan Turing')]
|
||||||
turing1950.citekey = turing1950.generate_citekey()
|
turing1950.citekey = turing1950.generate_citekey()
|
||||||
|
turing1950.tags = ['computer', 'AI']
|
||||||
|
|
||||||
|
|
||||||
doe2013 = Paper()
|
doe2013 = Paper()
|
||||||
|
@ -24,7 +24,7 @@ entries:
|
|||||||
META = """
|
META = """
|
||||||
external-document: null
|
external-document: null
|
||||||
notes: []
|
notes: []
|
||||||
tags: []
|
tags: ['AI', 'computer']
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user