]> git.wincent.com - wikitext.git/commitdiff
Collapse a conditional in EXT_LINK_START case
authorWincent Colaiuta <win@wincent.com>
Mon, 11 May 2009 20:45:12 +0000 (22:45 +0200)
committerWincent Colaiuta <win@wincent.com>
Mon, 11 May 2009 20:45:12 +0000 (22:45 +0200)
This is equivalent but takes less vertical space.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
ext/parser.c

index 690eeb9a7bdf639dbfbf2ef508838faabc5be2a1..e7b2a60dd650e79573d6f639fb5569a6431472c0 100644 (file)
@@ -2309,16 +2309,10 @@ VALUE Wikitext_parser_parse(int argc, VALUE *argv, VALUE self)
                 else if (IN(LINK_START))
                 {
                     // already in internal link scope!
                 else if (IN(LINK_START))
                 {
                     // already in internal link scope!
-                    if (parser->link_target->len == 0)
-                        // this must be the first character of our link target
+                    if (parser->link_target->len == 0 || !IN(SPACE))
                         str_append(parser->link_target, ext_link_start, sizeof(ext_link_start) - 1);
                         str_append(parser->link_target, ext_link_start, sizeof(ext_link_start) - 1);
-                    else if (IN(SPACE))
-                        // link target has already been scanned
+                    else // link target has already been scanned
                         str_append(parser->link_text, ext_link_start, sizeof(ext_link_start) - 1);
                         str_append(parser->link_text, ext_link_start, sizeof(ext_link_start) - 1);
-                    else
-                        // TODO: possibly roll this condition into the above
-                        // add to existing link target
-                        str_append(parser->link_target, ext_link_start, sizeof(ext_link_start) - 1);
                 }
                 else // not in external link scope yet
                 {
                 }
                 else // not in external link scope yet
                 {