Skip to content

Commit

Permalink
document: resolve the processing of the title field
Browse files Browse the repository at this point in the history
During processing only the last subfield appeared in the result.
All subfields are now available in the result.

* Closes rero#1745.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
Garfield-fr authored and jma committed Mar 16, 2021
1 parent 9ad6be9 commit 8e2f9f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rero_ils/modules/documents/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def title_format_text(title, with_subtitle=True):
for main_title in main_titles:
language = main_title.get('language', 'default')
value = main_title.get('value', '')
main_title_output[language] = value
main_title_output.setdefault(language, []).append(value)

# build subtitle string per language
subtitle_output = {}
Expand All @@ -404,7 +404,7 @@ def title_format_text(title, with_subtitle=True):
for subtitle in subtitles:
language = subtitle.get('language', 'default')
value = subtitle.get('value', '')
subtitle_output[language] = value
subtitle_output.setdefault(language, []).append(value)

# build part strings per language
parts = title.get('part', [])
Expand All @@ -428,9 +428,9 @@ def title_format_text(title, with_subtitle=True):
# if a vernacular title exists it will be place on top of the title list
title_text = []
for key, value in main_title_output.items():
value = main_title_output.get(key)
value = '. '.join(main_title_output.get(key))
if subtitle_output and with_subtitle and key in subtitle_output:
value = ' : '.join((value, subtitle_output.get(key)))
value = ' : '.join((value, ' : '.join(subtitle_output.get(key))))
if part_output and key in part_output and part_output.get(key):
value = '. '.join((value, part_output.get(key)))
if display_alternate_graphic_first(key):
Expand Down

0 comments on commit 8e2f9f8

Please sign in to comment.