Esempio n. 1
0
 def export_html(self, filename):
     Utils.set_to_print_web()
     s = ''
     for k in self._keys:
         d = self._data[k]
         s += d.get_name_google_markdown()
         if d.get_original_name():
             s += ' (%s)' % d.get_original_name()
         s += ': '
         s += Utils.get_line_break()
         s += d.get_best_face_markdown()
         s += Utils.get_line_break()
         s += ' '.join([
             d.get_website_markdown(),
             d.get_facebook_markdown(),
             d.get_twitter_markdown(),
             d.get_vimeo_markdown(),
             d.get_linkedin_markdown(),
             d.get_instagram_markdown(),
             d.get_youtube_markdown(),
             d.get_github_markdown(),
             d.get_researchgate_markdown(),
             d.get_scholar_markdown()
         ])
         s += Utils.get_separator()
     s += DEBUG_HTML_SCRIPT
     s = htmlmin.minify(markdown(s))
     Utils.write_file(filename, s)
Esempio n. 2
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. 3
0
 def export_file_names(self, filename):
     s = ''
     for k in self._keys:
         s += self._data[k].get_filename()
         s += Utils.get_line_break()
     with open(filename, 'w', encoding='utf8') as f:
         f.write(s)
Esempio n. 4
0
 def _export_people_names(self, filename):
     Utils.set_to_print_file()
     s = ''
     for k in self._keys:
         s += self._data[k].get_name()
         s += Utils.get_line_break()
     Utils.write_file(filename, s)
Esempio n. 5
0
 def export_bib_ids(self, filename):
     Utils.set_to_print_file()
     s = ''
     for k in self._keys:
         s += self._data[k].get_bib_id()
         s += Utils.get_line_break()
     with open(filename, 'w', encoding='utf8') as f:
         f.write(s)
Esempio n. 6
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. 7
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