]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
gtkdoc-renderer: Fix broken escapes
authorFlorian Brosch <flo.brosch@gmail.com>
Tue, 7 Feb 2012 15:20:12 +0000 (16:20 +0100)
committerFlorian Brosch <flo.brosch@gmail.com>
Tue, 7 Feb 2012 15:20:12 +0000 (16:20 +0100)
src/libvaladoc/gtkdocrenderer.vala
src/libvaladoc/markupwriter.vala

index 332dd33222c52f509c93333a7928f3b7c4d0ed80..eb4fe6840dbacf1e5c0bb9118f7f3f2056a86465 100644 (file)
@@ -312,59 +312,75 @@ public class Valadoc.GtkdocRenderer : ContentRenderer {
 
                for (i = 0; chr != '\0' ; i++, chr = content[i]) {
                        switch (chr) {
-                       case '#':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.simple_tag ("&num;");
+                       case '<':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&lt;");
                                lpos = i+1;
                                break;
-                       case '%':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.simple_tag ("&percnt;");
+
+                       case '>':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&gt;");
                                lpos = i+1;
                                break;
-                       case '@':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.simple_tag ("&commat;");
+
+                       case '"':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&quot;");
                                lpos = i+1;
                                break;
-                       case '(':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.simple_tag ("&lpar;");
+
+                       case '\'':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&apos;");
                                lpos = i+1;
                                break;
-                       case ')':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.simple_tag ("&rpar;");
+
+                       case '&':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&amp;");
                                lpos = i+1;
                                break;
-                       case '"':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.simple_tag ("&quot;");
+
+                       case '#':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&num;");
                                lpos = i+1;
                                break;
-                       case '\n':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.simple_tag ("br");
+
+                       case '%':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&percnt;");
                                lpos = i+1;
                                break;
-                       case '<':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.text ("&lt;");
+
+                       case '@':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&commat;");
                                lpos = i+1;
                                break;
-                       case '>':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.text ("&gt;");
+
+                       case '(':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&lpar;");
                                lpos = i+1;
                                break;
-                       case '&':
-                               writer.text (content.substring (lpos, i-lpos));
-                               writer.text ("&amp;");
+
+                       case ')':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.raw_text ("&rpar;");
+                               lpos = i+1;
+                               break;
+
+                       case '\n':
+                               writer.raw_text (content.substring (lpos, i-lpos));
+                               writer.simple_tag ("br");
                                lpos = i+1;
                                break;
                        }
                }
-               writer.text (content.substring (lpos, i-lpos));
+
+               writer.raw_text (content.substring (lpos, i-lpos));
        }
 
        public void append_since (Gee.List<Content.Taglet> taglets) {
index d463d0eb359448876ccd54752b5e5ff2a074c48c..ae0e56cc097064c1a687633b16e017192acfdd0d 100755 (executable)
@@ -63,6 +63,12 @@ public class Valadoc.MarkupWriter {
                                builder.append ("&amp;");
                                start = pos.next_char ();
                                break;
+
+                       case '\'':
+                               builder.append_len (start, (ssize_t) ((char*) pos - (char*) start));
+                               builder.append ("&apos;");
+                               start = pos.next_char ();
+                               break;
                        }
                }