# Path: bibstuff/bibadd.py
# def make_entry(choosetype='', options=False, extras=False):
# def make_entry_citekey(entry, used_citekeys,style=label_style1):
# def is_macro(s):
# def text_format(entry):
# def get_journal(entry, jrnl_lst=None): #TODO: extract fr journal list
# def get_volnum(entry):
# def get_pages(entry,dash='--',pagespref=('p. ','pp. ')):
# def html_format(entry):


import os
import sys
import shutil
import logging
from bibstuff.bibadd import (bibadd_logger, make_entry, html_format, text_format)
	from optparse import OptionParser
			sys.exit(1)

	# create object to store parsed .bib file
	bibfile_processor = bibfile.BibFile()
	#store parsed .bib file in the bibfile_processor
	#  TODO: allow multiple .bib files
	bibgrammar.Parse(bibfile_as_string, bibfile_processor)

	bfile = bibfile.BibFile()
	bibgrammar.Parse(src, bfile)
	used_citekeys = [] # stores created keys
	'''

	entry = make_entry(options.entry_type, options.more_fields, options.MORE_FIELDS)

	# open output file for writing (default: stdout)
	if options.outfile:
		if options.backup and os.path.exists(options.outfile):
			shutil.copyfile(options.outfile, options.outfile+".bak")
		if options.overwrite or not os.path.exists(options.outfile):
			output = open(options.outfile,'w')
		else:
			bibadd_logger.info("Appending to %s.\n(Use -n option to nuke (overwrite) the old output file.)"
			                     %options.outfile)
			output = open(options.outfile,'a')
	output.write(str(entry))
	#print entry
	if 'h' in options.format:
		output.write( html_format(entry) )
	if 't' in options.format:

# Path: bibstuff/bibadd.py
# def make_entry(choosetype='', options=False, extras=False):
# def make_entry_citekey(entry, used_citekeys,style=label_style1):
# def is_macro(s):
# def text_format(entry):
# def get_journal(entry, jrnl_lst=None): #TODO: extract fr journal list
# def get_volnum(entry):
# def get_pages(entry,dash='--',pagespref=('p. ','pp. ')):
# def html_format(entry):


# Path: scripts/add2bib.py
import os
import sys
import shutil
import logging
from bibstuff.bibadd import (bibadd_logger, make_entry, html_format, text_format)
	from optparse import OptionParser

			sys.exit(1)

	# create object to store parsed .bib file
	bibfile_processor = bibfile.BibFile()
	#store parsed .bib file in the bibfile_processor
	#  TODO: allow multiple .bib files
	bibgrammar.Parse(bibfile_as_string, bibfile_processor)

	bfile = bibfile.BibFile()
	bibgrammar.Parse(src, bfile)
	used_citekeys = [] # stores created keys
	'''

	entry = make_entry(options.entry_type, options.more_fields, options.MORE_FIELDS)

	# open output file for writing (default: stdout)
	if options.outfile:
		if options.backup and os.path.exists(options.outfile):
			shutil.copyfile(options.outfile, options.outfile+".bak")
		if options.overwrite or not os.path.exists(options.outfile):
			output = open(options.outfile,'w')
		else:
			bibadd_logger.info("Appending to %s.\n(Use -n option to nuke (overwrite) the old output file.)"
			                     %options.outfile)
			output = open(options.outfile,'a')
	output.write(str(entry))
	#print entry
	if 'h' in options.format:
		output.write( html_format(entry) )
	if 't' in options.format:

		output.write( text_format(entry) )