def add_by_bibtex(self, req, resp): # assert(self.check_has_only_one_item(req,resp)) paper_dict = req.dict['input']['papers'][0] # assume one bibtex bibtex = paper_dict['bibtex'] bibtex_dict = parse_string(bibtex) print '(I) paperapp, add_by_bibtex\n', bibtex_dict paper_list = self.dbo.addPapersByBibtex(bibtex_dict) resp.dict['output'] = {'papers': paper_list}
def parsing_csv(data): temp = str(data)[2:].split('@') temp = [ '@' + i.replace('\\n', '').replace("'", "").replace('"', '') for i in temp ] temp = [parse_string(i) for i in temp[1:]] return temp
def test_with_validation(): inp = '''% some comment @article { name, author = {Max Mustermann}, title = {la%la} } ''' with pytest.raises(exceptions.InvalidStructure): parser.parse_string(inp, validate=True) inp = '''% some comment @article { name, author = {Max Mustermann}, year = {2009}, journal = {Life Journale}, title = {la%la} } ''' parser.parse_string(inp, validate=True)
def add_by_bibtex(self,req,resp): # assert(self.check_has_only_one_item(req,resp)) paper_dict = req.dict['input']['papers'][0] # assume one bibtex bibtex = paper_dict['bibtex'] bibtex_dict = parse_string(bibtex) print '(I) paperapp, add_by_bibtex\n', bibtex_dict paper_list = self.dbo.addPapersByBibtex(bibtex_dict) resp.dict['output'] = {'papers':paper_list}
def test_regression_article_with_volume(): """ Articles should support the volume attribute """ entry = parser.parse_string('''@article{mm09, author = {Max Mustermann}, title = {The story of my life}, year = {2009}, journal = {Life Journale}, volume = {1} }''') entry.validate(raise_unsupported=True)
def render(self, context): output = self.nodelist.render(context) try: from zs.bibtex.parser import parse_string from StringIO import StringIO except ImportError: print u"Requires zs.bibtex library to use bibtex tag." raise biblio = parse_string(output) context["page"].bibliography = biblio context["page"].bibitex = output return ""
def parse_entry(string): """ Small helper function for parsing a single entry. """ for value in parser.parse_string(string).values(): return value
def parse_bibliography(string): """ Helper function for parsing a bibliography. """ return parser.parse_string(string)