glossary: now supports quoted and unquoted entries (incl. tests)
This commit is contained in:
@@ -58,7 +58,11 @@ class Glossary:
|
||||
raise GlossaryError(f"File type '{file_path.suffix}' is not supported")
|
||||
with open(file_path, "r") as fd:
|
||||
try:
|
||||
data = yaml.load(fd, Loader=yaml.FullLoader)
|
||||
# use BaseLoader so every entry is read as a string
|
||||
# - disables automatic conversions
|
||||
# - makes it possible to omit quoting for YAML keywords in entries (e. g. 'yes')
|
||||
# - also correctly reads quoted entries
|
||||
data = yaml.load(fd, Loader=yaml.BaseLoader)
|
||||
clean_entries = data['Entries']
|
||||
return cls(name=data['Name'],
|
||||
source_lang=data['SourceLang'],
|
||||
|
||||
Reference in New Issue
Block a user