Revision: 4350
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4350&view=rev
Author:   hofman
Date:     2008-08-04 17:29:46 +0000 (Mon, 04 Aug 2008)

Log Message:
-----------
Rename tag classes to include template in their name. typedef names for type 
enums.

Modified Paths:
--------------
    trunk/SKTemplateParser.m
    trunk/Skim.xcodeproj/project.pbxproj

Added Paths:
-----------
    trunk/SKTemplateTag.h
    trunk/SKTemplateTag.m

Removed Paths:
-------------
    trunk/SKTag.h
    trunk/SKTag.m

Deleted: trunk/SKTag.h
===================================================================
--- trunk/SKTag.h       2008-08-04 17:00:56 UTC (rev 4349)
+++ trunk/SKTag.h       2008-08-04 17:29:46 UTC (rev 4350)
@@ -1,155 +0,0 @@
-//
-//  SKTag.h
-//  Skim
-//
-//  Created by Christiaan Hofman on 10/12/07.
-/*
- This software is Copyright (c) 2007-2008
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-enum {
-    SKValueTagType,
-    SKCollectionTagType,
-    SKConditionTagType,
-    SKTextTagType
-};
-
[EMAIL PROTECTED] SKTag : NSObject {
-}
-- (int)type;
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKValueTag : SKTag {
-    NSString *keyPath;
-}
-
-- (id)initWithKeyPath:(NSString *)aKeyPath;
-
-- (NSString *)keyPath;
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichValueTag : SKValueTag {
-    NSDictionary *attributes;
-}
-
-- (id)initWithKeyPath:(NSString *)aKeyPath attributes:(NSDictionary 
*)anAttributes;
-
-- (NSDictionary *)attributes;
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKCollectionTag : SKValueTag {
-    NSString *itemTemplateString;
-    NSString *separatorTemplateString;
-    NSMutableArray *itemTemplate;
-    NSMutableArray *separatorTemplate;
-}
-
-- (id)initWithKeyPath:(NSString *)aKeyPath itemTemplateString:(NSString 
*)anItemTemplateString separatorTemplateString:(NSString 
*)aSeparatorTemplateString;
-
-- (NSArray *)itemTemplate;
-- (NSArray *)separatorTemplate;
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichCollectionTag : SKValueTag {
-    NSAttributedString *itemTemplateAttributedString;
-    NSAttributedString *separatorTemplateAttributedString;
-    NSMutableArray *itemTemplate;
-    NSMutableArray *separatorTemplate;
-}
-
-- (id)initWithKeyPath:(NSString *)aKeyPath 
itemTemplateAttributedString:(NSAttributedString *)anItemTemplateString 
separatorTemplateAttributedString:(NSAttributedString 
*)aSeparatorTemplateString;
-
-- (NSArray *)itemTemplate;
-- (NSArray *)separatorTemplate;
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKConditionTag : SKValueTag {
-    int matchType;
-    NSMutableArray *subtemplates;
-    NSArray *matchStrings;
-}
-
-- (id)initWithKeyPath:(NSString *)aKeyPath matchType:(int)aMatchType 
matchStrings:(NSArray *)aMatchStrings subtemplates:(NSArray *)aSubtemplates;
-
-- (int)matchType;
-- (NSArray *)matchStrings;
-- (NSArray *)subtemplates;
-- (NSArray *)subtemplateAtIndex:(unsigned)index;
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichConditionTag : SKConditionTag
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKTextTag : SKTag {
-    NSString *text;
-}
-
-- (id)initWithText:(NSString *)aText;
-
-- (NSString *)text;
-- (void)setText:(NSString *)newText;
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichTextTag : SKTag {
-    NSAttributedString *attributedText;
-}
-
-- (id)initWithAttributedText:(NSAttributedString *)anAttributedText;
-
-- (NSAttributedString *)attributedText;
-- (void)setAttributedText:(NSAttributedString *)newAttributedText;
-
[EMAIL PROTECTED]

Deleted: trunk/SKTag.m
===================================================================
--- trunk/SKTag.m       2008-08-04 17:00:56 UTC (rev 4349)
+++ trunk/SKTag.m       2008-08-04 17:29:46 UTC (rev 4350)
@@ -1,288 +0,0 @@
-//
-//  SKTag.m
-//  Skim
-//
-//  Created by Christiaan Hofman on 10/12/07.
-/*
- This software is Copyright (c) 2007-2008
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "SKTag.h"
-#import "SKTemplateParser.h"
-
-
[EMAIL PROTECTED] SKTag
-- (int)type { return -1; }
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKValueTag
-
-- (id)initWithKeyPath:(NSString *)aKeyPath {
-    if (self = [super init]) {
-        keyPath = [aKeyPath copy];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [keyPath release];
-    [super dealloc];
-}
-
-- (int)type { return SKValueTagType; }
-
-- (NSString *)keyPath {
-    return keyPath;
-}
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichValueTag
-
-- (id)initWithKeyPath:(NSString *)aKeyPath attributes:(NSDictionary 
*)anAttributes {
-    if (self = [super initWithKeyPath:aKeyPath]) {
-        attributes = [anAttributes copy];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [attributes release];
-    [super dealloc];
-}
-
-- (NSDictionary *)attributes {
-    return attributes;
-}
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKCollectionTag
-
-- (id)initWithKeyPath:(NSString *)aKeyPath itemTemplateString:(NSString 
*)anItemTemplateString separatorTemplateString:(NSString 
*)aSeparatorTemplateString {
-    if (self = [super initWithKeyPath:aKeyPath]) {
-        itemTemplateString = [anItemTemplateString retain];
-        separatorTemplateString = [aSeparatorTemplateString retain];
-        itemTemplate = nil;
-        separatorTemplate = nil;
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [itemTemplateString release];
-    [separatorTemplateString release];
-    [itemTemplate release];
-    [separatorTemplate release];
-    [super dealloc];
-}
-
-- (int)type { return SKCollectionTagType; }
-
-- (NSArray *)itemTemplate {
-    if (itemTemplate == nil && itemTemplateString)
-        itemTemplate = [[SKTemplateParser 
arrayByParsingTemplateString:itemTemplateString] retain];
-    return itemTemplate;
-}
-
-- (NSArray *)separatorTemplate {
-    if (separatorTemplate == nil && separatorTemplateString)
-        separatorTemplate = [[SKTemplateParser 
arrayByParsingTemplateString:separatorTemplateString] retain];
-    return separatorTemplate;
-}
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichCollectionTag
-
-- (id)initWithKeyPath:(NSString *)aKeyPath 
itemTemplateAttributedString:(NSAttributedString *)anItemTemplateString 
separatorTemplateAttributedString:(NSAttributedString 
*)aSeparatorTemplateString {
-    if (self = [super initWithKeyPath:aKeyPath]) {
-        itemTemplateAttributedString = [anItemTemplateString retain];
-        separatorTemplateAttributedString = [aSeparatorTemplateString retain];
-        itemTemplate = nil;
-        separatorTemplate = nil;
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [itemTemplateAttributedString release];
-    [separatorTemplateAttributedString release];
-    [itemTemplate release];
-    [separatorTemplate release];
-    [super dealloc];
-}
-
-- (int)type { return SKCollectionTagType; }
-
-- (NSArray *)itemTemplate {
-    if (itemTemplate == nil && itemTemplateAttributedString)
-        itemTemplate = [[SKTemplateParser 
arrayByParsingTemplateAttributedString:itemTemplateAttributedString] retain];
-    return itemTemplate;
-}
-
-- (NSArray *)separatorTemplate {
-    if (separatorTemplate == nil && separatorTemplateAttributedString)
-        separatorTemplate = [[SKTemplateParser 
arrayByParsingTemplateAttributedString:separatorTemplateAttributedString] 
retain];
-    return separatorTemplate;
-}
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKConditionTag
-
-- (id)initWithKeyPath:(NSString *)aKeyPath matchType:(int)aMatchType 
matchStrings:(NSArray *)aMatchStrings subtemplates:(NSArray *)aSubtemplates {
-    if (self = [super initWithKeyPath:aKeyPath]) {
-        matchType = aMatchType;
-        matchStrings = [aMatchStrings copy];
-        subtemplates = [aSubtemplates mutableCopy];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [subtemplates release];
-    [matchStrings release];
-    [super dealloc];
-}
-
-- (int)type { return SKConditionTagType; }
-
-- (int)matchType {
-    return matchType;
-}
-
-- (NSArray *)subtemplates {
-    return subtemplates;
-}
-
-- (NSArray *)matchStrings {
-    return matchStrings;
-}
-
-- (NSArray *)subtemplateAtIndex:(unsigned)anIndex {
-    id subtemplate = [subtemplates objectAtIndex:anIndex];
-    if ([subtemplate isKindOfClass:[NSArray class]] == NO) {
-         subtemplate = [[SKTemplateParser 
arrayByParsingTemplateString:subtemplate] retain];
-        [subtemplates replaceObjectAtIndex:anIndex withObject:subtemplate];
-    }
-    return subtemplate;
-}
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichConditionTag
-
-- (NSArray *)subtemplateAtIndex:(unsigned)anIndex {
-    id subtemplate = [subtemplates objectAtIndex:anIndex];
-    if ([subtemplate isKindOfClass:[NSArray class]] == NO) {
-        subtemplate = [[SKTemplateParser 
arrayByParsingTemplateAttributedString:subtemplate] retain];
-        [subtemplates replaceObjectAtIndex:anIndex withObject:subtemplate];
-    }
-    return subtemplate;
-}
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKTextTag
-
-- (id)initWithText:(NSString *)aText {
-    if (self = [super init]) {
-        text = [aText retain];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [text release];
-    [super dealloc];
-}
-
-- (int)type { return SKTextTagType; }
-
-- (NSString *)text {
-    return text;
-}
-
-- (void)setText:(NSString *)newText {
-    if (text != newText) {
-        [text release];
-        text = [newText retain];
-    }
-}
-
[EMAIL PROTECTED]
-
-#pragma mark -
-
[EMAIL PROTECTED] SKRichTextTag
-
-- (id)initWithAttributedText:(NSAttributedString *)anAttributedText {
-    if (self = [super init]) {
-        attributedText = [anAttributedText retain];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [attributedText release];
-    [super dealloc];
-}
-
-- (int)type { return SKTextTagType; }
-
-- (NSAttributedString *)attributedText {
-    return attributedText;
-}
-
-- (void)setAttributedText:(NSAttributedString *)newAttributedText {
-    if (attributedText != newAttributedText) {
-        [attributedText release];
-        attributedText = [newAttributedText retain];
-    }
-}
-
[EMAIL PROTECTED]

Modified: trunk/SKTemplateParser.m
===================================================================
--- trunk/SKTemplateParser.m    2008-08-04 17:00:56 UTC (rev 4349)
+++ trunk/SKTemplateParser.m    2008-08-04 17:29:46 UTC (rev 4350)
@@ -37,7 +37,7 @@
  */
 
 #import "SKTemplateParser.h"
