Exemple #1
0
def run_test3():
    '''
    Test #3 tests that the "authorextract" method functions correctly.
    '''

    auxfile = './test/test2.aux'        ## re-use the huge database
    authorstr = 'John W. Tukey'
    outputfile = './test/test3_authorextract.bib'
    targetfile = './test/test3_authorextract_target.bib'

    print('\n' + '='*75)
    print('Running Bibulous Test #3 for author "' + authorstr + '"')

    bibobj = Bibdata(auxfile, disable=[4,9,21,32,33])
    #bibobj.debug = True
    bibobj.write_authorextract(authorstr, outputfile)

    return(outputfile, targetfile)
Exemple #2
0
def run_test3():
    '''
    Test #3 tests that the "authorextract" method functions correctly.
    '''

    auxfile = './test/test2.aux'        ## re-use the huge database
    authorstr = 'John W. Tukey'
    outputfile = './test/test3_authorextract.bib'
    targetfile = './test/test3_authorextract_target.bib'

    print('\n' + '='*75)
    print('Running Bibulous Test #3 for author "' + authorstr + '"')

    bibobj = Bibdata(auxfile, disable=[4,9,21,32,33])
    #bibobj.debug = True
    bibobj.write_authorextract(authorstr, outputfile)

    return(outputfile, targetfile)
import getopt
import pdb          ## put "pdb.set_trace()" at any place you want to interact with pdb
from bibulous import Bibdata


## ==================================================================================================

if (__name__ == '__main__'):
    print(list(sys.argv))

    try:
        auxfile = sys.argv[1]
        authorstr = sys.argv[2]
        if (len(sys.argv) > 2):
            outputfile = sys.argv[3]
        else:
            outputfile = auxfile[:-4] + '_authorextract.bib'
    except getopt.GetoptError as err:
        print(str(err)) ## will print something like "option -a not recognized"
        print('usage:')
        print('>>> python bibulous-authorextract.py auxfile "author name in quotes" outfile ...')
        print('if "file1" has a ".aux" extension, then it is assumed that the file contains the '
              'locations of the ".bib" files.')
        print('if "file1" has a ".bib" extension, then it is assumed to be a ".bib" database '
              'filename (as are all subsequent files).')
        sys.exit(2)

    bibdata = Bibdata(auxfile, culldata=False)
    print('Writing BIB author extract file = ' + outputfile)
    bibdata.write_authorextract(authorstr, outputfile, debug=False)
Exemple #4
0
## ==================================================================================================

if (__name__ == '__main__'):
    print(list(sys.argv))

    try:
        auxfile = sys.argv[1]
        authorstr = sys.argv[2]
        if (len(sys.argv) > 2):
            outputfile = sys.argv[3]
        else:
            outputfile = auxfile[:-4] + '_authorextract.bib'
    except getopt.GetoptError as err:
        print(
            str(err))  ## will print something like "option -a not recognized"
        print('usage:')
        print(
            '>>> python bibulous-authorextract.py auxfile "author name in quotes" outfile ...'
        )
        print(
            'if "file1" has a ".aux" extension, then it is assumed that the file contains the '
            'locations of the ".bib" files.')
        print(
            'if "file1" has a ".bib" extension, then it is assumed to be a ".bib" database '
            'filename (as are all subsequent files).')
        sys.exit(2)

    bibdata = Bibdata(auxfile, culldata=False)
    print('Writing BIB author extract file = ' + outputfile)
    bibdata.write_authorextract(authorstr, outputfile, debug=False)