src/highlighter.c

changeset 57
eba880c1705c
parent 55
bf54085ce341
child 61
47a5fc33590a
child 66
1b12cf799fee
--- a/src/highlighter.c	Wed Aug 31 14:47:01 2016 +0200
+++ b/src/highlighter.c	Wed Aug 31 16:20:58 2016 +0200
@@ -73,9 +73,12 @@
 
 /* Plaintext Highlighter */
 
-void c2html_plain_highlighter(char *src, UcxBuffer *dest, c2html_highlighter_data *hd) {
+void c2html_plain_highlighter(char *src, UcxBuffer *dest,
+        c2html_highlighter_data *hd) {
     while (*src && *src != '\n') {
-        put_htmlescaped(dest, *src);
+        if (*src != '\r') {
+            put_htmlescaped(dest, *src);
+        }
         src++;
     }
     ucx_buffer_putc(dest, '\n');
@@ -91,7 +94,8 @@
     "while", NULL
 };
 
-void c2html_c_highlighter(char *src, UcxBuffer *dest, c2html_highlighter_data *hd) {
+void c2html_c_highlighter(char *src, UcxBuffer *dest,
+        c2html_highlighter_data *hd) {
     /* reset buffers without clearing them */
     hd->primary_buffer->size = hd->primary_buffer->pos = 0;
     hd->secondary_buffer->size = hd->secondary_buffer->pos = 0;
@@ -115,6 +119,7 @@
     char c;
     do {
         c = src[++sp];
+        if (c == '\r') continue;
         
         /* comments */
         if (!isstring && c == '/') {
@@ -234,7 +239,8 @@
     "volatile", "const", "float", "native", "super", "while", NULL
 };
 
-void c2html_java_highlighter(char *src, UcxBuffer *dest, c2html_highlighter_data *hd) {
+void c2html_java_highlighter(char *src, UcxBuffer *dest,
+        c2html_highlighter_data *hd) {
     /* reset buffers without clearing them */
     hd->primary_buffer->size = hd->primary_buffer->pos = 0;
     hd->secondary_buffer->size = hd->secondary_buffer->pos = 0;
@@ -256,6 +262,7 @@
     char c;
     do {
         c = src[++sp];
+        if (c == '\r') continue;
         
         /* comments */
         if (!isstring && c == '/') {

mercurial