From: Didier "Ptitjes Date: Tue, 20 Oct 2009 12:43:53 +0000 (+0200) Subject: Html: Don't wrap html source in signatures X-Git-Tag: 0.37.1~3^2~533 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9bf56bd0c458451cf0ac22d9424c0ffc212cb09;p=thirdparty%2Fvala.git Html: Don't wrap html source in signatures --- diff --git a/src/doclets/htmlhelpers/doclet/doclet.vala b/src/doclets/htmlhelpers/doclet/doclet.vala index d439b3032..d22810729 100755 --- a/src/doclets/htmlhelpers/doclet/doclet.vala +++ b/src/doclets/htmlhelpers/doclet/doclet.vala @@ -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) { diff --git a/src/doclets/htmlhelpers/doclet/markupwriter.vala b/src/doclets/htmlhelpers/doclet/markupwriter.vala index 60681e919..3ed3a49a5 100755 --- a/src/doclets/htmlhelpers/doclet/markupwriter.vala +++ b/src/doclets/htmlhelpers/doclet/markupwriter.vala @@ -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;