def format_title(self, e, which_field, as_sentence=True): from pybtex.bibtex.utils import change_case formatted_title = field( which_field, apply_func=lambda text: change_case(text, 't')) if as_sentence: return sentence(capitalize=False) [ formatted_title ] else: return formatted_title
def format_title(self, e, which_field, as_sentence=True): from pybtex.bibtex.utils import change_case formatted_title = field(which_field, apply_func=lambda text: change_case(text, 't')) if as_sentence: return sentence(capitalize=False)[formatted_title] else: return formatted_title
def change_case(i): mode = i.pop() string = i.pop() if not mode: raise BibTeXError('empty mode string passed to change.case$') mode_letter = mode[0].lower() if not mode_letter in ('l', 'u', 't'): raise BibTeXError('incorrect change.case$ mode: %s' % mode) i.push(utils.change_case(string, mode_letter))
def change_case(i): mode = i.pop() string = i.pop() if not mode: raise BibTeXError("empty mode string passed to change.case$") mode_letter = mode[0].lower() if not mode_letter in ("l", "u", "t"): raise BibTeXError("incorrect change.case$ mode: %s" % mode) i.push(utils.change_case(string, mode_letter))