-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCCiteKeyStringExtensions.h
63 lines (41 loc) · 1.6 KB
/
BCCiteKeyStringExtensions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// BCCiteKeyStringExtensions.h
// Caravan
//
// Created by Tom Houpt on 15/4/17.
// Copyright (c) 2015 Tom Houpt. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@interface NSString (CiteKeyExtensions)
/** return an attributed string of length 1 consisting of an NSAttachmentChararacter with a NSTextAttachment. The NSTextAttachment has name <self> and with a token image
*/
-(NSAttributedString *)stringAsTokenAttachment;
/** return an NSImage of the string drawn in a rounded token rectangle.
current implementation is font size 12 in 16 tall token, with light blue color d2e7fb
*/
-(NSImage *)tokenImage;
/** scan the string for every universal citekey @"{<author>:YYYYaa}" and replace with token attachements
*/
-(NSAttributedString *)stringByReplacingCiteKeyStringsWithTokens;
/** scan the string for every universal citekey @"{<author>:YYYYaa}" and replace with bibTeX citation @"[@<author>:YYYYaa]"
*/
-(NSMutableString *)stringByReplacingCiteKeyStringsWithBibTeXCitation;
/** scan the string and return space-separated initials
examples:
@"TA" -> @"T A"
@"Thomas" -> @"T"
@"T.A." -> @"T.A."
@"Thomas A." ->@"T A"
@"Thomas Albro" ->@"T A"
@"Louie-Phillipe" @"L-P"
@"L.-P." @"L-P"
*/
-(NSString *)stringByGettingInitials;
@end
@interface NSAttributedString (CiteKeyExtensions)
/** scan the string for every token attachements and replace with universal citekeys @"{<author>:YYYYaa}" in a new string
*/
-(NSString *)stringByReplacingCiteKeyTokensWithStrings;
-(NSArray *)rangesOfTokensWithName:(NSString *)tokenName;
@end