示例#1
0
void
bibtexin_convertf( fields *bibin, fields *info, int reftype, param *p,
		variants *all, int nall )
{
	newstr *t, *d;
	int process, level, i, n;
	char *newtag;
	for ( i=0; i<bibin->nfields; ++i ) {
		d = &( bibin->data[i] );
		if ( d->len == 0 ) continue; /* skip ones with no data */
		/* skip ones already "used" such as successful crossref */
		if ( bibin->used[i] ) continue;
		t = &( bibin->tag[i] );
		n = process_findoldtag( t->data, reftype, all, nall );
		if ( n==-1 ) {
			bibtexin_notag( p, t->data );
			continue;
		}
		process = ((all[reftype]).tags[n]).processingtype;
		if ( process == ALWAYS ) continue; /* add these later */
		level   = ((all[reftype]).tags[n]).level;
		newtag  = ((all[reftype]).tags[n]).newstr;
		if ( process==SIMPLE )
			fields_add( info, newtag, d->data, level );
		else if ( process==TITLE )
			title_process( info, "TITLE", d->data, level);
		else if ( process==PERSON )
			process_names( info, newtag, d, level, &(p->asis), 
					&(p->corps) );
		else if ( process==PAGES )
			process_pages( info, d, level);
		else if ( process==BIBTEX_URL )
			process_url( info, d->data, level );
	}
	if ( p->verbose ) report( info );
}
示例#2
0
int
bibtexin_convertf( fields *bibin, fields *info, int reftype, param *p,
		variants *all, int nall )
{
	int process, level, i, n, nfields, status;
	newstr *t, *d;
	char *outtag;

	nfields = fields_num( bibin );
	for ( i=0; i<nfields; ++i ) {

		if ( fields_used( bibin, i ) ) continue; /* e.g. successful crossref */
		if ( fields_nodata( bibin, i ) ) continue;

		t = fields_tag( bibin, i, FIELDS_STRP );
		if ( t->len == 0 ) continue; /* Don't consider with null tags */
		n = process_findoldtag( t->data, reftype, all, nall );
		if ( n==-1 ) {
			bibtexin_notag( p, t->data );
			continue;
		}

		d = fields_value( bibin, i, FIELDS_STRP );

		process = ((all[reftype]).tags[n]).processingtype;
		level   = ((all[reftype]).tags[n]).level;
		outtag  = ((all[reftype]).tags[n]).newstr;

		switch( process ) {

		case SIMPLE:
			status = bibtex_simple( info, outtag, d, level );
			break;

		case TITLE:
			status = bibtexin_title_process( info, "TITLE", bibin, t, d, level, p->nosplittitle );
			break;

		case PERSON:
			status = bibtex_names( info, outtag, d, level, &(p->asis), &(p->corps) );
			break;

		case PAGES:
			status = process_pages( info, d, level );
			break;

		case KEYWORD:
			status = process_keywords( info, d, level );
			break;

		case HOWPUBLISHED:
			status = process_howpublished( info, d, level );
			break;

		case LINKEDFILE:
			status = process_file( info, d, level );
			break;

		case BT_NOTE:
			status = process_note( info, d, level );
			break;

		case BT_SENTE:
			status = process_sente( info, d, level );
			break;

		case BT_URL:
			status = process_url( info, d, level );
			break;

		case BT_ORG:
			status = process_organization( bibin, info, d, level );
			break;

		default:
			status = BIBL_OK;
			break;
		}

		if ( status!=BIBL_OK ) return status;
	}
	return status;
}