[valadoc] libvaladoc: Allow to inherit documentation from other packages. (#629531)



commit c0a40c8048be1c7f8aa6ee32efae222e8c865d8a
Author: Florian Brosch <flo brosch gmail com>
Date:   Thu Oct 28 19:36:57 2010 +0200

    libvaladoc: Allow to inherit documentation from other packages. (#629531)

 src/libvaladoc/api/tree.vala                 |   17 +++++++++++++----
 src/libvaladoc/taglets/tagletinheritdoc.vala |    6 +++++-
 2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala
index 2bcb5a9..f65d9a2 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<Node> unbrowsable_documentation_dependencies = new LinkedList<Node>();
 	private ArrayList<Package> packages = new ArrayList<Package>();
 	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<Package> deplst = new ArrayList<Package> ();
@@ -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 7105430..4f4568f 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]