jjacky avatar jjacky committed 0102e26

news: html parser now process −, ‘, ’, &, < and >

Comments (0)

Files changed (1)

         start = ss + 4;
         memmove (++ss, start, strlen (start) + 1);
     }
-    while ((ss = strstr (s, """)))
+    /* convert some HTML stuff */
+    ss = s;
+    while ((ss = strchr (ss, '&')))
     {
-        *ss = '"';
-        start = ss + 6;
-        memmove (++ss, start, strlen (start) + 1);
+        end = strchr (++ss, ';');
+        if (!end)
+        {
+            break;
+        }
+        *end = '\0';
+        if (strcmp (ss, "minus") == 0)
+        {
+            *--ss = '-';
+            ++end;
+            memmove (++ss, end, strlen (end) + 1);
+        }
+        else if (strcmp (ss, "lsquo") == 0)
+        {
+            *--ss = '`';
+            ++end;
+            memmove (++ss, end, strlen (end) + 1);
+        }
+        else if (strcmp (ss, "rsquo") == 0)
+        {
+            *--ss = '\'';
+            ++end;
+            memmove (++ss, end, strlen (end) + 1);
+        }
+        else if (strcmp (ss, "quot") == 0)
+        {
+            *--ss = '"';
+            ++end;
+            memmove (++ss, end, strlen (end) + 1);
+        }
+        else if (strcmp (ss, "amp") == 0)
+        {
+            *--ss = '&';
+            ++end;
+            memmove (++ss, end, strlen (end) + 1);
+        }
+        else if (strcmp (ss, "lt") == 0)
+        {
+            *--ss = '<';
+            *end = '>';
+        }
+        else if (strcmp (ss, "gt") == 0)
+        {
+            *--ss = '<';
+            *end = '>';
+        }
+        else
+        {
+            *end = ';';
+            ss = end + 1;
+        }
     }
     
     gtk_text_buffer_get_end_iter (buffer, &iter);
     GtkWidget     *window;
     GtkWidget     *textview;
     GtkTextBuffer *buffer;
-    gchar         *text, *t, *s, *e;
+    gchar         *text, *t, *s;
     
     new_window (FALSE, &window, &textview);
     gtk_window_set_title (GTK_WINDOW (window), "Help - kalu");
         text = s + 4;
     }
     
-    /* convert some HTML stuff */
-    s = text;
-    while ((s = strchr (s, '&')))
-    {
-        e = strchr (++s, ';');
-        if (!e)
-        {
-            break;
-        }
-        *e = '\0';
-        if (strcmp (s, "minus") == 0)
-        {
-            *--s = '-';
-            ++e;
-            memmove (++s, e, strlen (e) + 1);
-        }
-        else if (strcmp (s, "lsquo") == 0)
-        {
-            *--s = '`';
-            ++e;
-            memmove (++s, e, strlen (e) + 1);
-        }
-        else if (strcmp (s, "rsquo") == 0)
-        {
-            *--s = '\'';
-            ++e;
-            memmove (++s, e, strlen (e) + 1);
-        }
-        else if (strcmp (s, "quot") == 0)
-        {
-            *--s = '"';
-            ++e;
-            memmove (++s, e, strlen (e) + 1);
-        }
-        else if (strcmp (s, "amp") == 0)
-        {
-            *--s = '&';
-            ++e;
-            memmove (++s, e, strlen (e) + 1);
-        }
-        else if (strcmp (s, "lt") == 0)
-        {
-            *--s = '<';
-            *e = '>';
-        }
-        else if (strcmp (s, "gt") == 0)
-        {
-            *--s = '<';
-            *e = '>';
-        }
-        else
-        {
-            *e = ';';
-            s = e + 1;
-        }
-    }
-    
     create_tags (buffer);
     parse_to_buffer (buffer, text, (gsize) strlen (text));
     g_free (t);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.