예제 #1
0
 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}
예제 #2
0
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
예제 #3
0
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)
예제 #4
0
 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}
예제 #5
0
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)
예제 #6
0
파일: aym.py 프로젝트: Psycojoker/hyde
    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 ""
예제 #7
0
    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 ""
예제 #8
0
파일: helpers.py 프로젝트: zerok/zs.bibtex
def parse_entry(string):
    """
    Small helper function for parsing a single entry.
    """
    for value in parser.parse_string(string).values():
        return value
예제 #9
0
파일: helpers.py 프로젝트: zerok/zs.bibtex
def parse_bibliography(string):
    """
    Helper function for parsing a bibliography.
    """
    return parser.parse_string(string)