示例#1
0
 def get_parser(self):
     if self.context.mode == "bibtex":
         from citation_vim.bibtex.parser import bibtexParser
         parser = bibtexParser(self.context)
     elif self.context.mode == "zotero":
         from citation_vim.zotero.parser import zoteroParser
         parser = zoteroParser(self.context)
     else:
         raiseError(u"Citation.vim Error: g:citation_vim_mode must be either 'zotero' or 'bibtex'")
     return parser
示例#2
0
 def get_entries(source_field, file_path, file_format, desc_fields, desc_format):
     if file_format == "bibtex":
         from citation_vim.bibtex.parser import bibtexParser
         parser = bibtexParser()
     elif file_format == "zotero":
         from citation_vim.zotero.parser import zoteroParser
         parser = zoteroParser()
     else:
         print("g:citation_vim_file_format variable must be either 'zotero' or 'bibtex'")
         return []
     entries = parser.load(source_field, file_path)
     output = []
     for entry in entries:
         desc = entry.describe(source_field, desc_fields, desc_format)
         output.append([getattr(entry, source_field), desc])
     return output
示例#3
0
 def get_entries(source_field, file_path, file_format, desc_fields,
                 desc_format):
     if file_format == "bibtex":
         from citation_vim.bibtex.parser import bibtexParser
         parser = bibtexParser()
     elif file_format == "zotero":
         from citation_vim.zotero.parser import zoteroParser
         parser = zoteroParser()
     else:
         print(
             "g:citation_vim_file_format variable must be either 'zotero' or 'bibtex'"
         )
         return []
     entries = parser.load(source_field, file_path)
     output = []
     for entry in entries:
         desc = entry.describe(source_field, desc_fields, desc_format)
         output.append([getattr(entry, source_field), desc])
     return output