diff --git a/main.c b/main.c index 2430311..808492d 100644 --- a/main.c +++ b/main.c @@ -105,6 +105,31 @@ int fpportal(FILE* f, Lexicon* l, char* s, int head) { return 1; } +int fphref(FILE* f, char* s) { + char href[1024] = {0}; + char txt[1024] = {0}; + + char* c = s; + int i = 0; + while (i < 2) { + if (*c == '|' || !(*c)) { + i++; + c++; + continue; + } + switch (i) { + case 0: + ccat(href, *c++); + break; + case 1: + ccat(txt, *c++); + break; + } + } + fprintf(f, "%s", href, txt); + return 1; +} + int fpimg(FILE* f, char* s) { char id[1024] = {0}; char src[1024] = {0}; @@ -137,7 +162,7 @@ int fpimg(FILE* f, char* s) { return 1; } -int fpimgl(FILE* f, char* s) { +int fphimg(FILE* f, char* s) { char id[1024] = {0}; char href[1024] = {0}; char src[1024] = {0}; @@ -184,10 +209,12 @@ int fptemplate(FILE* f, Lexicon* l, char* s) { int target; if (s[0] == '/') return fpportal(f, l, s + 1, 1); + if (s[0] == '*') + return fphref(f, s + 1); if (s[0] == ':') return fpimg(f, s + 1); if (s[0] == '?') - return fpimgl(f, s + 1); + return fphimg(f, s + 1); if (s[0] == '_') return fpaudio(f, s + 1); target = findf(l, s);