- if (*i == '[' && strchr(i, ']')) {
-
- if (strchr(i, ']')[1] == '(') {// url in pandoc style
- i++;
- // turn higlighting and underlining on
- if (colors)
- wattron(window, COLOR_PAIR(CP_BLUE));
- wattron(window, A_UNDERLINE);
-
- start_link_name = i;
-
- // print the content of the label
- // the label is printed as is
- do {
- wprintw(window, "%c", *i);
- i++;
- } while (*i != ']');
-
- length_link_name = i - 1 - start_link_name;
-
- i++;
- i++;
-
- start_url = i;
-
- while (*i != ')') i++;
-
- url_num = url_add(start_link_name, length_link_name, start_url, i - start_url, 0,0);
-
- wprintw(window, "[%d]", url_num);
- // turn highlighting and undelining off
- wattroff(window, A_UNDERLINE);
- wattron(window, COLOR_PAIR(CP_WHITE));
- } else wprintw(window, "[");
- } else switch(*i) {
+ // url in pandoc style
+ if ((*i == '[' && strchr(i, ']')) ||
+ (*i == '!' && *(i + 1) == '[' && strchr(i, ']'))) {
+
+ if (*i == '!') i++;
+
+ if (strchr(i, ']')[1] == '(') {
+ i++;
+
+ // turn higlighting and underlining on
+ if (colors)
+ wattron(window, COLOR_PAIR(CP_BLUE));
+ wattron(window, A_UNDERLINE);
+
+ start_link_name = i;
+
+ // print the content of the label
+ // the label is printed as is
+ do {
+ wprintw(window, "%c", *i);
+ i++;
+ } while (*i != ']');
+
+ length_link_name = i - 1 - start_link_name;
+
+ i++;
+ i++;
+
+ start_url = i;
+
+ while (*i != ')') i++;
+
+ url_num = url_add(start_link_name, length_link_name, start_url, i - start_url, 0,0);
+
+ wprintw(window, " [%d]", url_num);
+
+ // turn highlighting and underlining off
+ wattroff(window, A_UNDERLINE);
+ wattron(window, COLOR_PAIR(CP_WHITE));
+
+ } else {
+ wprintw(window, "[");
+ }
+
+ } else switch(*i) {