Commit 5e3141e8 authored by Régis Witz's avatar Régis Witz
Browse files

️ improve OC list chapter, as long as OC in notices

parent 9fd5acf7
......@@ -163,6 +163,7 @@ class OuvrageCollectif(Record):
'millesime': '960',
'numéro': '961',
'pages': '962',
'notes': '980',
}
def validate(self, records, errors):
......@@ -192,13 +193,13 @@ class Collection(Record):
RECORD_TYPE = '67'
FIELDS = {
'titre': '1',
'lieu': '231',
'abbreviation': '941',
}
def validate(self, records, errors):
pass
def __repr__(self):
return self.get('titre')[0]
class Tag(Record):
FIELDS = {
......
......@@ -12,9 +12,7 @@ class Signature(heurist.Signature):
class Collection(heurist.Collection):
def as_html(self, records):
return self.get_collection(records)
pass
class Source(heurist.Source):
def as_html(self, records):
......
......@@ -7,12 +7,12 @@ from .auteur import Auteur
class OuvrageCollectif(HeuristObject):
def as_html(self, records):
collection = self.get_collection_str(records)
collection = self.get_collection_for_notice(records)
return '''in: <em><a href='#{uid}'>{titre}</a></em>, <span class='authors'>{auteurs}</span>{collection}, {annee}'''.format(
uid=self.html_id,
titre=self.get('titre')[0],
auteurs=self.get_authors_str(records, True),
collection=collection if collection else '',
collection=collection,
annee=self.get('millesime')[0],
)
......@@ -26,13 +26,16 @@ class OuvrageCollectif(HeuristObject):
Returns:
Un élément <p /> d'uid self.html_id
'''
notes = self.get('notes', None)
notes = ", %s" % notes[0] if notes else ""
auteurs = self.get_authors_str(records, False)
collection = self.get_collection_str(records)
return '''<p id='{uid}'>
<span class='authors'>{auteurs}</span> (éd.), <em>{titre}</em>{collection}, {annee}
<span class='authors'>{auteurs}</span> (éd.), <em>{titre}</em>{notes}{collection}, {annee}
</p>'''.format(
uid=self.html_id,
titre=self.get('titre')[0],
notes=notes,
auteurs=auteurs,
collection=collection,
annee=self.get('millesime')[0],
......@@ -63,7 +66,22 @@ class OuvrageCollectif(HeuristObject):
return ', '.join(formatter(author) for author in authors)
def get_collection_str(self, records):
numero = ', %s' % self.numero if self.numero else ''
collection = self.get_collection(records)
collection = ' (%s%s)' % (collection, numero) if collection else ''
return collection
if not collection:
return ""
abreviation = collection.get('abbreviation', None)
abreviation = "%s – " % abreviation[0] if abreviation else ""
titre = collection.get('titre')[0]
lieu = collection.get('lieu', None)
lieu = ", %s" % lieu[0] if lieu else ""
numero = ", %s" % self.numero if self.numero else ""
return ' (%s%s%s%s)' % (abreviation, titre, lieu, numero)
def get_collection_for_notice(self, records):
collection = self.get_collection(records)
if not collection:
return ""
abreviation = collection.get('abbreviation', None)
abreviation = ", %s" % abreviation[0] if abreviation else ""
numero = ", %s" % self.numero if self.numero else ""
return '%s%s' % (abreviation, numero)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment