How to use the refextract.references.regexs.re_hdl.finditer function in refextract

To help you get started, we’ve selected a few refextract examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inspirehep / refextract / refextract / references / engine.py View on Github external
def look_for_hdl(citation_elements):
    """Looks for handle identifiers in the misc txt of the citation elements

       When finding an hdl, creates a new HDL element.
       @param citation_elements: (list) elements to process
    """
    for el in list(citation_elements):
        matched_hdl = re_hdl.finditer(el['misc_txt'])
        for match in reversed(list(matched_hdl)):
            hdl_el = {'type': 'HDL',
                      'hdl_id': match.group('hdl_id'),
                      'misc_txt': el['misc_txt'][match.end():]}
            el['misc_txt'] = el['misc_txt'][0:match.start()]
            citation_elements.insert(citation_elements.index(el) + 1, hdl_el)