splat/citations.py
def processBiblibrary(biblibrary,verbose=False):
    '''
    Purpose
        Processes a bibtex .bib library (multiple bibtex entries) into a dictionary whose keys
        are the bibcode


    :Required parameters:
        :param biblibrary: .bib file containing the bibtex entries

    :Optional parameters:
        :param: verbose = False: Set to True to provide extensive feedback

    :Output:
        A dictionary containing the bibtex information, organized by bibcode key

    '''    
    if not os.path.exists(os.path.normpath(biblibrary)):
        raise ValueError('Could not find bibtex library file {}'.format(biblibrary))

    with open(os.path.normpath(biblibrary), 'r') as bib_file:
        text = bib_file.read()

# find all of the bibtex codes
    output = {}
    flg = 'upper'
    in_lib = re.search('@[A-Z]+{', text)
    if in_lib==None:
        flg = 'lower'
        in_lib = re.search('@[a-z]+{', text)
        if in_lib==None:
            raise ValueError('Cannot find any bib entries in text {}'.format(text[:1000]))
    while in_lib != None:
        if flg=='upper': in_lib = re.search('@[A-Z]+{', text)
        else: in_lib = re.search('@[a-z]+{', text)
        asc = text[in_lib.start():]
        in_lib = re.search('\n@', asc)
        if in_lib != None:
            text = asc[(in_lib.start()-2):]
            asc = asc[:in_lib.end()]
        p = bibTexParser(asc)
        output[p['bibcode']] = p
    return output

    Purpose
        Processes a bibtex .bib library (multiple bibtex entries) into a dictionary whose keys
        are the bibcode


    :Required parameters:
        :param biblibrary: .bib file containing the bibtex entries

    :Optional parameters:
        :param: verbose = False: Set to True to provide extensive feedback

    :Output:
        A dictionary containing the bibtex information, organized by bibcode key

    
Purpose
Processes a bibtex .bib library (multiple bibtex entries) into a dictionary whose keys
are the bibcode
Purpose Processes a bibtex . bib library ( multiple bibtex entries ) into a dictionary whose keys are the bibcode
def processBiblibrary(biblibrary,verbose=False):
    if not os.path.exists(os.path.normpath(biblibrary)):
        raise ValueError('Could not find bibtex library file {}'.format(biblibrary))
    with open(os.path.normpath(biblibrary), 'r') as bib_file:
        text = bib_file.read()
    output = {}
    flg = 'upper'
    in_lib = re.search('@[A-Z]+{', text)
    if in_lib==None:
        flg = 'lower'
        in_lib = re.search('@[a-z]+{', text)
        if in_lib==None:
            raise ValueError('Cannot find any bib entries in text {}'.format(text[:1000]))
    while in_lib != None:
        if flg=='upper': in_lib = re.search('@[A-Z]+{', text)
        else: in_lib = re.search('@[a-z]+{', text)
        asc = text[in_lib.start():]
        in_lib = re.search('\n@', asc)
        if in_lib != None:
            text = asc[(in_lib.start()-2):]
            asc = asc[:in_lib.end()]
        p = bibTexParser(asc)
        output[p['bibcode']] = p
    return output
def processBiblibrary ( biblibrary , verbose = False ) : if not os . path . exists ( os . path . normpath ( biblibrary ) ) : raise ValueError ( 'Could not find bibtex library file {}' . format ( biblibrary ) ) with open ( os . path . normpath ( biblibrary ) , 'r' ) as bib_file : text = bib_file . read ( ) output = { } flg = 'upper' in_lib = re . search ( '@[A-Z]+{' , text ) if in_lib == None : flg = 'lower' in_lib = re . search ( '@[a-z]+{' , text ) if in_lib == None : raise ValueError ( 'Cannot find any bib entries in text {}' . format ( text [ : 1000 ] ) ) while in_lib != None : if flg == 'upper' : in_lib = re . search ( '@[A-Z]+{' , text ) else : in_lib = re . search ( '@[a-z]+{' , text ) asc = text [ in_lib . start ( ) : ] in_lib = re . search ( '\n@' , asc ) if in_lib != None : text = asc [ ( in_lib . start ( ) - 2 ) : ] asc = asc [ : in_lib . end ( ) ] p = bibTexParser ( asc ) output [ p [ 'bibcode' ] ] = p return output
Purpose
Processes a bibtex .bib library (multiple bibtex entries) into a dictionary whose keys
are the bibcode
Purpose Processes a bibtex . bib library ( multiple bibtex entries ) into a dictionary whose keys are the bibcode
'''
    Purpose
        Processes a bibtex .bib library (multiple bibtex entries) into a dictionary whose keys
        are the bibcode


    :Required parameters:
        :param biblibrary: .bib file containing the bibtex entries

    :Optional parameters:
        :param: verbose = False: Set to True to provide extensive feedback

    :Output:
        A dictionary containing the bibtex information, organized by bibcode key

    ''' # find all of the bibtex codes
biblibrary
verbose
Required
:param biblibrary: .bib file containing the bibtex entries
: param biblibrary : . bib file containing the bibtex entries
Optional
:param: verbose = False: Set to True to provide extensive feedback
: param : verbose = False : Set to True to provide extensive feedback
Output
A dictionary containing the bibtex information, organized by bibcode key
A dictionary containing the bibtex information organized by bibcode key