[valadoc] doclets/gtkdoc: Fix [Deprecated]



commit 9d7827a824e958123bd43df53d8d3019decd4b3d
Author: Florian Brosch <flo brosch gmail com>
Date:   Sat Aug 18 03:00:43 2012 +0200

    doclets/gtkdoc: Fix [Deprecated]

 src/doclets/gtkdoc/generator.vala |    6 +++---
 src/doclets/gtkdoc/utils.vala     |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 3 deletions(-)
---
diff --git a/src/doclets/gtkdoc/generator.vala b/src/doclets/gtkdoc/generator.vala
index 4c929ab..75b3b1e 100644
--- a/src/doclets/gtkdoc/generator.vala
+++ b/src/doclets/gtkdoc/generator.vala
@@ -998,7 +998,7 @@ It is important that your <link linkend=\"GValue\"><type>GValue</type></link> ho
 					replacement_symbol_name = replacement_symbol_name[0:-2];
 				}
 
-				replacement_symbol = current_tree.search_symbol_str (sym, replacement.value);
+				replacement_symbol = current_tree.search_symbol_str (sym, replacement_symbol_name);
 			}
 
 			if (replacement != null && replacement_symbol == null) {
@@ -1008,11 +1008,11 @@ It is important that your <link linkend=\"GValue\"><type>GValue</type></link> ho
 			var deprecation_string = "No replacement specified.";
 
 			if (since != null && replacement_symbol != null) {
-				deprecation_string = "%s: Replaced by %s.".printf (since, get_docbook_link (replacement_symbol));
+				deprecation_string = "%s: Replaced by %s.".printf (since, get_gtkdoc_link (replacement_symbol));
 			} else if (since != null && replacement_symbol == null) {
 				deprecation_string = "%s: No replacement specified.".printf (since);
 			} else if (since == null && replacement_symbol != null) {
-				deprecation_string = "Replaced by %s.".printf (get_docbook_link (replacement_symbol));
+				deprecation_string = "Replaced by %s.".printf (get_gtkdoc_link (replacement_symbol));
 			} else {
 				reporter.simple_warning ("Missing âsinceâ and âreplacementâ arguments to âDeprecatedâ attribute on %s.", sym.get_full_name ());
 			}
diff --git a/src/doclets/gtkdoc/utils.vala b/src/doclets/gtkdoc/utils.vala
index 9bd2df5..93037d6 100644
--- a/src/doclets/gtkdoc/utils.vala
+++ b/src/doclets/gtkdoc/utils.vala
@@ -60,6 +60,8 @@ namespace Gtkdoc {
 			return ((Api.Delegate)item).get_cname ();
 		} else if (item is Api.Enum) {
 			return ((Api.Enum)item).get_cname ();
+		} else if (item is Api.EnumValue) {
+			return ((Api.EnumValue)item).get_cname ();
 		}
 		return null;
 	}
@@ -77,6 +79,39 @@ namespace Gtkdoc {
 		return """<link linkend="%s:CAPS"><literal>%s</literal></link>""".printf (to_docbook_id (cls.get_type_id ()), cls.get_type_id ());
 	}
 
+	public string? get_gtkdoc_link (Api.Node symbol) {
+		if (symbol is Class || symbol is Interface || symbol is Struct || symbol is Enum || symbol is ErrorDomain) {
+			return "#%s".printf (get_cname (symbol));
+		}
+
+		if (symbol is Method) {
+			return "%s ()".printf (((Method) symbol).get_cname ());
+		}
+
+		if (symbol is Constant || symbol is Api.EnumValue || symbol is ErrorCode) {
+			return "%%%s".printf (get_cname (symbol));
+		}
+
+		if (symbol is Api.Signal) {
+			return "#%s::%s".printf (get_cname (symbol.parent), ((Api.Signal) symbol).get_cname ());
+		}
+
+		if (symbol is Property) {
+			return "#%s:%s".printf (get_cname (symbol.parent), ((Property) symbol).get_cname ());
+		}
+
+		if (symbol is Field && (symbol.parent is Class || symbol.parent is Struct)) {
+			var field = symbol as Field;
+			if (field.is_static) {
+				return field.get_cname ();
+			} else {
+				return "#%s.%s".printf (get_cname (symbol.parent), field.get_cname ());
+			}
+		}
+
+		return get_cname (symbol) ?? symbol.get_full_name ();
+	}
+
 	public string? get_docbook_link (Api.Item item, bool is_dbus = false, bool is_async_finish = false) {
 		if (item is Api.Method) {
 			string name;



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