]> granicus.if.org Git - graphviz/commitdiff
Fix html style attribute to accept both rounded and radial
authorEmden Gansner <erg@research.att.com>
Thu, 26 Jan 2012 17:29:49 +0000 (12:29 -0500)
committerEmden Gansner <erg@research.att.com>
Thu, 26 Jan 2012 17:29:49 +0000 (12:29 -0500)
lib/common/htmllex.c

index 116400fd2d46fb587c83b3de763ed92e558b75b1..068c651a79b20da8319f5c2ca1f1e067600dcece 100644 (file)
@@ -135,22 +135,30 @@ static int portfn(htmldata_t * p, char *v)
     return 0;
 }
 
+#define DELIM " ,"
+
 static int stylefn(htmldata_t * p, char *v)
 {
     int rv = 0;
-    char c = toupper(*v);
-    if (c == 'R') {
-       if (!strcasecmp(v + 1, "OUNDED")) p->style |= ROUNDED;
-       else if (!strcasecmp(v + 1, "ADIAL")) p->style |= RADIAL;
+    char c;
+    char* tk;
+    char* buf = strdup (v);
+    for (tk = strtok (buf, DELIM); tk; tk = strtok (NULL, DELIM)) {
+       c = toupper(*tk);
+       if (c == 'R') {
+           if (!strcasecmp(tk + 1, "OUNDED")) p->style |= ROUNDED;
+           else if (!strcasecmp(tk + 1, "ADIAL")) p->style |= RADIAL;
+           else {
+               agerr(AGWARN, "Illegal value %s for STYLE - ignored\n", tk);
+               rv = 1;
+           }
+       }
        else {
-           agerr(AGWARN, "Illegal value %s for STYLE - ignored\n", v);
+           agerr(AGWARN, "Illegal value %s for STYLE - ignored\n", tk);
            rv = 1;
        }
     }
-    else {
-       agerr(AGWARN, "Illegal value %s for STYLE - ignored\n", v);
-       rv = 1;
-    }
+    free (buf);
     return rv;
 }