Esempio n. 1
0
  def get_apa(self):
    """Returns APA style citation.
    Reference:
      TODO: https://owl.purdue.edu/owl/research_and_citation/apa_style/apa_formatting_and_style_guide/reference_list_author_authors.html
    """
    b = self._data
    TAB, LB = Utils.get_tab(), Utils.get_line_break()
    s = self.get_authors().get_apa()
    s += ' (%s).' % b['year']
    s += LB
    s += b['title'] + '.'
    s += LB
    s += 'In %s, ' % self.get_book()
    # Appends volume and number for journal articles.
    if b['volume']:
      s += b['volume']
      if b['number']:
        s += '(%s)' % b['number']
      s += ', '

    # Appends pages.
    if 'b_pages' in b:
      s += b['b_pages'].replace('--', '-')
    elif 'b_numpages' in b:
      s += 'pp. ' + b['b_pages']
    s += '.'
    return s
Esempio n. 2
0
  def get_bibtex(self):
    """ Returns BibTeX of this paper.

    References:
      http://www.bibtex.org/Format
      https://verbosus.com/bibtex-style-examples.html
    """
    b = self._data
    TAB, LB = Utils.get_tab(), Utils.get_line_break()
    s = '@%s{%s,%s' % (b['b_type'], b['bib'], LB)

    for label in Paper.get_bib_items():
      if label in b and b[label]:
        key = label
        if label[:2] == 'b_':
          key = label[2:]
        s += '%s%s = {%s},%s' % (TAB, key, b[label], LB)

    s += '}%s' % LB
    return s
Esempio n. 3
0
  def get_vancouver(self):
    """Returns Vancouver style citation."""
    b = self._data
    TAB, LB = Utils.get_tab(), Utils.get_line_break()
    s = self.get_authors().get_mla()
    s += LB
    s += '"%s".' % b['title']
    s += LB
    s += self.get_book() + ', '
    if b['volume']:
      s += b['volume']
      if b['number']:
        s += '(%s)' % b['number']
      s += ', '

    if 'b_pages' in b:
      s += b['b_pages'].replace('--', '-')
    elif 'b_numpages' in b:
      s += 'pp. %s' % b['b_pages']
    s += '. %s.' % b['year']
    return s