def getDecoratedTitle(real_self): """ #commented out, because it is unmaintained # >>> from mock import Mock # >>> at_mock = Mock() # >>> at_mock.customCitation = '' # >>> at_mock.title = 'Homepage of SYSLAB.COM GmbH' # >>> presentation = PresentationOnlineResourceNoMagic(at_mock) # >>> presentation.getDecoratedTitle() # u'Homepage of SYSLAB.COM GmbH' # Original Specification # [Titel online resource] () # perspectivia.net – Publikationsplattform für die Geisteswissenschaften """ self = real_self.magic rezensent_string = getFormatter(' ')(self.reviewAuthors[0]["firstname"], self.reviewAuthors[0]["lastname"]) if rezensent_string: rezensent_string = "(%s)" % real_self.directTranslate( Message(u"presented_by", "recensio", mapping={u"review_authors": rezensent_string})) full_citation = getFormatter(' ') return full_citation( self.title.decode('utf-8'), rezensent_string)
def getDecoratedTitle(real_self): """ >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.formatted_authors_editorial = "Patrick Gerken / Alexander Pilz" >>> at_mock.punctuated_title_and_subtitle = "Plone 4.0. Das Benutzerhandbuch" >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian', 'lastname' : 'de Roiste'}] >>> review = PresentationMonographNoMagic(at_mock) >>> review.directTranslate = lambda a: a >>> review.getDecoratedTitle() u'Patrick Gerken / Alexander Pilz: Plone 4.0. Das Benutzerhandbuch (presented_by)' Original Specification [Werkautor Vorname] [Werkautor Nachname]: [Werktitel]. [Werk-Untertitel] Hans Meier: Geschichte des Abendlandes. Ein Abriss """ self = real_self.magic rezensent_string = getFormatter(' ')(self.reviewAuthors[0]["firstname"], self.reviewAuthors[0]["lastname"]) if rezensent_string: rezensent_string = "(%s)" % real_self.directTranslate( Message(u"presented_by", "recensio", mapping={u"review_authors": rezensent_string})) full_citation = getFormatter(': ', ' ') return full_citation( self.formatted_authors_editorial, self.punctuated_title_and_subtitle, rezensent_string)
def getDecoratedTitle(self, obj): rezensent_string = getFormatter(' ')( obj.reviewAuthors[0]["firstname"], obj.reviewAuthors[0]["lastname"]) if rezensent_string: rezensent_string = "(%s)" % translate_message( Message(u"presented_by", "recensio", mapping={u"review_authors": rezensent_string})) titles = "<span class='title'>%s</span>" % obj.punctuated_title_and_subtitle full_citation = getFormatter(', ', ' ') return full_citation(obj.formatted_authors_editorial(), titles, rezensent_string)
def getDecoratedTitle(self, obj): rezensent_string = getFormatter(' ')( obj.reviewAuthors[0]["firstname"], obj.reviewAuthors[0]["lastname"]) if rezensent_string: rezensent_string = "(%s)" % translate_message( Message(u"presented_by", "recensio", mapping={u"review_authors": rezensent_string})) full_citation = getFormatter(' ') title = "<span class='title'>%s</span>" % obj.title.decode('utf-8') return full_citation(title, rezensent_string)
def punctuated_title_and_subtitle(self): """ #3129 Note: all review types except for Presentation Online Resource have the subtitle field""" title = self.title subtitle = self.subtitle last_char = title[-1] if last_char in ["!", "?", ":", ";", ".", ","]: return getFormatter(" ")(title, subtitle) else: return getFormatter(". ")(title, subtitle)
def getDecoratedTitle(real_self): """ Dude, where is my doctest? """ self = real_self.magic rezensent_string = getFormatter(" ")(self.reviewAuthors[0]["firstname"], self.reviewAuthors[0]["lastname"]) if rezensent_string: rezensent_string = "(%s)" % real_self.directTranslate( Message(u"presented_by", "recensio", mapping={u"review_authors": rezensent_string}) ) full_citation = getFormatter(": ", " ") return full_citation(self.formatted_authors_editorial, self.punctuated_title_and_subtitle, rezensent_string)
def getDecoratedTitle(real_self, lastname_first=False): """ >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.title = "Plone Mag" >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian', 'lastname' : 'de Roiste'}] >>> at_mock.yearOfPublication = '2009' >>> at_mock.officialYearOfPublication = '2010' >>> at_mock.volumeNumber = '1' >>> at_mock.issueNumber = '3' >>> review = ReviewJournalNoMagic(at_mock) >>> review.directTranslate = lambda a: a >>> review.getDecoratedTitle() u'Plone Mag, 1 (2010/2009), 3 (reviewed_by)' """ self = real_self.magic item = getFormatter(', ', ' ', ', ') mag_year = getFormatter('/')(self.officialYearOfPublication, self.yearOfPublication) mag_year = mag_year and '(' + mag_year + ')' or None item_string = item( self.title, self.volumeNumber, mag_year, self.issueNumber) if lastname_first: reviewer_string = get_formatted_names( u' / ', ', ', self.reviewAuthors, lastname_first = lastname_first) else: reviewer_string = get_formatted_names( u' / ', ' ', self.reviewAuthors, lastname_first = lastname_first) if reviewer_string: reviewer_string = "(%s)" % real_self.directTranslate( Message(u"reviewed_by", "recensio", mapping={u"review_authors": reviewer_string})) return ' '.join(( item_string, reviewer_string))
def get_formatted_names(full_name_separator, name_part_separator, names, lastname_first=False): name_part1 = "firstname" name_part2 = "lastname" if lastname_first: name_part1 = "lastname" name_part2 = "firstname" return escape(full_name_separator.join( [getFormatter(name_part_separator)(x[name_part1], x[name_part2]) for x in names]))
def getDecoratedTitle(self, obj, lastname_first=False): item = getFormatter(', ', ' ', ', ') mag_year = getFormatter('/')(obj.officialYearOfPublication, obj.yearOfPublication) mag_year = mag_year and '(' + mag_year + ')' or None item_string = u'<span class="title">%s</span>' % item( obj.title, obj.volumeNumber, mag_year, obj.issueNumber) if lastname_first: reviewer_string = get_formatted_names( u' / ', ', ', obj.reviewAuthors, lastname_first=lastname_first) else: reviewer_string = get_formatted_names( u' / ', ' ', obj.reviewAuthors, lastname_first=lastname_first) if reviewer_string: reviewer_string = "(%s)" % translate_message( Message(u"reviewed_by", "recensio", mapping={u"review_authors": reviewer_string})) return ' '.join((item_string, reviewer_string))
def get_citation_string(real_self): """ >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.reviewAuthors = [{'firstname' : 'Manuel♥', 'lastname' : 'Reinhard♥'}] >>> at_mock.title = 'Homepage of SYSLAB.COM GmbH♥' >>> at_mock.portal_url = lambda :'http://www.syslab.com' >>> at_mock.UID = lambda :'12345' >>> at_mock.uri = 'http://www.syslab.com/home♥' >>> presentation = PresentationOnlineResourceNoMagic(at_mock) >>> presentation.directTranslate = lambda m: m.default >>> presentation.get_citation_string() u'Reinhard\u2665, Manuel\u2665: presentation of: Homepage of SYSLAB.COM GmbH\u2665, http://www.syslab.com/home\u2665, <a href="http://syslab.com/r/12345">http://syslab.com/r/12345</a>' Original Specification [Präsentator Nachname], [Präsentator Vorname]: presentation of: [Titel online resource], [URL online resource], URL recensio. Meier, Hans: presentation of: perspectivia.net – Publikationsplattform für die Geisteswissenschaften, www.perspectivia.net, www.recensio.net/## """ self = real_self.magic args = { 'presentation_of' : real_self.directTranslate(Message( u"text_presentation_of", "recensio", default="presentation of:")), 'in' : real_self.directTranslate(Message( u"text_in", "recensio", default="in:")), 'page' : real_self.directTranslate(Message( u"text_pages", "recensio", default="p.")), ':' : real_self.directTranslate(Message( u"text_colon", "recensio", default=":")), } rezensent = getFormatter(u', ') item = getFormatter(u', ', u', ') full_citation = getFormatter(u'%(:)s %(presentation_of)s ' % args) rezensent_string = rezensent(self.reviewAuthors[0]["lastname"], self.reviewAuthors[0]["firstname"]) item_string = item(escape(self.title), escape(self.uri), real_self.getUUIDUrl()) return full_citation(escape(rezensent_string), item_string)
def getFirstPublicationData(real_self): self = real_self.magic retval = [] reference_mag = getFormatter(', ', ', ') reference_mag_string = reference_mag(self.get_publication_title(), \ self.get_volume_title(), self.get_issue_title()) if self.canonical_uri: url = self.canonical_uri short_url = len(url) < 60 and url or url[:57] + "..." retval.append('<a href="%s">%s</a>' % (url, short_url)) elif reference_mag_string: retval.append(escape(reference_mag_string)) return retval
def getDecoratedTitle(self, obj, lastname_first=False): authors_string = obj.formatted_authors_editorial() rezensent_string = get_formatted_names( u' / ', ' ', obj.reviewAuthors, lastname_first=lastname_first) if rezensent_string: rezensent_string = "%s" % translate_message( Message( u"reviewed_by", "recensio", mapping={u"review_authors": rezensent_string}, ) ) titles = "<span class='title'>%s</span>" % obj.punctuated_title_and_subtitle pub_year = "(%s)" % obj.yearOfPublication full_citation = getFormatter(', ', ' ', ', ') return full_citation(authors_string, titles, pub_year, rezensent_string)
def getDecoratedTitle(real_self, lastname_first=False): """ >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.customCitation = '' >>> at_mock.formatted_authors_editorial = "Patrick Gerken / Alexander Pilz" >>> at_mock.punctuated_title_and_subtitle = "Plone 4.0. Das Benutzerhandbuch" >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian', 'lastname' : 'de Roiste'}] >>> review = ReviewMonographNoMagic(at_mock) >>> review.directTranslate = lambda a: a >>> review.getDecoratedTitle() u'Patrick Gerken / Alexander Pilz: Plone 4.0. Das Benutzerhandbuch (reviewed_by)' Original Spec: [Werkautor Vorname] [Werkautor Nachname]: [Werktitel]. [Werk-Untertitel] (reviewed by [Rezensent Vorname] [Rezensent Nachname]) Analog, Werkautoren kann es mehrere geben (Siehe Citation) Hans Meier: Geschichte des Abendlandes. Ein Abriss (reviewed by Klaus Müller) """ self = real_self.magic name_part_separator = " " if lastname_first: name_part_separator = ", " authors_string = self.formatted_authors_editorial rezensent_string = get_formatted_names(u" / ", " ", self.reviewAuthors, lastname_first=lastname_first) if rezensent_string: rezensent_string = "(%s)" % real_self.directTranslate( Message(u"reviewed_by", "recensio", mapping={u"review_authors": rezensent_string}) ) full_citation = getFormatter(": ", " ") return full_citation(authors_string, self.punctuated_title_and_subtitle, rezensent_string)
def get_citation_string(real_self): """ NOTE: There is no differentiation between title and subtitle of the collection book. Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.customCitation = '' >>> at_mock.get = lambda x: None >>> at_mock.authors = [{'firstname': x[0], 'lastname' : x[1]} for x in (('Patrick♥', 'Gerken♥'), ('Alexander', 'Pilz'))] >>> at_mock.editorsCollectedEdition = [{'firstname': x[0], 'lastname' : x[1]} for x in (('Tina♥', 'Pecek♥'), ('Wolfgang', 'Thomas'))] >>> at_mock.title = "Plone 4.0 für Dummies♥?" >>> at_mock.subtitle = "Plone 4 in 19 Tagen lernen!♥" >>> at_mock.titleCollectedEdition = 'Plone 4 komplett. ALLES zu Plone♥' >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian♥', 'lastname' : 'de Roiste♥'}] >>> at_mock.yearOfPublication = '2010♥' >>> at_mock.publisher = 'SYSLAB.COM GmbH♥' >>> at_mock.placeOfPublication = 'München♥' >>> at_mock.issueNumber = '3♥' >>> at_mock.volumeNumber = '1♥' >>> at_mock.titleJournal = 'Open Source Mag♥' >>> at_mock.portal_url = lambda :'http://www.syslab.com' >>> at_mock.UID = lambda :'12345' >>> at_mock.page_start_end_in_print = '11-21' >>> presentation = PresentationCollectionNoMagic(at_mock) >>> presentation.directTranslate = lambda m: m.default >>> presentation.get_citation_string() u'de Roiste\u2665, Cillian\u2665: presentation of: Gerken\u2665, Patrick\u2665 / Pilz, Alexander, Plone 4.0 f\\xfcr Dummies\u2665? Plone 4 in 19 Tagen lernen!\u2665, in: Pecek\u2665, Tina\u2665 / Thomas, Wolfgang (ed.), Plone 4 komplett. ALLES zu Plone\u2665, M\\xfcnchen\u2665, SYSLAB.COM GmbH\u2665, 2010\u2665, p. 11-21 <a href="http://syslab.com/r/12345">http://syslab.com/r/12345</a>' Original Specification [Präsentator Nachname], [Präsentator Vorname]: presentation of: [Werkautor Nachname], [Werkautor Vorname], [Werktitel]. [Werk-Untertitel], in: [Hrsg. Sammelband Nachname], [Hrsg. Sammelband Vorname] (ed.), [Titel Sammelband], [Erscheinungsort]: [Verlag], [Jahr], p.[pageStart]-[pageEnd] URL recensio. Hrsg.Sammelband Editoren kann es mehrere geben, die werden dann durch ' / ' getrennt alle aufgelistet. Note: Untertitel Sammelband entfernt, dieser wird in das Feld Titel Sammelband eingetragen Note: gezähltes Jahr entfernt. Meier, Hans: presentation of: Meier, Hans, Geschichte des Abendlandes. Ein Abriss, in: Müller, Hans (ed.), Geschichte des Morgen- und Abendlandes. Eine Übersicht, München: Oldenbourg, 2010, www.recensio.net/## """ self = real_self.magic gf = getFormatter args = { 'presentation_of' : real_self.directTranslate(Message( u"text_presentation_of", "recensio", default="presentation of:")), 'in' : real_self.directTranslate(Message( u"text_in", "recensio", default="in:")), 'page' : real_self.directTranslate(Message( u"text_pages", "recensio", default="p.")), ':' : real_self.directTranslate(Message( u"text_colon", "recensio", default=":")), 'ed' : real_self.directTranslate(Message( u"label_abbrev_editor","recensio", default="(ed.)")), } rezensent = getFormatter(u', ') if self.title[-1] in '!?:;.,': title_subtitle = getFormatter(u' ') else: title_subtitle = getFormatter(u'. ') item = getFormatter(u', ') hrsg_person = getFormatter(', ') hrsg_company_year = getFormatter(', ') hrsg_book = getFormatter(', ', ', ', '%(:)s ' % args) hrsg = getFormatter(' %(ed)s, ' % args) rezensent_string = rezensent(self.reviewAuthors[0]["lastname"], self.reviewAuthors[0]["firstname"]) authors_string = u' / '.join([getFormatter(', ')\ (x['lastname'], x['firstname']) for x in self.authors]) title_subtitle_string = title_subtitle(self.title, self.subtitle) item_string = item(authors_string, title_subtitle_string) hrsg_person_string = u' / '.join([getFormatter(', ')\ (x['lastname'], x['firstname']) for x in self.editorsCollectedEdition]) hrsg_company_year_string = hrsg_company_year(self.publisher, \ self.yearOfPublication) hrsg_book_string = hrsg_book(self.titleCollectedEdition, \ self.placeOfPublication, \ hrsg_company_year_string) hrsg_string = hrsg(hrsg_person_string, hrsg_book_string) full_citation = getFormatter( u'%(:)s %(presentation_of)s ' % args, u', %(in)s ' % args, u', %(page)s ' % args, ' ') return full_citation(escape(rezensent_string), escape(item_string), escape(hrsg_string), self.page_start_end_in_print, real_self.getUUIDUrl())
def get_citation_string(real_self): """ Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.get = lambda x: None >>> at_mock.customCitation = '' >>> at_mock.authors = [{'firstname': x[0], 'lastname' : x[1]} for x in (('Patrick♥', 'Gerken♥'), ('Alexander', 'Pilz'))] >>> at_mock.title = "Das neue Plone 4.0♥?" >>> at_mock.subtitle = "Alles neu in 2010♥" >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian♥', 'lastname' : 'de Roiste♥'}] >>> at_mock.yearOfPublication = '2009♥' >>> at_mock.publisher = 'SYSLAB.COM GmbH♥' >>> at_mock.placeOfPublication = u'München' >>> at_mock.issueNumber = '3♥' >>> at_mock.volumeNumber = '1♥' >>> at_mock.titleJournal = 'Open Source Mag♥' >>> at_mock.portal_url = lambda :'http://www.syslab.com' >>> at_mock.UID = lambda :'12345' >>> at_mock.page_start_end_in_print = '11-21' >>> presentation = PresentationArticleReviewNoMagic(at_mock) >>> presentation.directTranslate = lambda m: m.default >>> presentation.get_citation_string() u'de Roiste\u2665, Cillian\u2665: presentation of: Gerken\u2665, Patrick\u2665 / Pilz, Alexander, Das neue Plone 4.0\u2665? Alles neu in 2010\u2665, in: Open Source Mag\u2665, 1\u2665, 3\u2665, p. 11-21 <a href="http://syslab.com/r/12345">http://syslab.com/r/12345</a>' Original Specification [Präsentator Nachname], [Präsentator Vorname]: presentation of: [Werkautor Nachname], [Werkautor Vorname], [Werktitel]. [Werk-Untertitel], in: [Zs-Titel], [Nummer], [Heftnummer (Erscheinungsjahr)], URL recensio. Werkautoren kann es mehrere geben, die werden dann durch ' / ' getrennt alle aufgelistet. Note: gezähltes Jahr entfernt. Meier, Hans: presentation of: Meier, Hans, Geschichte des Abendlandes. Ein Abriss, in: Zeitschrift für Geschichte, 39, 3 (2008/2009), www.recensio.net/## """ self = real_self.magic rezensent = getFormatter(u", ") if self.title[-1] in "!?:;.,": title_subtitle = getFormatter(u" ") else: title_subtitle = getFormatter(u". ") item = getFormatter(u", ") mag_number = getFormatter(u", ", u", ") rezensent_string = rezensent(self.reviewAuthors[0]["lastname"], self.reviewAuthors[0]["firstname"]) authors_string = u" / ".join([getFormatter(", ")(x["lastname"], x["firstname"]) for x in self.authors]) title_subtitle_string = title_subtitle(self.title, self.subtitle) item_string = item(authors_string, title_subtitle_string) mag_year_string = self.yearOfPublication.decode("utf-8") mag_year_string = mag_year_string and u"(" + mag_year_string + u")" or None mag_number = mag_number(self.titleJournal, self.volumeNumber, self.issueNumber) args = { "presentation_of": real_self.directTranslate( Message(u"text_presentation_of", "recensio", default="presentation of:") ), "in": real_self.directTranslate(Message(u"text_in", "recensio", default="in:")), "page": real_self.directTranslate(Message(u"text_pages", "recensio", default="p.")), ":": real_self.directTranslate(Message(u"text_colon", "recensio", default=":")), } full_citation_inner = getFormatter( u"%(:)s %(presentation_of)s " % args, u", %(in)s " % args, ", %(page)s " % args, u" " ) return full_citation_inner( escape(rezensent_string), escape(item_string), escape(mag_number), self.page_start_end_in_print, real_self.getUUIDUrl(), )
def punctuated_authors(real_self): self = real_self.magic return u' / '.join( [getFormatter(' ')(x['firstname'], x['lastname']) for x in self.authors])
def get_citation_string(self, obj): """ Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.customCitation = '' >>> at_mock.get = lambda x: None >>> at_mock.formatted_authors_editorial = lambda: u"Gerken\u2665, Patrick\u2665 / Pilz, Alexander" >>> at_mock.title = "Plone 4.0♥?" >>> at_mock.subtitle = "Das Benutzerhandbuch♥" >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian♥', 'lastname' : 'de Roiste♥'}] >>> at_mock.yearOfPublication = '2009♥' >>> at_mock.publisher = 'SYSLAB.COM GmbH♥' >>> at_mock.placeOfPublication = 'München♥' >>> at_mock.get_issue_title = lambda :'Open Source Mag 1♥' >>> at_mock.get_volume_title = lambda :'Open Source Mag Vol 1♥' >>> at_mock.get_publication_title = lambda :'Open Source♥' >>> at_mock.portal_url = lambda :'http://www.syslab.com' >>> at_mock.UID = lambda :'12345' >>> at_mock.canonical_uri = '' >>> at_mock.page_start_end_in_print = '11-21' >>> review = ReviewMonographNoMagic(at_mock) >>> review.directTranslate = lambda m: m.default >>> review.get_citation_string() u'de Roiste\u2665, Cillian\u2665: review of: Gerken\u2665, Patrick\u2665 / Pilz, Alexander, Plone 4.0\u2665? Das Benutzerhandbuch\u2665, M\\xfcnchen\u2665: SYSLAB.COM GmbH\u2665, 2009\u2665, in: Open Source\u2665, Open Source Mag Vol 1\u2665, Open Source Mag 1\u2665, p. 11-21, <a href="http://syslab.com/r/12345">http://syslab.com/r/12345</a>' Original Spec: [Rezensent Nachname], [Rezensent Vorname]: review of: [Werkautor Nachname], [Werkautor Vorname], [Werktitel]. [Werk-Untertitel], [Erscheinungsort]: [Verlag], [Jahr], in: [Zs-Titel], [Nummer], [Heftnummer (Erscheinungsjahr)], p.[pageStart]-[pageEnd] URL recensio. Werkautoren kann es mehrere geben, die werden dann durch ' / ' getrennt alle aufgelistet. Note: gezähltes Jahr entfernt. Da es die Felder Zs-Titel, Nummer und Heftnummer werden die Titel der Objekte magazine, volume, issue genommen, in dem der Review liegt Müller, Klaus: review of: Meier, Hans, Geschichte des Abendlandes. Ein Abriss, München: Oldenbourg, 2010, in: Zeitschrift für Geschichte, 39, 3 (2008/2009), www.recensio.net/## """ if obj.customCitation: return scrubHTML(obj.customCitation).decode('utf8') args = { 'review_of' : translate_message(Message( u"text_review_of", "recensio", default="review of:")), 'in' : translate_message(Message( u"text_in", "recensio", default="in:")), 'page' : translate_message(Message( u"text_pages", "recensio", default="p.")), ':' : ",", #translate_message(Message(u"text_colon", "recensio", default=":")), } if obj.title[-1] in '!?:;.,': title_subtitle = getFormatter(u' ') else: title_subtitle = getFormatter(u'. ') rev_details_formatter = getFormatter( u', ', u', ', u'%(:)s ' % args, u', ') rezensent_string = get_formatted_names( u' / ', ', ', obj.reviewAuthors, lastname_first = True) authors_string = obj.formatted_authors_editorial() title_subtitle_string = '<span class="title">%s</span>' % ( title_subtitle(obj.title, obj.subtitle)) item_string = rev_details_formatter( authors_string, title_subtitle_string, obj.placeOfPublication, obj.publisher, obj.yearOfPublication) mag_year_string = obj.yearOfPublication.decode('utf-8') mag_year_string = mag_year_string and u'(' + mag_year_string + u')' \ or None mag_number_formatter = getFormatter(u', ', u', ') mag_number_string = mag_number_formatter( obj.get_publication_title(), obj.get_volume_title(), obj.get_issue_title()) location = obj.getUUIDUrl() if getattr(obj, "canonical_uri", False): #3102 location = translate_message( Message(u"label_downloaded_via_recensio","recensio")) citation_formatter = getFormatter( u'%(:)s %(review_of)s ' % args, ', %(in)s ' % args, ', %(page)s ' % args, u', ') citation_string = citation_formatter( escape(rezensent_string), item_string, escape(mag_number_string), obj.page_start_end_in_print, location) return citation_string
def get_citation_string(real_self): """ >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.get = lambda x: None >>> at_mock.customCitation = '' >>> at_mock.title = "Plone Mag♥" >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian♥', 'lastname' : 'de Roiste♥'}] >>> at_mock.yearOfPublication = '2009♥' >>> at_mock.officialYearOfPublication = '2010♥' >>> at_mock.publisher = 'SYSLAB.COM GmbH♥' >>> at_mock.placeOfPublication = 'München♥' >>> at_mock.volumeNumber = '1♥' >>> at_mock.issueNumber = '3♥' >>> at_mock.get_issue_title = lambda :'Open Source Mag 1♥' >>> at_mock.get_volume_title = lambda :'Open Source Mag Vol 1♥' >>> at_mock.get_publication_title = lambda :'Open Source♥' >>> at_mock.portal_url = lambda :'http://www.syslab.com' >>> at_mock.UID = lambda :'12345' >>> at_mock.canonical_uri = '' >>> at_mock.page_start_end_in_print = '11-21' >>> review = ReviewJournalNoMagic(at_mock) >>> review.directTranslate = lambda m: m.default >>> review.get_citation_string() u'de Roiste\u2665, Cillian\u2665: review of: Plone Mag\u2665, 1\u2665, 3\u2665 (2010\u2665/2009\u2665), in: Open Source\u2665, Open Source Mag Vol 1\u2665, Open Source Mag 1\u2665, p. 11-21, <a href="http://syslab.com/r/12345">http://syslab.com/r/12345</a>' Return the citation according to this schema: [Rezensent Nachname], [Rezensent Vorname]: review of: [Zs-Titel der rez. Zs.], [Nummer], [Heftnummer (gezähltes Jahr/Erscheinungsjahr)], in: [Zs-Titel], [Nummer], [Heftnummer (gezähltes Jahr/Erscheinungsjahr)], p.[pageStart]-[pageEnd] URL recensio. The years of the magazine article reviewing the other magazine does not exist. """ self = real_self.magic if self.customCitation: return scrubHTML(self.customCitation).decode('utf8') rev_details_formatter = getFormatter(u', ', u', ', u' ') mag_year = getFormatter('/')(self.officialYearOfPublication, self.yearOfPublication) mag_year = mag_year and '(' + mag_year + ')' or None item_string = rev_details_formatter(self.title, self.volumeNumber, self.issueNumber, mag_year) reference_mag = getFormatter(', ', ', ') reference_mag_string = reference_mag(self.get_publication_title(), self.get_volume_title(), self.get_issue_title()) location = real_self.getUUIDUrl() if getattr(self, "canonical_uri", False): #3102 location = real_self.directTranslate( Message(u"label_downloaded_via_recensio", "recensio")) rezensent_string = get_formatted_names( u' / ', ', ', self.reviewAuthors, lastname_first = True) args = { 'review_of' : real_self.directTranslate(Message( u"text_review_of", "recensio", default="review of:")), 'in' : real_self.directTranslate(Message( u"text_in", "recensio", default="in:")), 'page' : real_self.directTranslate(Message( u"text_pages", "recensio", default="p.")), ':' : real_self.directTranslate(Message( u"text_colon", "recensio", default=":")), } citation_formatter = getFormatter( u'%(:)s %(review_of)s ' % args, ', %(in)s ' % args, ', %(page)s ' % args, u', ') citation_string = citation_formatter( escape(rezensent_string), escape(item_string), escape(reference_mag_string), self.page_start_end_in_print, location) return citation_string
def get_citation_string(self, obj): """ I think the in... part does not make sense for this content type Either return the custom citation or the generated one >>> from mock import Mock >>> at_mock = Mock() >>> at_mock.get = lambda x: None >>> at_mock.formatted_authors_editorial = lambda: u"Gerken\u2665, Patrick\u2665 / Pilz, Alexander" >>> at_mock.title = "Plone 4.0♥?" >>> at_mock.subtitle = "Das Benutzerhandbuch♥" >>> at_mock.reviewAuthors = [{'firstname' : 'Cillian♥', 'lastname' : 'de Roiste♥'}] >>> at_mock.yearOfPublication = '2009♥' >>> at_mock.publisher = 'SYSLAB.COM GmbH♥' >>> at_mock.placeOfPublication = 'München♥' >>> at_mock.portal_url = lambda :'http://www.syslab.com' >>> at_mock.UID = lambda :'12345' >>> presentation = PresentationMonographNoMagic(at_mock) >>> presentation.directTranslate = lambda m: m.default >>> presentation.get_citation_string() u'de Roiste\u2665, Cillian\u2665: presentation of: Gerken\u2665, Patrick\u2665 / Pilz, Alexander, Plone 4.0\u2665? Das Benutzerhandbuch\u2665, M\\xfcnchen\u2665: SYSLAB.COM GmbH\u2665, 2009\u2665, <a href="http://syslab.com/r/12345">http://syslab.com/r/12345</a>' [Präsentator Nachname], [Präsentator Vorname]: presentation of: [Werkautor Nachname], [Werkautor Vorname], [Werktitel]. [Werk-Untertitel], [Erscheinungsort]: [Verlag], [Jahr], URL recensio. Big chunk removed, since it is not a review from a mag in: [Zs-Titel], [Nummer], [Heftnummer (gezähltes Jahr/Erscheinungsjahr)], Meier, Hans: presentation of: Meier, Hans, Geschichte des Abendlandes. Ein Abriss, München: Oldenbourg, 2010, in: Zeitschrift für Geschichte, 39, 3 (2008/2009), www.recensio.net/## """ args = { 'presentation_of' : translate_message(Message( u"text_presentation_of", "recensio", default="presentation of:")), 'in' : translate_message(Message( u"text_in", "recensio", default="in:")), 'page' : translate_message(Message( u"text_pages", "recensio", default="p.")), ':' : ",", #translate_message(Message(u"text_colon", "recensio", default=":")), } rezensent = getFormatter(u', ') if obj.title[-1] in '!?:;.,': title_subtitle = getFormatter(u' ') else: title_subtitle = getFormatter(u'. ') item = getFormatter(u', ', u', ', u'%(:)s ' % args, u', ') mag_number_and_year = getFormatter(u', ', u', ', u' ') if False: _("presentation of") full_citation_inner = getFormatter( u'%(:)s %(presentation_of)s ' % args, u', ') rezensent_string = rezensent( obj.reviewAuthors[0]["lastname"], obj.reviewAuthors[0]["firstname"]) authors_string = obj.formatted_authors_editorial() title_subtitle_string = '<span class="title">%s</span>' % escape( title_subtitle(obj.title, obj.subtitle)) item_string = item( escape(authors_string), title_subtitle_string, escape(obj.placeOfPublication), escape(obj.publisher), escape(obj.yearOfPublication), ) return full_citation_inner(escape(rezensent_string), item_string, obj.getUUIDUrl())