diff --git a/src/gemgui.c b/src/gemgui.c index e7efbd8..7f25bee 100644 --- a/src/gemgui.c +++ b/src/gemgui.c @@ -2,6 +2,7 @@ #include "../include/gemgui.h" void linkAction (GtkWidget *widget, gpointer data); +extern char links[1024][20]; void addH1 (GtkWidget *root, diff --git a/src/gemparse.c b/src/gemparse.c index 84f1e4e..594bd4d 100644 --- a/src/gemparse.c +++ b/src/gemparse.c @@ -24,6 +24,7 @@ int parseFile (char *path); #else extern GtkWidget *render; +extern char links[1024][20]; #endif @@ -32,6 +33,9 @@ parseFile (char *path) { FILE *fileToParse = fopen (path, "r"); char line[4096]; +#ifndef TESTGEMPARSE + int linkNumber = 0; +#endif if (fileToParse == NULL) { @@ -125,12 +129,16 @@ parseFile (char *path) while (beginText < size && line[beginText] == ' ') beginText++; +#ifndef TESTGEMPARSE + strcpy (links[linkNumber], line + beginUrl); +#endif + //If not text, text = url if (beginText == size) #ifdef TESTGEMPARSE - addLink (line + beginUrl, line + beginUrl); + addLink (line + beginUrl, links[linkNumber]); #else - addLink (render, line + beginUrl, line + beginUrl); + addLink (render, links[linkNumber], links[linkNumber]); #endif else { @@ -140,9 +148,13 @@ parseFile (char *path) #ifdef TESTGEMPARSE addLink (line + beginUrl, line + beginText); #else - addLink (render, line + beginUrl, line + beginText); + addLink (render, links[linkNumber], line + beginText); #endif } + +#ifndef TESTGEMPARSE + linkNumber++; +#endif } else if (size > 3 && line[0] == '`' && line[1] == '`' && line[2] == '`') { diff --git a/src/main.c b/src/main.c index 2387aca..5b4ea5f 100644 --- a/src/main.c +++ b/src/main.c @@ -5,6 +5,7 @@ GtkEntryBuffer *pathBarContent = NULL; GtkWidget *render = NULL; GtkWidget *scrollbar = NULL; +char links[1024][20]; static void loadPage (const char *link)