示例#1
0
static void
output_pages( FILE *fp, fields *f )
{
	newstr *sn = fields_findv( f, LEVEL_ANY, FIELDS_STRP, "PAGESTART" );
	newstr *en = fields_findv( f, LEVEL_ANY, FIELDS_STRP, "PAGEEND" );
	newstr *ar = fields_findv( f, LEVEL_ANY, FIELDS_STRP, "ARTICLENUMBER" );
	if ( sn && sn->len!=0 ) fprintf( fp, "%%P %s\n", sn->data );
	else if ( ar && ar->len!=0 ) fprintf( fp, "%%P %s\n", ar->data );
	if ( en && en->len!=0 ) fprintf( fp, "%%L %s\n", en->data );
}
示例#2
0
static void
output_pages( fields *info, FILE *outptr, int level )
{
	char *sn = fields_findv( info, LEVEL_ANY, FIELDS_CHRP, "PAGES:START" );
	char *en = fields_findv( info, LEVEL_ANY, FIELDS_CHRP, "PAGES:STOP" );
	char *ar = fields_findv( info, LEVEL_ANY, FIELDS_CHRP, "ARTICLENUMBER" );
	if ( sn || en )
		output_range( outptr, "b:Pages", sn, en, level );
	else if ( ar )
		output_range( outptr, "b:Pages", ar, NULL, level );
}
示例#3
0
static void
output_pages( FILE *fp, fields *f )
{
	char *sn = fields_findv( f, LEVEL_ANY, FIELDS_CHRP, "PAGES:START" );
	char *en = fields_findv( f, LEVEL_ANY, FIELDS_CHRP, "PAGES:STOP" );
	char *ar;

	if ( sn || en ) {
		if ( sn ) fprintf( fp, "SP  - %s\n", sn );
		if ( en ) fprintf( fp, "EP  - %s\n", en );
	} else {
		ar = fields_findv( f, LEVEL_ANY, FIELDS_CHRP, "ARTICLENUMBER" );
		if ( ar ) fprintf( fp, "SP  - %s\n", ar );
	}
}
示例#4
0
static void
output_generaltitle( fields *info, FILE *outptr, char *tag, int level )
{
	char *ttl       = fields_findv( info, level, FIELDS_CHRP, "TITLE" );
	char *subttl    = fields_findv( info, level, FIELDS_CHRP, "SUBTITLE" );
	char *shrttl    = fields_findv( info, level, FIELDS_CHRP, "SHORTTITLE" );
	char *shrsubttl = fields_findv( info, level, FIELDS_CHRP, "SHORTSUBTITLE" );

	if ( ttl ) {
		output_titleinfo( ttl, subttl, outptr, tag, level );
	}
	else if ( shrttl ) {
		output_titleinfo( shrttl, shrsubttl, outptr, tag, level );
	}
}
示例#5
0
static void
output_pages( FILE *fp, fields *info )
{
	char *sn = fields_findv( info, LEVEL_ANY, FIELDS_CHRP, "PAGES:START" );
	char *en = fields_findv( info, LEVEL_ANY, FIELDS_CHRP, "PAGES:STOP" );
	char *ar;
	if ( sn || en ) {
		fprintf( fp, "%%P ");
		if ( sn ) fprintf( fp, "%s", sn );
		if ( sn && en ) fprintf( fp, "-" );
		if ( en ) fprintf( fp, "%s", en );
		fprintf( fp, "\n" );
	} else {
		ar = fields_findv( info, LEVEL_ANY, FIELDS_CHRP, "ARTICLENUMBER" );
		if ( ar ) fprintf( fp, "%%P %s\n", ar );
	}
}
示例#6
0
static void
output_titlecore( FILE *fp, fields *f, char *ristag, int level,
	char *maintag, char *subtag )
{
	newstr *mainttl = fields_findv( f, level, FIELDS_STRP, maintag );
	newstr *subttl  = fields_findv( f, level, FIELDS_STRP, subtag );

	if ( !mainttl ) return;

	fprintf( fp, "%s  - %s", ristag, mainttl->data );
	if ( subttl ) {
		if ( mainttl->len > 0 &&
		     mainttl->data[ mainttl->len - 1 ]!='?' )
			fprintf( fp, ":" );
		fprintf( fp, " %s", subttl->data );
	}
	fprintf( fp, "\n" );
}
示例#7
0
static void
output_title( fields *info, FILE *outptr, int level )
{
	char *ttl    = fields_findv( info, level, FIELDS_CHRP, "TITLE" );
	char *subttl = fields_findv( info, level, FIELDS_CHRP, "SUBTITLE" );
	char *shrttl = fields_findv( info, level, FIELDS_CHRP, "SHORTTITLE" );

	output_titleinfo( info, outptr, "b:Title", level );

	/* output shorttitle if it's different from normal title */
	if ( shrttl ) {
		if ( !ttl || ( strcmp( shrttl, ttl ) || subttl ) ) {
			fprintf( outptr,  " <b:ShortTitle>" );
			fprintf( outptr, "%s", shrttl );
			fprintf( outptr, "</b:ShortTitle>\n" );
		}
	}
}
示例#8
0
static void
output_titleinfo( fields *info, FILE *outptr, char *tag, int level )
{
	newstr *mainttl = fields_findv( info, level, FIELDS_STRP, "TITLE" );
	newstr *subttl  = fields_findv( info, level, FIELDS_STRP, "SUBTITLE" );
	if ( mainttl || subttl ) {
		fprintf( outptr, "<%s>", tag );
		if ( mainttl ) fprintf( outptr, "%s", mainttl->data );
		if ( subttl ) {
			if ( mainttl ) {
				if ( mainttl->len > 0 &&
				     mainttl->data[mainttl->len-1]!='?' )
					fprintf( outptr, ": " );
				else fprintf( outptr, " " );
			}
			fprintf( outptr, "%s", subttl->data );
		}
		fprintf( outptr, "</%s>\n", tag );
	}
}
示例#9
0
static int
output_title( FILE *fp, fields *info, char *full, char *sub, char *endtag, 
		int level )
{
	newstr *mainttl = fields_findv( info, level, FIELDS_STRP, full );
	newstr *subttl  = fields_findv( info, level, FIELDS_STRP, sub );

	if ( !mainttl ) return 0;

	fprintf( fp, "%s %s", endtag, mainttl->data );
	if ( subttl ) {
		if ( mainttl->len > 0 &&
		     mainttl->data[ mainttl->len-1 ]!='?' )
				fprintf( fp, ":" );
		fprintf( fp, " %s", subttl->data );
	}
	fprintf( fp, "\n" );

	return 1;
}
示例#10
0
static void
output_comments( fields *info, FILE *outptr, int level )
{
	vplist notes;
	char *abs;
	int i;

	vplist_init( &notes );

	abs = fields_findv( info, level, FIELDS_CHRP, "ABSTRACT" );
	fields_findv_each( info, level, FIELDS_CHRP, &notes, "NOTES" );

	if ( abs || notes.n ) fprintf( outptr, "<b:Comments>" );
	if ( abs ) fprintf( outptr, "%s", abs );
	for ( i=0; i<notes.n; ++i )
		fprintf( outptr, "%s", (char*)vplist_get( &notes, i ) );
	if ( abs || notes.n ) fprintf( outptr, "</b:Comments>\n" );

	vplist_free( &notes );
}
示例#11
0
static void
output_title( FILE *fp, fields *f, char *full, char *sub, char *adstag, int level )
{
	newstr *fulltitle, *subtitle, *vol, *iss, *sn, *en, *ar;

	fulltitle = fields_findv( f, level, FIELDS_STRP, full );
	subtitle  = fields_findv( f, level, FIELDS_STRP, sub );

	if ( fulltitle && fulltitle->len ) {

		fprintf( fp, "%s %s", adstag, fulltitle->data );
		if ( subtitle && subtitle->len ) {
			if ( fulltitle->data[ fulltitle->len - 1 ] != '?' )
				fprintf( fp, ": " );
			else fprintf( fp, " " );
			fprintf( fp, "%s", subtitle->data );
		}

		vol = fields_findv( f, LEVEL_ANY, FIELDS_STRP, "VOLUME" );
		if ( vol && vol->len ) fprintf( fp, ", vol. %s", vol->data );

		iss = fields_findv_firstof( f, LEVEL_ANY, FIELDS_STRP, "ISSUE",
			"NUMBER", NULL );
		if ( iss && iss->len ) fprintf( fp, ", no. %s", iss->data );

		sn = fields_findv( f, LEVEL_ANY, FIELDS_STRP, "PAGESTART" );
		en = fields_findv( f, LEVEL_ANY, FIELDS_STRP, "PAGEEND" );
		ar = fields_findv( f, LEVEL_ANY, FIELDS_STRP, "ARTICLENUMBER" );
		if ( sn && sn->len ) {
			if ( en && en->len )
				fprintf( fp, ", pp." );
			else
				fprintf( fp, ", p." );
			fprintf( fp, " %s", sn->data );
		} else if ( ar && ar->len ) {
			fprintf( fp, ", p. %s", ar->data );
		}
		if ( en && en->len ) {
			fprintf( fp, "-%s", en->data );
		}

		fprintf( fp, "\n" );
	}
}
示例#12
0
static void
output_easy( FILE *fp, fields *f, char *tag, char *adstag, int level )
{
	char *value = fields_findv( f, level, FIELDS_CHRP, tag );
	if ( value && value[0]!='\0' ) fprintf( fp, "%s %s\n", adstag, value );
}
示例#13
0
static void
output_easy( FILE *fp, fields *f, char *tag, char *ristag, int level )
{
	char *value = fields_findv( f, level, FIELDS_CHRP, tag );
	if ( value ) fprintf( fp, "%s  - %s\n", ristag, value );
}
示例#14
0
static void
output_easy( FILE *fp, fields *info, char *tag, char *entag, int level )
{
	char *value = fields_findv( info, level, FIELDS_CHRP, tag );
	if ( value ) fprintf( fp, "%s %s\n", entag, value );
}