@@ -45,7 +45,8 @@ @implementation Node
4545@dynamic notes;
4646@dynamic children;
4747
48- static NSString *kFileLinkRegex = @" \\ [\\ [file:([a-zA-Z0-9/\\ -_\\ .]*\\ .(?:org|txt))\\ ]\\ [(.*)\\ ]\\ ]" ;
48+ static NSString *kUnixFileLinkRegex = @" \\ [\\ [file:(.*\\ .(?:org|txt))\\ ]\\ [(.*)\\ ]\\ ]" ;
49+
4950
5051- (NSComparisonResult )sequenceIndexCompare : (Node*)obj
5152{
@@ -311,7 +312,7 @@ - (NSString*)resolveLink:(NSString*)link {
311312}
312313
313314- (bool )isLink {
314- NSRange linkRange = [[self heading ] rangeOfRegex: kFileLinkRegex ];
315+ NSRange linkRange = [[self heading ] rangeOfRegex: kUnixFileLinkRegex ];
315316 if (linkRange.location != NSNotFound ) {
316317 return true ;
317318 }
@@ -320,7 +321,7 @@ - (bool)isLink {
320321
321322// This will construct the link relative to the root of the file, sort of. It isn't perfect yet.
322323- (NSString *)linkFile {
323- NSArray *captures = [[self heading ] captureComponentsMatchedByRegex: kFileLinkRegex ];
324+ NSArray *captures = [[self heading ] captureComponentsMatchedByRegex: kUnixFileLinkRegex ];
324325 if ([captures count ] > 0 ) {
325326 return [self resolveLink: [captures objectAtIndex: 1 ]];
326327 }
@@ -360,7 +361,7 @@ - (void)collectLinks:(NSMutableArray*)links {
360361
361362 // Collect links from body text
362363 {
363- NSArray *matches = [[self body ] arrayOfCaptureComponentsMatchedByRegex: kFileLinkRegex ];
364+ NSArray *matches = [[self body ] arrayOfCaptureComponentsMatchedByRegex: kUnixFileLinkRegex ];
364365 for (NSArray *match in matches) {
365366 NSString *link = [self resolveLink: [match objectAtIndex: 1 ]];
366367 if (link && [link length ] > 1 ) {
@@ -391,6 +392,7 @@ - (NSString*)markupLine:(NSString*)line {
391392
392393 // Any file: links that link to org files?
393394 {
395+ // FIXME: No Unix Filenames matched!
394396 NSString *regexString = @" \\ [\\ [file:([a-zA-Z0-9/\\ -\\ ._]+\\ .(?:org|txt))\\ ]\\ [([a-zA-Z0-9/\\ -_\\ . '!?]+)\\ ]\\ ]" ;
395397 line = [line stringByReplacingOccurrencesOfRegex: regexString withString: @" <a href='orgfile:$1'>$2</a>" ];
396398 }
0 commit comments