]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Html: Don't wrap html source in signatures
authorDidier "Ptitjes <ptitjes@free.fr>
Tue, 20 Oct 2009 12:43:53 +0000 (14:43 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Tue, 20 Oct 2009 12:43:53 +0000 (14:43 +0200)
src/doclets/htmlhelpers/doclet/doclet.vala
src/doclets/htmlhelpers/doclet/markupwriter.vala

index d439b3032a87824bacb90b9ddfa3a3a8b671d0ca..d228107298b82f5f0a71180303a8b361eab0b5b8 100755 (executable)
@@ -276,8 +276,10 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
        }
 
        private void write_signature (Api.Node element , Api.Node? pos) {
+               writer.set_source_wrap (false);
                _renderer.set_container (pos);
                _renderer.render (element.signature);
+               writer.set_source_wrap (true);
        }
 
        protected bool is_internal_node (Api.Node node) {
index 60681e919fc9ccc6469f8c89f0d8116d1a37fa35..3ed3a49a564a4c7785e8f0e535e2b0eb88cfeabb 100755 (executable)
@@ -29,6 +29,7 @@ public class Valadoc.Html.MarkupWriter {
        private int indent;
        private long current_column = 0;
        private bool last_was_tag;
+       private bool wrap = true;
 
        private const int MAX_COLUMN = 150;
 
@@ -119,7 +120,7 @@ public class Valadoc.Html.MarkupWriter {
        }
 
        public MarkupWriter text (string text) {
-               if (text.length + current_column > MAX_COLUMN) {
+               if (wrap && text.length + current_column > MAX_COLUMN) {
                        long wrote = 0;
                        while (wrote < text.length) {
                                long space_pos = -1;
@@ -158,14 +159,18 @@ public class Valadoc.Html.MarkupWriter {
                return this;
        }
 
-       public void break_line () {
+       public void set_source_wrap (bool wrap) {
+               this.wrap = wrap;
+       }
+
+       private void break_line () {
                stream.printf ("\n");
                stream.printf (string.nfill (indent * 2, ' '));
                current_column = indent * 2;
        }
 
-       public void do_write (string text) {
-               if (current_column + text.length > MAX_COLUMN) {
+       private void do_write (string text) {
+               if (wrap && current_column + text.length > MAX_COLUMN) {
                        break_line ();
                }
                stream.printf (text);
@@ -173,7 +178,9 @@ public class Valadoc.Html.MarkupWriter {
        }
 
        private void check_column (string name, bool end_tag = false) {
-               if (!end_tag && inline (name) && !last_was_tag) {
+               if (!wrap) {
+                       return;
+               } else if (!end_tag && inline (name) && !last_was_tag) {
                        return;
                } else if (end_tag && content_inline (name)) {
                        return;