Invalid Entry.to_string("yaml") for type @techreport

Issue #158 new
Johann Petrak created an issue

When an entry of type @techreport gets converted to yaml using someentry.to_string(“yaml”) then the type gets serialized as “Technical report”. When reading that yaml representation back, the type is kept and when then serializing to bibtex we get @Technical report{.. which is wrong.

Code to reproduce:

rom pybtex.database import parse_string, Entry

db = parse_string("""
@techreport{key1,
    author = "Last, First",
    title = "Some title",
    year = "1990",
    institution = "Institution",
    number = "0001",
    type = "Technical Report",
    url = "http://some.url.com"
}
""", "bibtex")
entry = db.entries["key1"]

print(entry.to_string("bibtex"))
str1 = entry.to_string("yaml")
print(str1)
entry = Entry.from_string(str1, "yaml")
print(entry.to_string("bibtex"))

produces:

@techreport{key1,
    author = "Last, First",
    title = "Some title",
    year = "1990",
    institution = "Institution",
    number = "0001",
    type = "Technical Report",
    url = "http://some.url.com"
}

entries:
    key1:
        type: Technical Report
        title: Some title
        year: '1990'
        institution: Institution
        number: '0001'
        url: http://some.url.com
        author:
        -   first: First
            last: Last

@Technical Report{key1,
    author = "Last, First",
    title = "Some title",
    year = "1990",
    institution = "Institution",
    number = "0001",
    url = "http://some.url.com"
}

Comments (0)

  1. Log in to comment