summaryrefslogtreecommitdiff
path: root/tikzit/src/common/GraphElementProperty.m
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@cs.ox.ac.uk>2012-05-29 16:10:59 +0100
committerAlex Merry <alex.merry@cs.ox.ac.uk>2012-05-29 16:10:59 +0100
commit96bb49b438646b54f1a667a66a9bb1b2c27d7b4f (patch)
tree4f617b1466645c730b2b939f8b15cf47042ac773 /tikzit/src/common/GraphElementProperty.m
parentadb00e5861d749d073f42b18eb4c16dd0e893a07 (diff)
Fix handling for property values containing = or ,
Equals and comma are special values that need to be quoted with curly braces. This both parses and generates such quoted strings, although they are only generated when necessary.
Diffstat (limited to 'tikzit/src/common/GraphElementProperty.m')
-rw-r--r--tikzit/src/common/GraphElementProperty.m10
1 files changed, 9 insertions, 1 deletions
diff --git a/tikzit/src/common/GraphElementProperty.m b/tikzit/src/common/GraphElementProperty.m
index 9751230..4b47ca6 100644
--- a/tikzit/src/common/GraphElementProperty.m
+++ b/tikzit/src/common/GraphElementProperty.m
@@ -118,7 +118,15 @@
} else if ([self isKeyMatch]) {
return [NSString stringWithFormat:@"%@=*", [self key]];
} else {
- return [NSString stringWithFormat:@"%@=%@", [self key], [self value]];
+ static NSCharacterSet *avoid = nil;
+ if (avoid == nil)
+ avoid = [[NSCharacterSet characterSetWithCharactersInString:@",="] retain];
+
+ if ([[self value] rangeOfCharacterFromSet:avoid].length > 0) {
+ return [NSString stringWithFormat:@"%@={%@}", [self key], [self value]];
+ } else {
+ return [NSString stringWithFormat:@"%@=%@", [self key], [self value]];
+ }
}
}