From 745892fbddea56040139108277e728b53fd8fc11 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 28 May 2020 03:03:21 +0000 Subject: CTAN sync 202005280303 --- support/texlab/crates/bibutils_sys/src/title.c | 100 ------------------------- 1 file changed, 100 deletions(-) delete mode 100644 support/texlab/crates/bibutils_sys/src/title.c (limited to 'support/texlab/crates/bibutils_sys/src/title.c') diff --git a/support/texlab/crates/bibutils_sys/src/title.c b/support/texlab/crates/bibutils_sys/src/title.c deleted file mode 100644 index 6b2981442d..0000000000 --- a/support/texlab/crates/bibutils_sys/src/title.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * title.c - * - * process titles into title/subtitle pairs for MODS - * - * Copyright (c) Chris Putnam 2004-2019 - * - * Source code released under the GPL version 2 - * - */ -#include -#include -#include -#include "str.h" -#include "fields.h" -#include "title.h" -#include "is_ws.h" -#include "msvc_fix.h" - -int -title_process( fields *info, const char *tag, const char *value, int level, unsigned char nosplittitle ) -{ - str title, subtitle; - const char *p, *q; - int status; - - str_init( &title ); - str_init( &subtitle ); - - if ( nosplittitle ) q = NULL; - else { - q = strstr( value, ": " ); - if ( !q ) q = strstr( value, "? " ); - } - - if ( !q ) str_strcpyc( &title, value ); - else { - p = value; - while ( p!=q ) str_addchar( &title, *p++ ); - if ( *q=='?' ) str_addchar( &title, '?' ); - q++; - q = skip_ws( q ); - while ( *q ) str_addchar( &subtitle, *q++ ); - } - - if ( strncasecmp( "SHORT", tag, 5 ) ) { - if ( str_has_value( &title ) ) { - status = fields_add( info, "TITLE", str_cstr( &title ), level ); - if ( status!=FIELDS_OK ) return 0; - } - if ( str_has_value( &subtitle ) ) { - status = fields_add( info, "SUBTITLE", str_cstr( &subtitle ), level ); - if ( status!=FIELDS_OK ) return 0; - } - } else { - if ( str_has_value( &title ) ) { - status = fields_add( info, "SHORTTITLE", str_cstr( &title ), level ); - if ( status!=FIELDS_OK ) return 0; - } - /* no SHORT-SUBTITLE! */ - } - - str_free( &subtitle ); - str_free( &title ); - - return 1; -} - -/* title_combine() - * - * Combine a main title and a subtitle into a full title. - * - * Example: - * Main title = "A Clearing in the Distance" - * Subtitle = "The Biography of Frederick Law Olmstead" - * Full title = "A Clearing in the Distance: The Biography of Frederick Law Olmstead" - * Example: - * Main title = "What Makes a Good Team Player?" - * Subtitle = "Personality and Team Effectiveness" - * Full title = "What Makes a Good Team Player? Personality and Team Effectiveness" - */ -void -title_combine( str *fullttl, str *mainttl, str *subttl ) -{ - str_empty( fullttl ); - - if ( !mainttl ) return; - - str_strcpy( fullttl, mainttl ); - - if ( subttl ) { - if ( str_has_value( mainttl ) ) { - if ( mainttl->data[ mainttl->len - 1 ] != '?' && mainttl->data[ mainttl->len - 1] != ':' ) - str_strcatc( fullttl, ": " ); - else - str_strcatc( fullttl, " " ); - } - str_strcat( fullttl, subttl ); - } -} -- cgit v1.2.3