-#import "SKTag.h"
+#import "SKTemplateTag.h"
 #import "NSCharacterSet_SKExtensions.h"
 #import "NSString_SKExtensions.h"
 #import "NSObject_SKExtensions.h"
@@ -69,14 +69,6 @@
                or: <$key<=value?> <?$key?> </$key?>
 */
 
-enum {
-    SKConditionTagMatchOther,
-    SKConditionTagMatchEqual,
-    SKConditionTagMatchContain,
-    SKConditionTagMatchSmaller,
-    SKConditionTagMatchSmallerOrEqual,
-};
-
 @implementation SKTemplateParser
 
 
@@ -146,14 +138,14 @@
     return altTag;
 }
 
-static inline NSString *compareConditionTagWithTag(NSString *tag, int 
matchType) {
+static inline NSString *compareConditionTagWithTag(NSString *tag, 
SKTemplateTagMatchType matchType) {
     static NSMutableDictionary *equalConditionDict = nil;
     static NSMutableDictionary *containConditionDict = nil;
     static NSMutableDictionary *smallerConditionDict = nil;
     static NSMutableDictionary *smallerOrEqualConditionDict = nil;
     NSString *altTag = nil;
     switch (matchType) {
-        case SKConditionTagMatchEqual:
+        case SKTemplateTagMatchEqual:
             if (nil == equalConditionDict)
                 equalConditionDict = [[NSMutableDictionary alloc] init];
             altTag = [equalConditionDict objectForKey:tag];
@@ -162,7 +154,7 @@
                 [equalConditionDict setObject:altTag forKey:tag];
             }
             break;
-        case SKConditionTagMatchContain:
+        case SKTemplateTagMatchContain:
             if (nil == containConditionDict)
                 containConditionDict = [[NSMutableDictionary alloc] init];
             altTag = [containConditionDict objectForKey:tag];
@@ -171,7 +163,7 @@
                 [containConditionDict setObject:altTag forKey:tag];
             }
             break;
-        case SKConditionTagMatchSmaller:
+        case SKTemplateTagMatchSmaller:
             if (nil == smallerConditionDict)
                 smallerConditionDict = [[NSMutableDictionary alloc] init];
             altTag = [smallerConditionDict objectForKey:tag];
@@ -180,7 +172,7 @@
                 [smallerConditionDict setObject:altTag forKey:tag];
             }
             break;
