From 70fcd5b20c693a41723ba8bc03b410c7a5e3bd64 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 1 Dec 2015 14:54:22 +0100 Subject: [PATCH] meta. only show year --- oml/meta/openlibrary.py | 7 +++++++ static/js/infoView.js | 7 ++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/oml/meta/openlibrary.py b/oml/meta/openlibrary.py index 2c955f5..7cf527c 100644 --- a/oml/meta/openlibrary.py +++ b/oml/meta/openlibrary.py @@ -136,6 +136,13 @@ def format(info, return_all=False): value = value[0] if key == 'publish_date': value = parse_date(value) + if key == 'publish_places': + for i, v in enumerate(value): + if v.startswith('['): + v = v[1:] + if v.endswith(']'): + v = v[:-1] + value[i] = v data[KEYS[key]] = value if 'subtitle' in info: data['title'] += ' ' + info['subtitle'] diff --git a/static/js/infoView.js b/static/js/infoView.js index 248f0ae..cfcc69d 100644 --- a/static/js/infoView.js +++ b/static/js/infoView.js @@ -113,10 +113,11 @@ oml.ui.infoView = function(identifyData) { function formatValue(value, key) { return value ? (Ox.isArray(value) ? value : [value]).map(function(value) { + if (key == 'date' && value) { + value = value.slice(0, 4); + } return key && !identifyData ? - '' + value + '' + '' + value + '' : value; }).join('; ') : ''; }