From: Florian Brosch Date: Thu, 28 Oct 2010 17:36:57 +0000 (+0200) Subject: libvaladoc: Allow to inherit documentation from other packages. (#629531) X-Git-Tag: 0.37.1~3^2~413 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0a40c8048be1c7f8aa6ee32efae222e8c865d8a;p=thirdparty%2Fvala.git libvaladoc: Allow to inherit documentation from other packages. (#629531) --- diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala index 2bcb5a971..f65d9a20f 100644 --- a/src/libvaladoc/api/tree.vala +++ b/src/libvaladoc/api/tree.vala @@ -28,6 +28,7 @@ private Valadoc.Api.Class glib_error = null; public class Valadoc.Api.Tree { + private Deque unbrowsable_documentation_dependencies = new LinkedList(); private ArrayList packages = new ArrayList(); private Package source_package = null; private Settings settings; @@ -49,6 +50,10 @@ public class Valadoc.Api.Tree { return this.packages.read_only_view; } + internal bool push_unbrowsable_documentation_dependency (Api.Node node) { + return unbrowsable_documentation_dependencies.offer_head (node); + } + private void add_dependencies_to_source_package () { if ( this.source_package != null ) { ArrayList deplst = new ArrayList (); @@ -188,8 +193,7 @@ public class Valadoc.Api.Tree { if (!add_package ("posix")) { Vala.Report.error (null, "posix not found in specified Vala API directories"); } - } - else if (context.profile == Vala.Profile.GOBJECT) { + } else if (context.profile == Vala.Profile.GOBJECT) { int glib_major = 2; int glib_minor = 12; @@ -405,14 +409,19 @@ public class Valadoc.Api.Tree { // TODO Rename to process_comments public void parse_comments (DocumentationParser docparser) { - // TODO Move Wiki tree parse to Package process_wiki (docparser); foreach (Package pkg in this.packages) { if (pkg.is_browsable (settings)) { - pkg.process_comments(settings, docparser); + pkg.process_comments (settings, docparser); } } + + // parse inherited non-public comments + while (!this.unbrowsable_documentation_dependencies.is_empty) { + var node = this.unbrowsable_documentation_dependencies.poll_head (); + node.process_comments (settings, docparser); + } } public void import_documentation (DocumentationImporter[] importers, string[] packages, string[] import_directories) { diff --git a/src/libvaladoc/taglets/tagletinheritdoc.vala b/src/libvaladoc/taglets/tagletinheritdoc.vala index 710543046..4f4568faa 100755 --- a/src/libvaladoc/taglets/tagletinheritdoc.vala +++ b/src/libvaladoc/taglets/tagletinheritdoc.vala @@ -44,6 +44,10 @@ public class Valadoc.Taglets.InheritDoc : InlineTaglet { _inherited = (Api.Node) ((Api.Struct) container).base_type.data_type; } + if (_inherited != null) { + api_root.push_unbrowsable_documentation_dependency (_inherited); + } + // TODO report error if inherited is null // TODO postpone check after complete parse of the api tree comments @@ -52,7 +56,7 @@ public class Valadoc.Taglets.InheritDoc : InlineTaglet { } public override ContentElement produce_content () { - if (_inherited != null) { + if (_inherited != null && _inherited.documentation != null) { Paragraph inherited_paragraph = _inherited.documentation.content.get (0) as Paragraph; Run paragraph = new Run (Run.Style.NONE);