-        case SKConditionTagMatchSmallerOrEqual:
+        case SKTemplateTagMatchSmallerOrEqual:
             if (nil == smallerOrEqualConditionDict)
                 smallerOrEqualConditionDict = [[NSMutableDictionary alloc] 
init];
             altTag = [smallerOrEqualConditionDict objectForKey:tag];
@@ -237,10 +229,10 @@
         int start;
                 
         if ([scanner scanUpToString:START_TAG_OPEN_DELIM 
intoString:&beforeText]) {
-            if (currentTag && [(SKTag *)currentTag type] == SKTextTagType) {
-                [(SKTextTag *)currentTag setText:[[(SKTextTag *)currentTag 
text] stringByAppendingString:beforeText]];
+            if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                [(SKTextTemplateTag *)currentTag setText:[[(SKTextTemplateTag 
*)currentTag text] stringByAppendingString:beforeText]];
             } else {
-                currentTag = [[SKTextTag alloc] initWithText:beforeText];
+                currentTag = [[SKTextTemplateTag alloc] 
initWithText:beforeText];
                 [result addObject:currentTag];
                 [currentTag release];
             }
@@ -257,7 +249,7 @@
             if ([scanner scanString:VALUE_TAG_CLOSE_DELIM intoString:nil]) {
                 
                 // simple template currentTag
-                currentTag = [[SKValueTag alloc] initWithKeyPath:tag];
+                currentTag = [[SKValueTemplateTag alloc] initWithKeyPath:tag];
                 [result addObject:currentTag];
                 [currentTag release];
                 
@@ -269,14 +261,14 @@
                 
                 // collection template tag
                 // ignore whitespace before the tag. Should we also remove a 
newline?
-                if (currentTag && [(SKTag *)currentTag type] == SKTextTagType) 
{
-                    wsRange = [[(SKTextTag *)currentTag text] 
rangeOfTrailingEmptyLineRequiringNewline:[result count] != 1];
+                if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                    wsRange = [[(SKTextTemplateTag *)currentTag text] 
rangeOfTrailingEmptyLineRequiringNewline:[result count] != 1];
                     if (wsRange.location != NSNotFound) {
                         if (wsRange.length == [[currentTag text] length]) {
                             [result removeLastObject];
                             currentTag = [result lastObject];
                         } else {
-                            [(SKTextTag *)currentTag setText:[[(SKTextTag 
*)currentTag text] substringToIndex:wsRange.location]];
+                            [(SKTextTemplateTag *)currentTag 
setText:[[(SKTextTemplateTag *)currentTag text] 
substringToIndex:wsRange.location]];
                         }
                     }
                 }
@@ -298,7 +290,7 @@
                         itemTemplate = [itemTemplate 
substringToIndex:sepTagRange.location];
                     }
                     
-                    currentTag = [[SKCollectionTag alloc] initWithKeyPath:tag 
itemTemplateString:itemTemplate separatorTemplateString:separatorTemplate];
+                    currentTag = [[SKCollectionTemplateTag alloc] 
initWithKeyPath:tag itemTemplateString:itemTemplate 
separatorTemplateString:separatorTemplate];
                     [result addObject:currentTag];
                     [currentTag release];
                     
@@ -310,24 +302,24 @@
             } else {
                 
                 NSString *matchString = nil;
-                int matchType = SKConditionTagMatchOther;
+                SKTemplateTagMatchType matchType = SKTemplateTagMatchOther;
                 
                 if ([scanner scanString:CONDITION_TAG_EQUAL intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchEqual;
+                    matchType = SKTemplateTagMatchEqual;
                 } else if ([scanner scanString:CONDITION_TAG_CONTAIN 
intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchContain;
+                    matchType = SKTemplateTagMatchContain;
                 } else if ([scanner scanString:CONDITION_TAG_SMALLER_OR_EQUAL 
intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchSmallerOrEqual;
+                    matchType = SKTemplateTagMatchSmallerOrEqual;
                 } else if ([scanner scanString:CONDITION_TAG_SMALLER 
intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchSmaller;
+                    matchType = SKTemplateTagMatchSmaller;
                 }
                 
                 if ([scanner scanString:CONDITION_TAG_CLOSE_DELIM 
intoString:nil]) {
@@ -339,14 +331,14 @@
                     
                     // condition template tag
                     // ignore whitespace before the tag. Should we also remove 
a newline?
-                    if (currentTag && [(SKTag *)currentTag type] == 
SKTextTagType) {
-                        wsRange = [[(SKTextTag *)currentTag text] 
rangeOfTrailingEmptyLineRequiringNewline:[result count] != 1];
+                    if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                        wsRange = [[(SKTextTemplateTag *)currentTag text] 
rangeOfTrailingEmptyLineRequiringNewline:[result count] != 1];
                         if (wsRange.location != NSNotFound) {
                             if (wsRange.length == [[currentTag text] length]) {
                                 [result removeLastObject];
                                 currentTag = [result lastObject];
                             } else {
-                                [(SKTextTag *)currentTag setText:[[(SKTextTag 
*)currentTag text] substringToIndex:wsRange.location]];
+                                [(SKTextTemplateTag *)currentTag 
setText:[[(SKTextTemplateTag *)currentTag text] 
substringToIndex:wsRange.location]];
                             }
                         }
                     }
@@ -365,7 +357,7 @@
                         subTemplates = [[NSMutableArray alloc] init];
                         matchStrings = [[NSMutableArray alloc] 
initWithObjects:matchString ? matchString : @"", nil];
                         
-                        if (matchType != SKConditionTagMatchOther) {
+                        if (matchType != SKTemplateTagMatchOther) {
                             altTag = compareConditionTagWithTag(tag, 
matchType);
                             altTagRange = altTemplateTagRange(subTemplate, 
altTag, CONDITION_TAG_CLOSE_DELIM, &matchString);
                             while (altTagRange.location != NSNotFound) {
@@ -383,7 +375,7 @@
                         }
                         [subTemplates addObject:subTemplate];
                         
-                        currentTag = [[SKConditionTag alloc] 
initWithKeyPath:tag matchType:matchType matchStrings:matchStrings 
subtemplates:subTemplates];
+                        currentTag = [[SKConditionTemplateTag alloc] 
initWithKeyPath:tag matchType:matchType matchStrings:matchStrings 
subtemplates:subTemplates];
                         [result addObject:currentTag];
                         [currentTag release];
                         
@@ -397,10 +389,10 @@
                 } else {
                     
                     // an open delimiter without a close delimiter, so no 
template tag. Rewind
-                    if (currentTag && [(SKTag *)currentTag type] == 
SKTextTagType) {
-                        [(SKTextTag *)currentTag setText:[[(SKTextTag 
*)currentTag text] stringByAppendingString:START_TAG_OPEN_DELIM]];
+                    if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                        [(SKTextTemplateTag *)currentTag 
setText:[[(SKTextTemplateTag *)currentTag text] 
stringByAppendingString:START_TAG_OPEN_DELIM]];
                     } else {
-                        currentTag = [[SKTextTag alloc] 
initWithText:START_TAG_OPEN_DELIM];
+                        currentTag = [[SKTextTemplateTag alloc] 
initWithText:START_TAG_OPEN_DELIM];
                         [result addObject:currentTag];
                         [currentTag release];
                     }
@@ -420,11 +412,11 @@
     NSMutableString *result = [[NSMutableString alloc] init];
     
     while (tag = [tagEnum nextObject]) {
-        int type = [(SKTag *)tag type];
+        SKTemplateTagType type = [(SKTemplateTag *)tag type];
         
-        if (type == SKTextTagType) {
+        if (type == SKTextTemplateTagType) {
             
-            [result appendString:[(SKTextTag *)tag text]];
+            [result appendString:[(SKTextTemplateTag *)tag text]];
             
         } else {
             
@@ -439,12 +431,12 @@
                 keyValue = [object templateValueForKeyPath:keyPath];
             }
             
-            if (type == SKValueTagType) {
+            if (type == SKValueTemplateTagType) {
                 
                 if (keyValue)
                     [result appendString:[keyValue templateStringValue]];
                 
-            } else if (type == SKCollectionTagType) {
+            } else if (type == SKCollectionTemplateTagType) {
                 
                 if ([keyValue respondsToSelector:@selector(objectEnumerator)]) 
{
                     NSEnumerator *itemE = [keyValue objectEnumerator];
@@ -478,16 +470,16 @@
                             matchString = @"";
                     }
                     switch ([tag matchType]) {
-                        case SKConditionTagMatchEqual:
+                        case SKTemplateTagMatchEqual:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
caseInsensitiveCompare:matchString] == NSOrderedSame;
                             break;
-                        case SKConditionTagMatchContain:
+                        case SKTemplateTagMatchContain:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
rangeOfString:matchString options:NSCaseInsensitiveSearch].location != 
NSNotFound;
                             break;
-                        case SKConditionTagMatchSmaller:
+                        case SKTemplateTagMatchSmaller:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
                             break;
-                        case SKConditionTagMatchSmallerOrEqual:
+                        case SKTemplateTagMatchSmallerOrEqual:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
                             break;
                         default:
@@ -539,14 +531,14 @@
         start = [scanner scanLocation];
                 
         if ([scanner scanUpToString:START_TAG_OPEN_DELIM 
intoString:&beforeText]) {
-            if (currentTag && [(SKTag *)currentTag type] == SKTextTagType) {
-                tmpAttrStr = [[(SKRichTextTag *)currentTag attributedText] 
mutableCopy];
+            if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                tmpAttrStr = [[(SKRichTextTemplateTag *)currentTag 
attributedText] mutableCopy];
                 [tmpAttrStr appendAttributedString:[template 
attributedSubstringFromRange:NSMakeRange(start, [beforeText length])]];
                 [tmpAttrStr fixAttributesInRange:NSMakeRange(0, [tmpAttrStr 
length])];
-                [(SKRichTextTag *)currentTag setAttributedText:tmpAttrStr];
+                [(SKRichTextTemplateTag *)currentTag 
setAttributedText:tmpAttrStr];
                 [tmpAttrStr release];
             } else {
-                currentTag = [[SKRichTextTag alloc] 
initWithAttributedText:[template 
attributedSubstringFromRange:NSMakeRange(start, [beforeText length])]];
+                currentTag = [[SKRichTextTemplateTag alloc] 
initWithAttributedText:[template 
attributedSubstringFromRange:NSMakeRange(start, [beforeText length])]];
                 [result addObject:currentTag];
                 [currentTag release];
             }
@@ -564,7 +556,7 @@
             if ([scanner scanString:VALUE_TAG_CLOSE_DELIM intoString:nil]) {
                 
                 // simple template tag
-                currentTag = [[SKRichValueTag alloc] initWithKeyPath:tag 
attributes:attr];
+                currentTag = [[SKRichValueTemplateTag alloc] 
initWithKeyPath:tag attributes:attr];
                 [result addObject:currentTag];
                 [currentTag release];
                
@@ -577,14 +569,14 @@
                 
                 // collection template tag
                 // ignore whitespace before the tag. Should we also remove a 
newline?
-                if (currentTag && [(SKTag *)currentTag type] == SKTextTagType) 
{
-                    wsRange = [[[(SKRichTextTag *)currentTag attributedText] 
string] rangeOfTrailingEmptyLineRequiringNewline:[result count] != 1];
+                if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                    wsRange = [[[(SKRichTextTemplateTag *)currentTag 
attributedText] string] rangeOfTrailingEmptyLineRequiringNewline:[result count] 
!= 1];
                     if (wsRange.location != NSNotFound) {
-                        if (wsRange.length == [[(SKRichTextTag *)currentTag 
attributedText] length]) {
+                        if (wsRange.length == [[(SKRichTextTemplateTag 
*)currentTag attributedText] length]) {
                             [result removeLastObject];
                             currentTag = [result lastObject];
                         } else {
-                            [(SKRichTextTag *)currentTag 
setAttributedText:[[(SKRichTextTag *)currentTag attributedText] 
attributedSubstringFromRange:NSMakeRange(0, wsRange.location)]];
+                            [(SKRichTextTemplateTag *)currentTag 
setAttributedText:[[(SKRichTextTemplateTag *)currentTag attributedText] 
attributedSubstringFromRange:NSMakeRange(0, wsRange.location)]];
                         }
                     }
                 }
@@ -606,7 +598,7 @@
                         itemTemplate = [itemTemplate 
attributedSubstringFromRange:NSMakeRange(0, sepTagRange.location)];
                     }
                     
-                    currentTag = [[SKRichCollectionTag alloc] 
initWithKeyPath:tag itemTemplateAttributedString:itemTemplate 
separatorTemplateAttributedString:separatorTemplate];
+                    currentTag = [[SKRichCollectionTemplateTag alloc] 
initWithKeyPath:tag itemTemplateAttributedString:itemTemplate 
separatorTemplateAttributedString:separatorTemplate];
                     [result addObject:currentTag];
                     [currentTag release];
                     
@@ -618,24 +610,24 @@
             } else {
                 
                 NSString *matchString = nil;
-                int matchType = SKConditionTagMatchOther;
+                SKTemplateTagMatchType matchType = SKTemplateTagMatchOther;
                 
                 if ([scanner scanString:CONDITION_TAG_EQUAL intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchEqual;
+                    matchType = SKTemplateTagMatchEqual;
                 } else if ([scanner scanString:CONDITION_TAG_CONTAIN 
intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchContain;
+                    matchType = SKTemplateTagMatchContain;
                 } else if ([scanner scanString:CONDITION_TAG_SMALLER_OR_EQUAL 
intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchSmallerOrEqual;
+                    matchType = SKTemplateTagMatchSmallerOrEqual;
                 } else if ([scanner scanString:CONDITION_TAG_SMALLER 
intoString:nil]) {
                     if ([scanner scanUpToString:CONDITION_TAG_CLOSE_DELIM 
intoString:&matchString] == NO)
                         matchString = @"";
-                    matchType = SKConditionTagMatchSmaller;
+                    matchType = SKTemplateTagMatchSmaller;
                 }
                 
                 if ([scanner scanString:CONDITION_TAG_CLOSE_DELIM 
intoString:nil]) {
@@ -648,14 +640,14 @@
                     
                     // condition template tag
                     // ignore whitespace before the tag. Should we also remove 
a newline?
-                    if (currentTag && [(SKTag *)currentTag type] == 
SKTextTagType) {
-                        wsRange = [[[(SKRichTextTag *)currentTag 
attributedText] string] rangeOfTrailingEmptyLineRequiringNewline:[result count] 
!= 1];
+                    if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                        wsRange = [[[(SKRichTextTemplateTag *)currentTag 
attributedText] string] rangeOfTrailingEmptyLineRequiringNewline:[result count] 
!= 1];
                         if (wsRange.location != NSNotFound) {
-                            if (wsRange.length == [[(SKRichTextTag 
*)currentTag attributedText] length]) {
+                            if (wsRange.length == [[(SKRichTextTemplateTag 
*)currentTag attributedText] length]) {
                                 [result removeLastObject];
                                 currentTag = [result lastObject];
                             } else {
-                                [(SKRichTextTag *)currentTag 
setAttributedText:[[(SKRichTextTag *)currentTag attributedText] 
attributedSubstringFromRange:NSMakeRange(0, wsRange.location)]];
+                                [(SKRichTextTemplateTag *)currentTag 
setAttributedText:[[(SKRichTextTemplateTag *)currentTag attributedText] 
attributedSubstringFromRange:NSMakeRange(0, wsRange.location)]];
                             }
                         }
                     }
@@ -675,7 +667,7 @@
                         subTemplates = [[NSMutableArray alloc] init];
                         matchStrings = [[NSMutableArray alloc] 
initWithObjects:matchString ? matchString : @"", nil];
                         
-                        if (matchType != SKConditionTagMatchOther) {
+                        if (matchType != SKTemplateTagMatchOther) {
                             altTag = compareConditionTagWithTag(tag, 
matchType);
                             altTagRange = altTemplateTagRange([subTemplate 
string], altTag, CONDITION_TAG_CLOSE_DELIM, &matchString);
                             while (altTagRange.location != NSNotFound) {
@@ -693,7 +685,7 @@
                         }
                         [subTemplates addObject:subTemplate];
                         
-                        currentTag = [[SKRichConditionTag alloc] 
initWithKeyPath:tag matchType:matchType matchStrings:matchStrings 
subtemplates:subTemplates];
+                        currentTag = [[SKRichConditionTemplateTag alloc] 
initWithKeyPath:tag matchType:matchType matchStrings:matchStrings 
subtemplates:subTemplates];
                         [result addObject:currentTag];
                         [currentTag release];
                         
@@ -707,14 +699,14 @@
                 } else {
                     
                     // a START_TAG_OPEN_DELIM without 
COLLECTION_TAG_CLOSE_DELIM, so no template tag. Rewind
-                    if (currentTag && [(SKTag *)currentTag type] == 
SKTextTagType) {
-                        tmpAttrStr = [[(SKRichTextTag *)currentTag 
attributedText] mutableCopy];
+                    if (currentTag && [(SKTemplateTag *)currentTag type] == 
SKTextTemplateTagType) {
+                        tmpAttrStr = [[(SKRichTextTemplateTag *)currentTag 
attributedText] mutableCopy];
                         [tmpAttrStr appendAttributedString:[template 
attributedSubstringFromRange:NSMakeRange(start - [START_TAG_OPEN_DELIM length], 
[START_TAG_OPEN_DELIM length])]];
                         [tmpAttrStr fixAttributesInRange:NSMakeRange(0, 
[tmpAttrStr length])];
-                        [(SKRichTextTag *)currentTag 
setAttributedText:tmpAttrStr];
+                        [(SKRichTextTemplateTag *)currentTag 
setAttributedText:tmpAttrStr];
                         [tmpAttrStr release];
                     } else {
-                        currentTag = [[SKRichTextTag alloc] 
initWithAttributedText:[template attributedSubstringFromRange:NSMakeRange(start 
- [START_TAG_OPEN_DELIM length], [START_TAG_OPEN_DELIM length])]];
+                        currentTag = [[SKRichTextTemplateTag alloc] 
initWithAttributedText:[template attributedSubstringFromRange:NSMakeRange(start 
- [START_TAG_OPEN_DELIM length], [START_TAG_OPEN_DELIM length])]];
                         [result addObject:currentTag];
                         [currentTag release];
                     }
@@ -736,12 +728,12 @@
     NSMutableAttributedString *result = [[NSMutableAttributedString alloc] 
init];
     
     while (tag = [tagEnum nextObject]) {
-        int type = [(SKTag *)tag type];
+        SKTemplateTagType type = [(SKTemplateTag *)tag type];
         NSAttributedString *tmpAttrStr = nil;
         
-        if (type == SKTextTagType) {
+        if (type == SKTextTemplateTagType) {
             
-            [result appendAttributedString:[(SKRichTextTag *)tag 
attributedText]];
+            [result appendAttributedString:[(SKRichTextTemplateTag *)tag 
attributedText]];
             
         } else {
             
@@ -756,12 +748,12 @@
                 keyValue = [object templateValueForKeyPath:keyPath];
             }
             
-            if (type == SKValueTagType) {
+            if (type == SKValueTemplateTagType) {
                 
                 if (keyValue)
-                    [result appendAttributedString:[keyValue 
templateAttributedStringValueWithAttributes:[(SKRichValueTag *)tag 
attributes]]];
+                    [result appendAttributedString:[keyValue 
templateAttributedStringValueWithAttributes:[(SKRichValueTemplateTag *)tag 
attributes]]];
                 
-            } else if (type == SKCollectionTagType) {
+            } else if (type == SKCollectionTemplateTagType) {
                 
                 if ([keyValue respondsToSelector:@selector(objectEnumerator)]) 
{
                     NSEnumerator *itemE = [keyValue objectEnumerator];
@@ -797,16 +789,16 @@
                             matchString = @"";
                     }
                     switch ([tag matchType]) {
-                        case SKConditionTagMatchEqual:
+                        case SKTemplateTagMatchEqual:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
caseInsensitiveCompare:matchString] == NSOrderedSame;
                             break;
-                        case SKConditionTagMatchContain:
+                        case SKTemplateTagMatchContain:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
rangeOfString:matchString options:NSCaseInsensitiveSearch].location != 
NSNotFound;
                             break;
-                        case SKConditionTagMatchSmaller:
+                        case SKTemplateTagMatchSmaller:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
                             break;
-                        case SKConditionTagMatchSmallerOrEqual:
+                        case SKTemplateTagMatchSmallerOrEqual:
                             isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
                             break;
                         default:

Copied: trunk/SKTemplateTag.h (from rev 4328, trunk/SKTag.h)
===================================================================
--- trunk/SKTemplateTag.h                               (rev 0)
+++ trunk/SKTemplateTag.h       2008-08-04 17:29:46 UTC (rev 4350)
@@ -0,0 +1,165 @@
+//
+//  SKTemplateTag.h
+//  Skim
+//
+//  Created by Christiaan Hofman on 10/12/07.
+/*
+ This software is Copyright (c) 2007-2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+enum {
+    SKValueTemplateTagType,
+    SKCollectionTemplateTagType,
+    SKConditionTemplateTagType,
+    SKTextTemplateTagType
+};
+typedef NSInteger SKTemplateTagType;
+
+enum {
+    SKTemplateTagMatchOther,
+    SKTemplateTagMatchEqual,
+    SKTemplateTagMatchContain,
+    SKTemplateTagMatchSmaller,
+    SKTemplateTagMatchSmallerOrEqual,
+};
+typedef NSInteger SKTemplateTagMatchType;
+
[EMAIL PROTECTED] SKTemplateTag : NSObject {
+}
+- (SKTemplateTagType)type;
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKValueTemplateTag : SKTemplateTag {
+    NSString *keyPath;
+}
+
+- (id)initWithKeyPath:(NSString *)aKeyPath;
+
+- (NSString *)keyPath;
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichValueTemplateTag : SKValueTemplateTag {
+    NSDictionary *attributes;
+}
+
+- (id)initWithKeyPath:(NSString *)aKeyPath attributes:(NSDictionary 
*)anAttributes;
+
+- (NSDictionary *)attributes;
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKCollectionTemplateTag : SKValueTemplateTag {
+    NSString *itemTemplateString;
+    NSString *separatorTemplateString;
+    NSMutableArray *itemTemplate;
+    NSMutableArray *separatorTemplate;
+}
+
+- (id)initWithKeyPath:(NSString *)aKeyPath itemTemplateString:(NSString 
*)anItemTemplateString separatorTemplateString:(NSString 
*)aSeparatorTemplateString;
+
+- (NSArray *)itemTemplate;
+- (NSArray *)separatorTemplate;
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichCollectionTemplateTag : SKValueTemplateTag {
+    NSAttributedString *itemTemplateAttributedString;
+    NSAttributedString *separatorTemplateAttributedString;
+    NSMutableArray *itemTemplate;
+    NSMutableArray *separatorTemplate;
+}
+
+- (id)initWithKeyPath:(NSString *)aKeyPath 
itemTemplateAttributedString:(NSAttributedString *)anItemTemplateString 
separatorTemplateAttributedString:(NSAttributedString 
*)aSeparatorTemplateString;
+
+- (NSArray *)itemTemplate;
+- (NSArray *)separatorTemplate;
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKConditionTemplateTag : SKValueTemplateTag {
+    SKTemplateTagMatchType matchType;
+    NSMutableArray *subtemplates;
+    NSArray *matchStrings;
+}
+
+- (id)initWithKeyPath:(NSString *)aKeyPath 
matchType:(SKTemplateTagMatchType)aMatchType matchStrings:(NSArray 
*)aMatchStrings subtemplates:(NSArray *)aSubtemplates;
+
+- (SKTemplateTagMatchType)matchType;
+- (NSArray *)matchStrings;
+- (NSArray *)subtemplates;
+- (NSArray *)subtemplateAtIndex:(unsigned)index;
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichConditionTemplateTag : SKConditionTemplateTag
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKTextTemplateTag : SKTemplateTag {
+    NSString *text;
+}
+
+- (id)initWithText:(NSString *)aText;
+
+- (NSString *)text;
+- (void)setText:(NSString *)newText;
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichTextTemplateTag : SKTemplateTag {
+    NSAttributedString *attributedText;
+}
+
+- (id)initWithAttributedText:(NSAttributedString *)anAttributedText;
+
+- (NSAttributedString *)attributedText;
+- (void)setAttributedText:(NSAttributedString *)newAttributedText;
+
[EMAIL PROTECTED]

Copied: trunk/SKTemplateTag.m (from rev 4328, trunk/SKTag.m)
===================================================================
--- trunk/SKTemplateTag.m                               (rev 0)
+++ trunk/SKTemplateTag.m       2008-08-04 17:29:46 UTC (rev 4350)
@@ -0,0 +1,288 @@
+//
+//  SKTemplateTag.m
+//  Skim
+//
+//  Created by Christiaan Hofman on 10/12/07.
+/*
+ This software is Copyright (c) 2007-2008
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "SKTemplateTag.h"
+#import "SKTemplateParser.h"
+
+
[EMAIL PROTECTED] SKTemplateTag
+- (SKTemplateTagType)type { return -1; }
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKValueTemplateTag
+
+- (id)initWithKeyPath:(NSString *)aKeyPath {
+    if (self = [super init]) {
+        keyPath = [aKeyPath copy];
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [keyPath release];
+    [super dealloc];
+}
+
+- (SKTemplateTagType)type { return SKValueTemplateTagType; }
+
+- (NSString *)keyPath {
+    return keyPath;
+}
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichValueTemplateTag
+
+- (id)initWithKeyPath:(NSString *)aKeyPath attributes:(NSDictionary 
*)anAttributes {
+    if (self = [super initWithKeyPath:aKeyPath]) {
+        attributes = [anAttributes copy];
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [attributes release];
+    [super dealloc];
+}
+
+- (NSDictionary *)attributes {
+    return attributes;
+}
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKCollectionTemplateTag
+
+- (id)initWithKeyPath:(NSString *)aKeyPath itemTemplateString:(NSString 
*)anItemTemplateString separatorTemplateString:(NSString 
*)aSeparatorTemplateString {
+    if (self = [super initWithKeyPath:aKeyPath]) {
+        itemTemplateString = [anItemTemplateString retain];
+        separatorTemplateString = [aSeparatorTemplateString retain];
+        itemTemplate = nil;
+        separatorTemplate = nil;
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [itemTemplateString release];
+    [separatorTemplateString release];
+    [itemTemplate release];
+    [separatorTemplate release];
+    [super dealloc];
+}
+
+- (SKTemplateTagType)type { return SKCollectionTemplateTagType; }
+
+- (NSArray *)itemTemplate {
+    if (itemTemplate == nil && itemTemplateString)
+        itemTemplate = [[SKTemplateParser 
arrayByParsingTemplateString:itemTemplateString] retain];
+    return itemTemplate;
+}
+
+- (NSArray *)separatorTemplate {
+    if (separatorTemplate == nil && separatorTemplateString)
+        separatorTemplate = [[SKTemplateParser 
arrayByParsingTemplateString:separatorTemplateString] retain];
+    return separatorTemplate;
+}
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichCollectionTemplateTag
+
+- (id)initWithKeyPath:(NSString *)aKeyPath 
itemTemplateAttributedString:(NSAttributedString *)anItemTemplateString 
separatorTemplateAttributedString:(NSAttributedString 
*)aSeparatorTemplateString {
+    if (self = [super initWithKeyPath:aKeyPath]) {
+        itemTemplateAttributedString = [anItemTemplateString retain];
+        separatorTemplateAttributedString = [aSeparatorTemplateString retain];
+        itemTemplate = nil;
+        separatorTemplate = nil;
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [itemTemplateAttributedString release];
+    [separatorTemplateAttributedString release];
+    [itemTemplate release];
+    [separatorTemplate release];
+    [super dealloc];
+}
+
+- (SKTemplateTagType)type { return SKCollectionTemplateTagType; }
+
+- (NSArray *)itemTemplate {
+    if (itemTemplate == nil && itemTemplateAttributedString)
+        itemTemplate = [[SKTemplateParser 
arrayByParsingTemplateAttributedString:itemTemplateAttributedString] retain];
+    return itemTemplate;
+}
+
+- (NSArray *)separatorTemplate {
+    if (separatorTemplate == nil && separatorTemplateAttributedString)
+        separatorTemplate = [[SKTemplateParser 
arrayByParsingTemplateAttributedString:separatorTemplateAttributedString] 
retain];
+    return separatorTemplate;
+}
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKConditionTemplateTag
+
+- (id)initWithKeyPath:(NSString *)aKeyPath 
matchType:(SKTemplateTagMatchType)aMatchType matchStrings:(NSArray 
*)aMatchStrings subtemplates:(NSArray *)aSubtemplates {
+    if (self = [super initWithKeyPath:aKeyPath]) {
+        matchType = aMatchType;
+        matchStrings = [aMatchStrings copy];
+        subtemplates = [aSubtemplates mutableCopy];
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [subtemplates release];
+    [matchStrings release];
+    [super dealloc];
+}
+
+- (SKTemplateTagType)type { return SKConditionTemplateTagType; }
+
+- (SKTemplateTagMatchType)matchType {
+    return matchType;
+}
+
+- (NSArray *)subtemplates {
+    return subtemplates;
+}
+
+- (NSArray *)matchStrings {
+    return matchStrings;
+}
+
+- (NSArray *)subtemplateAtIndex:(unsigned)anIndex {
+    id subtemplate = [subtemplates objectAtIndex:anIndex];
+    if ([subtemplate isKindOfClass:[NSArray class]] == NO) {
+         subtemplate = [[SKTemplateParser 
arrayByParsingTemplateString:subtemplate] retain];
+        [subtemplates replaceObjectAtIndex:anIndex withObject:subtemplate];
+    }
+    return subtemplate;
+}
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichConditionTemplateTag
+
+- (NSArray *)subtemplateAtIndex:(unsigned)anIndex {
+    id subtemplate = [subtemplates objectAtIndex:anIndex];
+    if ([subtemplate isKindOfClass:[NSArray class]] == NO) {
+        subtemplate = [[SKTemplateParser 
arrayByParsingTemplateAttributedString:subtemplate] retain];
+        [subtemplates replaceObjectAtIndex:anIndex withObject:subtemplate];
+    }
+    return subtemplate;
+}
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKTextTemplateTag
+
+- (id)initWithText:(NSString *)aText {
+    if (self = [super init]) {
+        text = [aText retain];
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [text release];
+    [super dealloc];
+}
+
+- (SKTemplateTagType)type { return SKTextTemplateTagType; }
+
+- (NSString *)text {
+    return text;
+}
+
+- (void)setText:(NSString *)newText {
+    if (text != newText) {
+        [text release];
+        text = [newText retain];
+    }
+}
+
[EMAIL PROTECTED]
+
+#pragma mark -
+
[EMAIL PROTECTED] SKRichTextTemplateTag
+
+- (id)initWithAttributedText:(NSAttributedString *)anAttributedText {
+    if (self = [super init]) {
+        attributedText = [anAttributedText retain];
+    }
+    return self;
+}
+
+- (void)dealloc {
+    [attributedText release];
+    [super dealloc];
+}
+
+- (SKTemplateTagType)type { return SKTextTemplateTagType; }
+
+- (NSAttributedString *)attributedText {
+    return attributedText;
+}
+
+- (void)setAttributedText:(NSAttributedString *)newAttributedText {
+    if (attributedText != newAttributedText) {
+        [attributedText release];
+        attributedText = [newAttributedText retain];
+    }
+}
+
[EMAIL PROTECTED]

Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj        2008-08-04 17:00:56 UTC (rev 
4349)
+++ trunk/Skim.xcodeproj/project.pbxproj        2008-08-04 17:29:46 UTC (rev 
4350)
@@ -155,7 +155,7 @@
                CE816B040D71963B008D807D /* Quartz.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 455989F70B2662FF00E5419B /* Quartz.framework */; 
};
                CE816B0E0D719700008D807D /* Skim-Leopard.bundle in Resources */ 
= {isa = PBXBuildFile; fileRef = CE816AAB0D71958F008D807D /* 
Skim-Leopard.bundle */; };
                CE820A220C8A0E310020E6B0 /* NSTask_SKExtensions.m in Sources */ 
= {isa = PBXBuildFile; fileRef = CE820A200C8A0E310020E6B0 /* 
NSTask_SKExtensions.m */; };
-               CE8978CE0CBFC70B00EA2D98 /* SKTag.m in Sources */ = {isa = 
PBXBuildFile; fileRef = CE8978CC0CBFC70B00EA2D98 /* SKTag.m */; };
+               CE8978CE0CBFC70B00EA2D98 /* SKTemplateTag.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE8978CC0CBFC70B00EA2D98 /* SKTemplateTag.m */; 
};
                CE898F060C843A8B008A0856 /* PDFDDocument.icns in Resources */ = 
{isa = PBXBuildFile; fileRef = CE898F050C843A8B008A0856 /* PDFDDocument.icns 
*/; };
                CE8B46E90C29CA00005CE7F1 /* SKLineInspector.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE8B46E70C29CA00005CE7F1 /* SKLineInspector.m 
*/; };
                CE8B46F00C29CA3D005CE7F1 /* LineInspector.nib in Resources */ = 
{isa = PBXBuildFile; fileRef = CE8B46EA0C29CA3D005CE7F1 /* LineInspector.nib 
*/; };
@@ -722,8 +722,8 @@
                CE820A1F0C8A0E310020E6B0 /* NSTask_SKExtensions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
NSTask_SKExtensions.h; sourceTree = "<group>"; };
                CE820A200C8A0E310020E6B0 /* NSTask_SKExtensions.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= NSTask_SKExtensions.m; sourceTree = "<group>"; };
                CE87EF690BA9FF5A0027BBDD /* skimhelp.css */ = {isa = 
PBXFileReference; explicitFileType = text; fileEncoding = 30; name = 
skimhelp.css; path = "English.lproj/Skim Help/sty/skimhelp.css"; sourceTree = 
"<group>"; };
-               CE8978CB0CBFC70B00EA2D98 /* SKTag.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
SKTag.h; sourceTree = "<group>"; };
-               CE8978CC0CBFC70B00EA2D98 /* SKTag.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= SKTag.m; sourceTree = "<group>"; };
+               CE8978CB0CBFC70B00EA2D98 /* SKTemplateTag.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
SKTemplateTag.h; sourceTree = "<group>"; };
+               CE8978CC0CBFC70B00EA2D98 /* SKTemplateTag.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= SKTemplateTag.m; sourceTree = "<group>"; };
                CE898F050C843A8B008A0856 /* PDFDDocument.icns */ = {isa = 
PBXFileReference; lastKnownFileType = image.icns; name = PDFDDocument.icns; 
path = Images/PDFDDocument.icns; sourceTree = "<group>"; };
                CE8B46E60C29CA00005CE7F1 /* SKLineInspector.h */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = 
SKLineInspector.h; sourceTree = "<group>"; };
                CE8B46E70C29CA00005CE7F1 /* SKLineInspector.m */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; 
path = SKLineInspector.m; sourceTree = "<group>"; };
@@ -1362,8 +1362,8 @@
                                CE2DE4910B85D48F00D0DA12 /* SKThumbnail.m */,
                                CEF7117C0B90B58E003A2771 /* SKVersionNumber.h 
*/,
                                CEF7117D0B90B58E003A2771 /* SKVersionNumber.m 
*/,
-                               CE8978CB0CBFC70B00EA2D98 /* SKTag.h */,
-                               CE8978CC0CBFC70B00EA2D98 /* SKTag.m */,
+                               CE8978CB0CBFC70B00EA2D98 /* SKTemplateTag.h */,
+                               CE8978CC0CBFC70B00EA2D98 /* SKTemplateTag.m */,
                                CEE54DEF0DA2EF0E0037169F /* 
SKPDFAnnotationTemporary.h */,
                                CEE54DF00DA2EF0E0037169F /* 
SKPDFAnnotationTemporary.m */,
                                CE3366DD0E28BCFA005F99E6 /* SKPDFSyncRecord.h 
*/,
@@ -2074,7 +2074,7 @@
                                CE20B1950C9F23CC007C72F9 /* 
NSView_SKExtensions.m in Sources */,
                                CEAE1C480CA1877F00849B0F /* 
SKSecondaryPDFView.m in Sources */,
                                CEAE39070CA43E7300849B0F /* SKSheetController.m 
in Sources */,
-                               CE8978CE0CBFC70B00EA2D98 /* SKTag.m in Sources 
*/,
+                               CE8978CE0CBFC70B00EA2D98 /* SKTemplateTag.m in 
Sources */,
                                CEBF85E20CCE2DE70057A050 /* 
NSAffineTransform_SKExtensions.m in Sources */,
                                CE6C96B20CD925550022D69F /* 
SKNotesPanelController.m in Sources */,
                                CE2A1E630CE513E400A0499B /* RemoteControl.m in 
Sources */,


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to