[valadoc] vala 0.7.10 migration
- From: Florian Brosch <flobrosch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [valadoc] vala 0.7.10 migration
- Date: Wed, 10 Feb 2010 01:14:40 +0000 (UTC)
commit aecc351b2110de72ad8e20b0bb6f425dfeeb968a
Author: Florian Brosch <flo brosch gmail com>
Date: Wed Feb 10 01:28:24 2010 +0100
vala 0.7.10 migration
src/doclets/devhelp/doclet.vala | 14 +-
src/doclets/htm/doclet.vala | 24 ++--
src/doclets/xml/doclet.vala | 28 +++---
src/libvaladoc/Makefile.am | 8 +-
src/libvaladoc/api/array.vala | 2 +-
src/libvaladoc/api/class.vala | 4 +-
src/libvaladoc/api/constant.vala | 2 +-
src/libvaladoc/api/delegate.vala | 2 +-
src/libvaladoc/api/enumvalue.vala | 2 +-
src/libvaladoc/api/field.vala | 2 +-
src/libvaladoc/api/formalparameter.vala | 2 +-
src/libvaladoc/api/interface.vala | 4 +-
src/libvaladoc/api/item.vala | 4 +-
src/libvaladoc/api/member.vala | 2 +-
src/libvaladoc/api/method.vala | 2 +-
src/libvaladoc/api/namespace.vala | 2 +-
src/libvaladoc/api/node.vala | 8 +-
src/libvaladoc/api/package.vala | 8 +-
src/libvaladoc/api/pointer.vala | 2 +-
src/libvaladoc/api/property.vala | 4 +-
src/libvaladoc/api/signal.vala | 2 +-
src/libvaladoc/api/struct.vala | 4 +-
src/libvaladoc/api/symbol.vala | 4 +-
src/libvaladoc/api/tree.vala | 116 +++++++++++++++++--
src/libvaladoc/api/typereference.vala | 2 +-
src/libvaladoc/api/typesymbol.vala | 2 +-
src/libvaladoc/content/blockcontent.vala | 4 +-
src/libvaladoc/content/comment.vala | 6 +-
src/libvaladoc/content/contentfactory.vala | 2 +-
src/libvaladoc/content/embedded.vala | 9 +-
src/libvaladoc/content/headline.vala | 5 +-
src/libvaladoc/content/inlinecontent.vala | 4 +-
src/libvaladoc/content/inlinetaglet.vala | 6 +-
src/libvaladoc/content/link.vala | 3 +-
src/libvaladoc/content/list.vala | 67 +++++++++++-
src/libvaladoc/content/listitem.vala | 6 +-
src/libvaladoc/content/paragraph.vala | 4 +-
src/libvaladoc/content/run.vala | 79 +++++++++++++-
src/libvaladoc/content/sourcecode.vala | 31 +++++-
src/libvaladoc/content/styleattributes.vala | 66 +++++++++++-
src/libvaladoc/content/symbollink.vala | 2 +-
src/libvaladoc/content/table.vala | 4 +-
src/libvaladoc/content/tablecell.vala | 4 +-
src/libvaladoc/content/tablerow.vala | 4 +-
src/libvaladoc/content/text.vala | 2 +-
src/libvaladoc/doclet.vala | 3 +-
.../documentation/documentationparser.vala | 6 +-
src/libvaladoc/documentation/wiki.vala | 9 +-
src/libvaladoc/html/basicdoclet.vala | 26 +++--
src/libvaladoc/html/globals.vala | 40 ++++----
src/libvaladoc/html/htmlmarkupwriter.vala | 1 +
src/libvaladoc/html/htmlrenderer.vala | 16 ++-
src/libvaladoc/moduleloader.vala | 7 +-
src/libvaladoc/settings.vala | 1 +
src/valadoc/valadoc.vala | 20 +++-
55 files changed, 524 insertions(+), 169 deletions(-)
---
diff --git a/src/doclets/devhelp/doclet.vala b/src/doclets/devhelp/doclet.vala
index 69a823a..f67dc24 100755
--- a/src/doclets/devhelp/doclet.vala
+++ b/src/doclets/devhelp/doclet.vala
@@ -182,19 +182,19 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
_devhelpwriter.start_functions ();
foreach (Api.Node node in this.nodes) {
string typekeyword = "";
- if (node is Enum) {
+ if (node is Api.Enum) {
typekeyword = "enum";
- } else if (node is Constant) {
+ } else if (node is Api.Constant) {
typekeyword = "constant";
- } else if (node is Method) {
+ } else if (node is Api.Method) {
typekeyword = "function";
- } else if (node is Field) {
+ } else if (node is Api.Field) {
typekeyword = "variable";
- } else if (node is Property) {
+ } else if (node is Api.Property) {
typekeyword = "property";
} else if (node is Api.Signal) {
typekeyword = "signal";
- } else if (node is Struct) {
+ } else if (node is Api.Struct) {
typekeyword = "struct";
}
@@ -266,7 +266,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
process_node (item);
}
- public override void visit_enum ( Enum item) {
+ public override void visit_enum (Api.Enum item) {
process_node (item);
}
diff --git a/src/doclets/htm/doclet.vala b/src/doclets/htm/doclet.vala
index 14cbf90..480d475 100755
--- a/src/doclets/htm/doclet.vala
+++ b/src/doclets/htm/doclet.vala
@@ -150,10 +150,10 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (GLib.Path.build_filename ( path, "index.htm" ), "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, pkg_name);
+// write_file_header (this.css_path, pkg_name);
write_navi_package (package);
write_package_content (package, package);
- write_file_footer ();
+// write_file_footer ();
file = null;
package.accept_all_children (this);
@@ -198,35 +198,35 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
process_node (item);
}
- public override void visit_class (Class item) {
+ public override void visit_class (Api.Class item) {
process_node (item);
}
- public override void visit_struct (Struct item) {
+ public override void visit_struct (Api.Struct item) {
process_node (item);
}
- public override void visit_error_domain (ErrorDomain item) {
+ public override void visit_error_domain (Api.ErrorDomain item) {
process_node (item);
}
- public override void visit_enum (Enum item) {
+ public override void visit_enum (Api.Enum item) {
process_node (item);
}
- public override void visit_property (Property item) {
+ public override void visit_property (Api.Property item) {
process_node (item);
}
- public override void visit_constant (Constant item) {
+ public override void visit_constant (Api.Constant item) {
process_node (item);
}
- public override void visit_field (Field item) {
+ public override void visit_field (Api.Field item) {
process_node (item);
}
- public override void visit_error_code (ErrorCode item) {
+ public override void visit_error_code (Api.ErrorCode item) {
process_node (item);
}
@@ -234,7 +234,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
process_node (item);
}
- public override void visit_delegate (Delegate item) {
+ public override void visit_delegate (Api.Delegate item) {
process_node (item);
}
@@ -242,7 +242,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
process_node (item);
}
- public override void visit_method (Method item) {
+ public override void visit_method (Api.Method item) {
process_node (item);
}
}
diff --git a/src/doclets/xml/doclet.vala b/src/doclets/xml/doclet.vala
index e496c57..dfa63cc 100755
--- a/src/doclets/xml/doclet.vala
+++ b/src/doclets/xml/doclet.vala
@@ -53,7 +53,7 @@ public class Valadoc.Xml.Doclet : Api.Visitor, Valadoc.Doclet {
}
// avoid exceptions and signal childs
- if (node is Class || node is Struct || node is Enum || node is ErrorDomain || node is Namespace) {
+ if (node is Api.Class || node is Api.Struct || node is Api.Enum || node is Api.ErrorDomain || node is Api.Namespace) {
node.accept_all_children (this);
}
@@ -64,7 +64,7 @@ public class Valadoc.Xml.Doclet : Api.Visitor, Valadoc.Doclet {
tree.accept_children (this);
}
- public override void visit_package (Package package) {
+ public override void visit_package (Api.Package package) {
string path = GLib.Path.build_filename (this.settings.path, package.name);
DirUtils.create (path, 0777);
@@ -78,43 +78,43 @@ public class Valadoc.Xml.Doclet : Api.Visitor, Valadoc.Doclet {
file = null;
}
- public override void visit_namespace (Namespace ns) {
+ public override void visit_namespace (Api.Namespace ns) {
process_node (ns, "namespace");
}
- public override void visit_interface (Interface item) {
+ public override void visit_interface (Api.Interface item) {
process_node (item, "interface");
}
- public override void visit_class (Class item) {
+ public override void visit_class (Api.Class item) {
process_node (item, "class");
}
- public override void visit_struct (Struct item) {
+ public override void visit_struct (Api.Struct item) {
process_node (item, "struct");
}
- public override void visit_error_domain (ErrorDomain item) {
+ public override void visit_error_domain (Api.ErrorDomain item) {
process_node (item, "error-domain");
}
- public override void visit_enum (Enum item) {
+ public override void visit_enum (Api.Enum item) {
process_node (item, "enum");
}
- public override void visit_property (Property item) {
+ public override void visit_property (Api.Property item) {
process_node (item, "property");
}
- public override void visit_constant (Constant item) {
+ public override void visit_constant (Api.Constant item) {
process_node (item, "constant");
}
- public override void visit_field (Field item) {
+ public override void visit_field (Api.Field item) {
process_node (item, "field");
}
- public override void visit_error_code (ErrorCode item) {
+ public override void visit_error_code (Api.ErrorCode item) {
process_node (item, "error-code");
}
@@ -122,7 +122,7 @@ public class Valadoc.Xml.Doclet : Api.Visitor, Valadoc.Doclet {
process_node (item, "enum-value");
}
- public override void visit_delegate (Delegate item) {
+ public override void visit_delegate (Api.Delegate item) {
process_node (item, "delegate");
}
@@ -130,7 +130,7 @@ public class Valadoc.Xml.Doclet : Api.Visitor, Valadoc.Doclet {
process_node (item, "signal");
}
- public override void visit_method (Method item) {
+ public override void visit_method (Api.Method item) {
process_node (item, "method");
}
}
diff --git a/src/libvaladoc/Makefile.am b/src/libvaladoc/Makefile.am
index c2cc30e..08dfaa6 100644
--- a/src/libvaladoc/Makefile.am
+++ b/src/libvaladoc/Makefile.am
@@ -1,8 +1,11 @@
NULL =
+globalvapidir = `pkg-config vala-1.0 --variable vapidir`
+
AM_CFLAGS = \
-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
+ -DPACKAGE_VAPIDIR=\"$(globalvapidir)\" \
$(LIBGVC_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
@@ -35,6 +38,9 @@ libvaladoc_la_VALASOURCES = \
documentation/documentationparser.vala \
documentation/wiki.vala \
documentation/wikiscanner.vala \
+ importer/documentationimporter.vala \
+ importer/valadocdocumentationimporter.vala \
+ importer/valamarkupreader.vala \
api/array.vala \
api/class.vala \
api/constant.vala \
@@ -136,7 +142,7 @@ libvaladocincludedir = $(includedir)/
libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES)
- $(VALAC) $(VALAFLAGS) -C -H valadoc-1.0.h --pkg gee-1.0 --pkg vala-1.0 --pkg gmodule-2.0 --vapidir ../vapi --pkg libgvc --library valadoc-1.0 --basedir $(top_srcdir)/src/libvaladoc/ --save-temps $^
+ $(VALAC) $(VALAFLAGS) -C -H valadoc-1.0.h --pkg gee-1.0 --pkg vala-1.0 --pkg gmodule-2.0 --vapidir ../vapi --pkg libgvc --pkg config --library valadoc-1.0 --basedir $(top_srcdir)/src/libvaladoc/ --save-temps $^
touch $@
diff --git a/src/libvaladoc/api/array.vala b/src/libvaladoc/api/array.vala
index da14b79..171b9b4 100644
--- a/src/libvaladoc/api/array.vala
+++ b/src/libvaladoc/api/array.vala
@@ -43,7 +43,7 @@ public class Valadoc.Api.Array : Item {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
if (this.data_type == null) {
/*TODO:possible?*/;
} else if (this.data_type is Array) {
diff --git a/src/libvaladoc/api/class.vala b/src/libvaladoc/api/class.vala
index c3b93a7..e3fe29b 100644
--- a/src/libvaladoc/api/class.vala
+++ b/src/libvaladoc/api/class.vala
@@ -40,7 +40,7 @@ public class Valadoc.Api.Class : TypeSymbol {
}
}
- protected TypeReference? base_type {
+ public TypeReference? base_type {
private set;
get;
}
@@ -82,7 +82,7 @@ public class Valadoc.Api.Class : TypeSymbol {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
var lst = this.vclass.get_base_types ();
this.set_parent_type_references (root, lst);
diff --git a/src/libvaladoc/api/constant.vala b/src/libvaladoc/api/constant.vala
index 2af71e2..0422f84 100644
--- a/src/libvaladoc/api/constant.vala
+++ b/src/libvaladoc/api/constant.vala
@@ -35,7 +35,7 @@ public class Valadoc.Api.Constant : Member {
return ((Vala.Constant) symbol).get_cname ();
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
type_reference.resolve_type_references (root);
}
diff --git a/src/libvaladoc/api/delegate.vala b/src/libvaladoc/api/delegate.vala
index 903c778..4428496 100644
--- a/src/libvaladoc/api/delegate.vala
+++ b/src/libvaladoc/api/delegate.vala
@@ -47,7 +47,7 @@ public class Valadoc.Api.Delegate : TypeSymbol {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
return_type.resolve_type_references (root);
base.resolve_type_references (root);
diff --git a/src/libvaladoc/api/enumvalue.vala b/src/libvaladoc/api/enumvalue.vala
index 57113b8..ee3038b 100644
--- a/src/libvaladoc/api/enumvalue.vala
+++ b/src/libvaladoc/api/enumvalue.vala
@@ -52,7 +52,7 @@ public class Valadoc.Api.EnumValue: Symbol {
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
var source_comment = ((Vala.EnumValue) symbol).comment;
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
diff --git a/src/libvaladoc/api/field.vala b/src/libvaladoc/api/field.vala
index 5f084f7..16d3d44 100644
--- a/src/libvaladoc/api/field.vala
+++ b/src/libvaladoc/api/field.vala
@@ -51,7 +51,7 @@ public class Valadoc.Api.Field : Member {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
field_type.resolve_type_references (root);
base.resolve_type_references (root);
diff --git a/src/libvaladoc/api/formalparameter.vala b/src/libvaladoc/api/formalparameter.vala
index e749111..538433d 100644
--- a/src/libvaladoc/api/formalparameter.vala
+++ b/src/libvaladoc/api/formalparameter.vala
@@ -61,7 +61,7 @@ public class Valadoc.Api.FormalParameter : Symbol {
visitor.visit_formal_parameter (this);
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
if (ellipsis) {
return;
}
diff --git a/src/libvaladoc/api/interface.vala b/src/libvaladoc/api/interface.vala
index 459e18c..e7bb315 100644
--- a/src/libvaladoc/api/interface.vala
+++ b/src/libvaladoc/api/interface.vala
@@ -38,7 +38,7 @@ public class Valadoc.Api.Interface : TypeSymbol {
return ((Vala.Interface) symbol).get_cname ();
}
- protected TypeReference? base_type { private set; get; }
+ public TypeReference? base_type { private set; get; }
public override NodeType node_type { get { return NodeType.INTERFACE; } }
@@ -63,7 +63,7 @@ public class Valadoc.Api.Interface : TypeSymbol {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
var prerequisites = ((Vala.Interface) symbol).get_prerequisites ();
this.set_prerequisites (root, prerequisites);
diff --git a/src/libvaladoc/api/item.vala b/src/libvaladoc/api/item.vala
index a58830c..ecb087a 100644
--- a/src/libvaladoc/api/item.vala
+++ b/src/libvaladoc/api/item.vala
@@ -28,10 +28,10 @@ public abstract class Valadoc.Api.Item : Object {
public Item parent { protected set; get; }
- protected virtual void resolve_type_references (Tree root) {
+ internal virtual void resolve_type_references (Tree root) {
}
- protected virtual void process_comments (Settings settings, DocumentationParser parser) {
+ internal virtual void process_comments (Settings settings, DocumentationParser parser) {
}
public Inline signature {
diff --git a/src/libvaladoc/api/member.vala b/src/libvaladoc/api/member.vala
index b2766da..428d3ac 100644
--- a/src/libvaladoc/api/member.vala
+++ b/src/libvaladoc/api/member.vala
@@ -28,7 +28,7 @@ public abstract class Valadoc.Api.Member : Symbol {
base (symbol, parent);
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
var source_comment = ((Vala.Member) symbol).comment;
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
diff --git a/src/libvaladoc/api/method.vala b/src/libvaladoc/api/method.vala
index 893ab30..243587d 100644
--- a/src/libvaladoc/api/method.vala
+++ b/src/libvaladoc/api/method.vala
@@ -97,7 +97,7 @@ public class Valadoc.Api.Method : Member {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
Vala.Method vala_method = symbol as Vala.Method;
Vala.Method? base_vala_method = null;
if (vala_method.base_method != null) {
diff --git a/src/libvaladoc/api/namespace.vala b/src/libvaladoc/api/namespace.vala
index 6a106c8..00464f8 100644
--- a/src/libvaladoc/api/namespace.vala
+++ b/src/libvaladoc/api/namespace.vala
@@ -39,7 +39,7 @@ public class Valadoc.Api.Namespace : Symbol {
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
}
diff --git a/src/libvaladoc/api/node.vala b/src/libvaladoc/api/node.vala
index b4eb6ab..498df4a 100644
--- a/src/libvaladoc/api/node.vala
+++ b/src/libvaladoc/api/node.vala
@@ -72,7 +72,7 @@ public abstract class Valadoc.Api.Node : Item, Visitable, Documentation, Compara
return null;
}
- protected void add_child (Symbol child) {
+ internal void add_child (Symbol child) {
if (child.name != null) {
per_name_children.set (child.name, child);
} else {
@@ -91,13 +91,13 @@ public abstract class Valadoc.Api.Node : Item, Visitable, Documentation, Compara
children.add (child);
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
foreach (Node node in per_name_children.values) {
node.resolve_type_references (root);
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
do_document = true;
foreach (Node node in per_symbol_children.values) {
@@ -207,7 +207,7 @@ public abstract class Valadoc.Api.Node : Item, Visitable, Documentation, Compara
}
public Content.Comment? documentation {
- protected set;
+ internal set;
get;
}
diff --git a/src/libvaladoc/api/package.vala b/src/libvaladoc/api/package.vala
index c50c986..7979972 100644
--- a/src/libvaladoc/api/package.vala
+++ b/src/libvaladoc/api/package.vala
@@ -94,7 +94,7 @@ public class Valadoc.Api.Package : Node {
}
public override bool is_visitor_accessible (Settings settings) {
- return !( this.is_package && settings.with_deps == false );
+ return !(this.is_package && settings.with_deps == false);
}
public override NodeType node_type { get { return NodeType.PACKAGE; } }
@@ -110,7 +110,11 @@ public class Valadoc.Api.Package : Node {
.get ();
}
- protected Namespace get_namespace (Tree root, Vala.Symbol symbol) {
+ internal void import_documentation (string path, Settings settings, DocumentationImporter importer) {
+ importer.process (path, settings, this);
+ }
+
+ internal Namespace get_namespace (Tree root, Vala.Symbol symbol) {
Vala.Symbol namespace_symbol = symbol;
while (!(namespace_symbol is Vala.Namespace)) {
namespace_symbol = namespace_symbol.parent_symbol;
diff --git a/src/libvaladoc/api/pointer.vala b/src/libvaladoc/api/pointer.vala
index 446b8f6..6b2b736 100644
--- a/src/libvaladoc/api/pointer.vala
+++ b/src/libvaladoc/api/pointer.vala
@@ -45,7 +45,7 @@ public class Valadoc.Api.Pointer : Item {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
Api.Item type = this.data_type;
if (type == null) {
;
diff --git a/src/libvaladoc/api/property.vala b/src/libvaladoc/api/property.vala
index 6774ecc..af7e25b 100644
--- a/src/libvaladoc/api/property.vala
+++ b/src/libvaladoc/api/property.vala
@@ -68,7 +68,7 @@ public class Valadoc.Api.Property : Member {
public Property base_property { private set; get; }
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
Vala.Property vala_property = symbol as Vala.Property;
Vala.Property? base_vala_property = null;
if (vala_property.base_property != null) {
@@ -87,7 +87,7 @@ public class Valadoc.Api.Property : Member {
property_type.resolve_type_references (root);
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
if (getter != null && getter.is_visitor_accessible (settings)) {
getter.process_comments (settings, parser);
}
diff --git a/src/libvaladoc/api/signal.vala b/src/libvaladoc/api/signal.vala
index 0f15abd..30b5a36 100644
--- a/src/libvaladoc/api/signal.vala
+++ b/src/libvaladoc/api/signal.vala
@@ -35,7 +35,7 @@ public class Valadoc.Api.Signal : Member {
public TypeReference? return_type { protected set; get; }
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
return_type.resolve_type_references (root);
base.resolve_type_references (root);
diff --git a/src/libvaladoc/api/struct.vala b/src/libvaladoc/api/struct.vala
index dfe5605..7b672e9 100644
--- a/src/libvaladoc/api/struct.vala
+++ b/src/libvaladoc/api/struct.vala
@@ -28,7 +28,7 @@ public class Valadoc.Api.Struct : TypeSymbol {
base (symbol, parent);
}
- protected TypeReference? base_type { private set; get; }
+ public TypeReference? base_type { private set; get; }
public string? get_cname () {
return ((Vala.Struct) symbol).get_cname();
@@ -49,7 +49,7 @@ public class Valadoc.Api.Struct : TypeSymbol {
this.base_type.resolve_type_references (root);
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
this.set_parent_references (root);
base.resolve_type_references (root);
diff --git a/src/libvaladoc/api/symbol.vala b/src/libvaladoc/api/symbol.vala
index 6ca4d76..1da6be3 100644
--- a/src/libvaladoc/api/symbol.vala
+++ b/src/libvaladoc/api/symbol.vala
@@ -24,7 +24,7 @@ using Gee;
public abstract class Valadoc.Api.Symbol : Node {
- protected Vala.Symbol symbol { private set; get; }
+ internal Vala.Symbol symbol { private set; get; }
public override string? name {
owned get {
@@ -101,7 +101,7 @@ public abstract class Valadoc.Api.Symbol : Node {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
base.resolve_type_references (root);
foreach (Vala.DataType type in symbol.get_error_types ()) {
diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala
index dfacf98..e19ab22 100644
--- a/src/libvaladoc/api/tree.vala
+++ b/src/libvaladoc/api/tree.vala
@@ -66,6 +66,7 @@ public class Valadoc.Api.Tree {
private Node? search_relative_to (Node element, string[] path) {
Api.Node? node = element;
+
foreach (string name in path) {
node = node.find_by_name (name);
if (node == null) {
@@ -80,25 +81,49 @@ public class Valadoc.Api.Tree {
return node;
}
+ public Node? search_symbol_path (Node? element, string[] path) {
+ Api.Node? node = null;
+
+ // relative to element
+ if (element != null) {
+ node = search_relative_to (element, path);
+ if (node != null) {
+ return node;
+ }
+ }
+
+
+ // absolute
+ foreach (Package package in packages) {
+ // search in root namespace
+ node = search_relative_to (package.find_by_name (""), path);
+ if (node != null) {
+ return node;
+ }
+ }
+
+ return null;
+ }
+
public Node? search_symbol_str (Node? element, string symname) {
string[] path = split_name (symname);
- if (element == null) {
- Api.Node? node = null;
- foreach (Package packgage in packages) {
- node = search_relative_to (packgage, path);
- if (node != null) {
- return (Node) node;
- }
- }
- return null;
+ var node = search_symbol_path (element, path);
+ if (node != null) {
+ return node;
+ }
+
+ if (path.length >= 3 && path[path.length-3] == path[path.length-2]) {
+ path[path.length-2] = path[path.length-2]+"."+path[path.length-1];
+ path.resize (path.length-1);
+ return search_symbol_path (element, path);
}
- return (Node) search_relative_to ((Node) element, path);
+ return null;
}
private string[] split_name (string full_name) {
- string[] params = full_name.split (".", -1);
+ string[] params = (full_name).split (".", -1);
int i = 0; while (params[i] != null) i++;
params.length = i;
return params;
@@ -215,6 +240,43 @@ public class Valadoc.Api.Tree {
return true;
}
+ // copied from valacodecontext.vala
+ private string? get_file_path (string basename, string data_dir, string[] directories) {
+ string filename = null;
+
+ if (directories != null) {
+ foreach (string dir in directories) {
+ filename = Path.build_filename (dir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+ }
+
+ foreach (string dir in Environment.get_system_data_dirs ()) {
+ filename = Path.build_filename (dir, data_dir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+
+ return null;
+ }
+
+ // copied from valacodecontext.vala
+ private string? get_external_documentation_path (string pkg) {
+ var path = get_file_path (Path.build_filename (pkg, pkg + ".valadoc"), "vala/vapi/documentation", settings.docu_directories);
+
+ if (path == null) {
+ /* last chance: try the package compiled-in vapi dir */
+ var filename = Path.build_filename (Config.vapi_dir, "vapi", "documentation", pkg, pkg + ".valadoc");
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ path = filename;
+ }
+ }
+
+ return path;
+ }
public void add_depencies (string[] packages) {
foreach (string package in packages) {
@@ -315,11 +377,28 @@ public class Valadoc.Api.Tree {
}
}
+ private Package? get_source_package () {
+ foreach (Package pkg in packages) {
+ if (!pkg.is_package) {
+ return pkg;
+ }
+ }
+
+ return null;
+ }
+
+ private void process_wiki (DocumentationParser docparser) {
+ this.wikitree = new WikiPageTree(this.reporter, this.settings);
+ var pkg = get_source_package ();
+ if (pkg != null) {
+ wikitree.create_tree (docparser, pkg);
+ }
+ }
+
// TODO Rename to process_comments
public void parse_comments (DocumentationParser docparser) {
// TODO Move Wiki tree parse to Package
- this.wikitree = new WikiPageTree(this.reporter, this.settings);
- wikitree.create_tree (docparser);
+ process_wiki (docparser);
foreach (Package pkg in this.packages) {
if (pkg.is_visitor_accessible (settings)) {
@@ -328,6 +407,17 @@ public class Valadoc.Api.Tree {
}
}
+ public void import_documentation (DocumentationImporter importer) {
+ foreach (Package pkg in this.packages) {
+ string? path = (pkg.is_package)? get_external_documentation_path (pkg.name) : null;
+
+ if (pkg.is_visitor_accessible (settings) && path != null) {
+ pkg.import_documentation (path, settings, importer);
+ }
+ }
+
+ }
+
internal Symbol? search_vala_symbol (Vala.Symbol symbol) {
Vala.SourceFile source_file = symbol.source_reference.file;
Package package = find_package_for_file (source_file);
diff --git a/src/libvaladoc/api/typereference.vala b/src/libvaladoc/api/typereference.vala
index 3b6af65..64b5ac6 100644
--- a/src/libvaladoc/api/typereference.vala
+++ b/src/libvaladoc/api/typereference.vala
@@ -174,7 +174,7 @@ public class Valadoc.Api.TypeReference : Item {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
if ( this.vtyperef is Vala.PointerType) {
this.data_type = new Pointer ((Vala.PointerType) this.vtyperef, this);
} else if (vtyperef is Vala.ArrayType) {
diff --git a/src/libvaladoc/api/typesymbol.vala b/src/libvaladoc/api/typesymbol.vala
index 1a02499..31fb3ee 100644
--- a/src/libvaladoc/api/typesymbol.vala
+++ b/src/libvaladoc/api/typesymbol.vala
@@ -41,7 +41,7 @@ public abstract class Valadoc.Api.TypeSymbol : Symbol {
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
var source_comment = ((Vala.TypeSymbol) symbol).comment;
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
diff --git a/src/libvaladoc/content/blockcontent.vala b/src/libvaladoc/content/blockcontent.vala
index c6a555e..d9d3e4b 100755
--- a/src/libvaladoc/content/blockcontent.vala
+++ b/src/libvaladoc/content/blockcontent.vala
@@ -34,9 +34,9 @@ public abstract class Valadoc.Content.BlockContent : ContentElement {
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
foreach (Block element in _content) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
diff --git a/src/libvaladoc/content/comment.vala b/src/libvaladoc/content/comment.vala
index d989476..0a49cc3 100755
--- a/src/libvaladoc/content/comment.vala
+++ b/src/libvaladoc/content/comment.vala
@@ -36,11 +36,11 @@ public class Valadoc.Content.Comment : BlockContent {
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
- base.check (api_root, container, reporter);
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
+ base.check (api_root, container, reporter, settings);
foreach (Taglet element in _taglets) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
diff --git a/src/libvaladoc/content/contentfactory.vala b/src/libvaladoc/content/contentfactory.vala
index fd45571..323fb47 100755
--- a/src/libvaladoc/content/contentfactory.vala
+++ b/src/libvaladoc/content/contentfactory.vala
@@ -92,7 +92,7 @@ public class Valadoc.Content.ContentFactory : Object {
return (TableRow) configure (new TableRow ());
}
- public Taglet create_taglet (string name) {
+ public Taglet? create_taglet (string name) {
return _modules.create_taglet (name);
}
diff --git a/src/libvaladoc/content/embedded.vala b/src/libvaladoc/content/embedded.vala
index 882fb4b..fd040d3 100755
--- a/src/libvaladoc/content/embedded.vala
+++ b/src/libvaladoc/content/embedded.vala
@@ -30,6 +30,7 @@ public class Valadoc.Content.Embedded : ContentElement, Inline, StyleAttributes
public HorizontalAlign? horizontal_align { get; set; }
public VerticalAlign? vertical_align { get; set; }
public string? style { get; set; }
+ public Api.Package package;
private ResourceLocator _locator;
@@ -41,8 +42,12 @@ public class Valadoc.Content.Embedded : ContentElement, Inline, StyleAttributes
_locator = locator;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
- // Check the image exists if it a local resource
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
+ if (!FileUtils.test (url, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ reporter.simple_error ("%s does not exist".printf (url));
+ } else {
+ package = container.package;
+ }
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/headline.vala b/src/libvaladoc/content/headline.vala
index c8e13a6..60844db 100755
--- a/src/libvaladoc/content/headline.vala
+++ b/src/libvaladoc/content/headline.vala
@@ -31,11 +31,12 @@ public class Valadoc.Content.Headline : Block, InlineContent {
_level = 0;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// TODO report error if level == 0 ?
+ // TODO: content.size == 0?
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/inlinecontent.vala b/src/libvaladoc/content/inlinecontent.vala
index 34c7553..6873314 100755
--- a/src/libvaladoc/content/inlinecontent.vala
+++ b/src/libvaladoc/content/inlinecontent.vala
@@ -35,9 +35,9 @@ public abstract class Valadoc.Content.InlineContent : ContentElement {
internal InlineContent () {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
foreach (Inline element in _content) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
diff --git a/src/libvaladoc/content/inlinetaglet.vala b/src/libvaladoc/content/inlinetaglet.vala
index 8a28e1c..32df022 100755
--- a/src/libvaladoc/content/inlinetaglet.vala
+++ b/src/libvaladoc/content/inlinetaglet.vala
@@ -34,6 +34,8 @@ public abstract class Valadoc.Content.InlineTaglet : ContentElement, Taglet, Inl
public abstract Rule? get_parser_rule (Rule run_rule);
+ public abstract void xml_importer_parer_rule (Xml.DocumentationImporter importer);
+
public abstract ContentElement produce_content ();
private ContentElement get_content () {
@@ -48,9 +50,9 @@ public abstract class Valadoc.Content.InlineTaglet : ContentElement, Taglet, Inl
this.locator = locator;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
ContentElement element = get_content ();
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/link.vala b/src/libvaladoc/content/link.vala
index fa8da9a..21658e7 100755
--- a/src/libvaladoc/content/link.vala
+++ b/src/libvaladoc/content/link.vala
@@ -33,7 +33,8 @@ public class Valadoc.Content.Link : InlineContent, Inline {
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
+ //TODO: check url
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/list.vala b/src/libvaladoc/content/list.vala
index 4170a43..9c6cb7f 100755
--- a/src/libvaladoc/content/list.vala
+++ b/src/libvaladoc/content/list.vala
@@ -32,7 +32,68 @@ public class Valadoc.Content.List : ContentElement, Block {
ORDERED_LOWER_CASE_ALPHA,
ORDERED_UPPER_CASE_ALPHA,
ORDERED_LOWER_CASE_ROMAN,
- ORDERED_UPPER_CASE_ROMAN
+ ORDERED_UPPER_CASE_ROMAN;
+
+ public static Bullet? from_string (string? str) {
+ switch (str) {
+ case "none":
+ return Bullet.NONE;
+
+ case "unordered":
+ return Bullet.UNORDERED;
+
+ case "ordered":
+ return Bullet.ORDERED;
+
+ case "ordered-number":
+ return Bullet.ORDERED_NUMBER;
+
+ case "ordered-lower-case-alpa":
+ return Bullet.ORDERED_LOWER_CASE_ALPHA;
+
+ case "ordered-upper-case-alpha":
+ return Bullet.ORDERED_UPPER_CASE_ALPHA;
+
+ case "ordered-lower-case-roman":
+ return Bullet.ORDERED_LOWER_CASE_ROMAN;
+
+ case "ordered-upper-case-roman":
+ return Bullet.ORDERED_UPPER_CASE_ROMAN;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case Bullet.NONE:
+ return "none";
+
+ case Bullet.UNORDERED:
+ return "unordered";
+
+ case Bullet.ORDERED:
+ return "ordered";
+
+ case Bullet.ORDERED_NUMBER:
+ return "ordered-number";
+
+ case Bullet.ORDERED_LOWER_CASE_ALPHA:
+ return "ordered-lower-case-alpa";
+
+ case Bullet.ORDERED_UPPER_CASE_ALPHA:
+ return "ordered-upper-case-alpha";
+
+ case Bullet.ORDERED_LOWER_CASE_ROMAN:
+ return "ordered-lower-case-roman";
+
+ case Bullet.ORDERED_UPPER_CASE_ROMAN:
+ return "ordered-upper-case-roman";
+ }
+
+ assert (true);
+ return "";
+ }
}
public Bullet bullet { get; set; }
@@ -47,10 +108,10 @@ public class Valadoc.Content.List : ContentElement, Block {
_items = new ArrayList<ListItem> ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check individual list items
foreach (ListItem element in _items) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
diff --git a/src/libvaladoc/content/listitem.vala b/src/libvaladoc/content/listitem.vala
index 8a2c6f9..56f13dd 100755
--- a/src/libvaladoc/content/listitem.vala
+++ b/src/libvaladoc/content/listitem.vala
@@ -30,12 +30,12 @@ public class Valadoc.Content.ListItem : InlineContent {
base ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
if (sub_list != null) {
- sub_list.check (api_root, container, reporter);
+ sub_list.check (api_root, container, reporter, settings);
}
}
diff --git a/src/libvaladoc/content/paragraph.vala b/src/libvaladoc/content/paragraph.vala
index baf1578..12bded1 100755
--- a/src/libvaladoc/content/paragraph.vala
+++ b/src/libvaladoc/content/paragraph.vala
@@ -32,9 +32,9 @@ public class Valadoc.Content.Paragraph : InlineContent, Block, StyleAttributes {
base ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/run.vala b/src/libvaladoc/content/run.vala
index cc6072c..17a6809 100755
--- a/src/libvaladoc/content/run.vala
+++ b/src/libvaladoc/content/run.vala
@@ -34,7 +34,80 @@ public class Valadoc.Content.Run : InlineContent, Inline {
LANG_KEYWORD,
LANG_LITERAL,
LANG_BASIC_TYPE,
- LANG_TYPE
+ LANG_TYPE;
+
+ public static Style? from_string (string str) {
+ switch (str) {
+ case "none":
+ return Style.NONE;
+
+ case "bold":
+ return Style.BOLD;
+
+ case "italic":
+ return Style.ITALIC;
+
+ case "underlined":
+ return Style.UNDERLINED;
+
+ case "monospaced":
+ return Style.MONOSPACED;
+
+ case "stroke":
+ return Style.STROKE;
+
+ case "lang-keyword":
+ return Style.LANG_KEYWORD;
+
+ case "lang-literal":
+ return Style.LANG_LITERAL;
+
+ case "lang-basic-type":
+ return Style.LANG_BASIC_TYPE;
+
+ case "lang-type":
+ return Style.LANG_TYPE;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case Style.NONE:
+ return "none";
+
+ case Style.BOLD:
+ return "bold";
+
+ case Style.ITALIC:
+ return "italic";
+
+ case Style.UNDERLINED:
+ return "underlined";
+
+ case Style.MONOSPACED:
+ return "monopace";
+
+ case Style.STROKE:
+ return "stroke";
+
+ case Style.LANG_KEYWORD:
+ return "lang-keyword";
+
+ case Style.LANG_LITERAL:
+ return "lang-literal";
+
+ case Style.LANG_BASIC_TYPE:
+ return "lang-basic-type";
+
+ case Style.LANG_TYPE:
+ return "lang-type";
+ }
+
+ assert (true);
+ return "";
+ }
}
public Style style { get; set; }
@@ -44,9 +117,9 @@ public class Valadoc.Content.Run : InlineContent, Inline {
_style = style;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/sourcecode.vala b/src/libvaladoc/content/sourcecode.vala
index 18a3f39..c10e7c4 100755
--- a/src/libvaladoc/content/sourcecode.vala
+++ b/src/libvaladoc/content/sourcecode.vala
@@ -26,7 +26,34 @@ public class Valadoc.Content.SourceCode : ContentElement, Inline{
public enum Language {
GENIE,
VALA,
- C
+ C;
+
+ public static Language? from_string (string str) {
+ switch (str) {
+ case "Genie":
+ return Language.GENIE;
+ case "Vala":
+ return Language.VALA;
+ case "C":
+ return Language.C;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case Language.GENIE:
+ return "Genie";
+ case Language.VALA:
+ return "Vala";
+ case Language.C:
+ return "C";
+ }
+
+ assert (true);
+ return "";
+ }
}
public string code { get; set; }
@@ -37,7 +64,7 @@ public class Valadoc.Content.SourceCode : ContentElement, Inline{
_language = Language.VALA;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/styleattributes.vala b/src/libvaladoc/content/styleattributes.vala
index 2c9fda2..265f444 100755
--- a/src/libvaladoc/content/styleattributes.vala
+++ b/src/libvaladoc/content/styleattributes.vala
@@ -26,13 +26,75 @@ using Gee;
public enum Valadoc.Content.HorizontalAlign {
LEFT,
RIGHT,
- CENTER
+ CENTER;
+
+ public static HorizontalAlign? from_string (string str) {
+ switch (str) {
+ case "left":
+ return HorizontalAlign.LEFT;
+
+ case "right":
+ return HorizontalAlign.RIGHT;
+
+ case "center":
+ return HorizontalAlign.CENTER;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case HorizontalAlign.LEFT:
+ return "left";
+
+ case HorizontalAlign.RIGHT:
+ return "right";
+
+ case HorizontalAlign.CENTER:
+ return "center";
+ }
+
+ assert (true);
+ return "";
+ }
}
public enum Valadoc.Content.VerticalAlign {
TOP,
MIDDLE,
- BOTTOM
+ BOTTOM;
+
+ public static VerticalAlign? from_string (string str) {
+ switch (str) {
+ case "top":
+ return VerticalAlign.TOP;
+
+ case "middle":
+ return VerticalAlign.MIDDLE;
+
+ case "bottom":
+ return VerticalAlign.BOTTOM;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case VerticalAlign.TOP:
+ return "top";
+
+ case VerticalAlign.MIDDLE:
+ return "middle";
+
+ case VerticalAlign.BOTTOM:
+ return "bottom";
+ }
+
+ assert (true);
+ return "";
+ }
}
public interface Valadoc.Content.StyleAttributes : ContentElement {
diff --git a/src/libvaladoc/content/symbollink.vala b/src/libvaladoc/content/symbollink.vala
index b476484..5dd1d09 100755
--- a/src/libvaladoc/content/symbollink.vala
+++ b/src/libvaladoc/content/symbollink.vala
@@ -36,7 +36,7 @@ public class Valadoc.Content.SymbolLink : ContentElement, Inline {
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/table.vala b/src/libvaladoc/content/table.vala
index 608f21f..45828fa 100755
--- a/src/libvaladoc/content/table.vala
+++ b/src/libvaladoc/content/table.vala
@@ -33,12 +33,12 @@ public class Valadoc.Content.Table : ContentElement, Block {
_rows = new ArrayList<TableRow> ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check the table consistency in term of row/column number
// Check individual rows
foreach (var row in _rows) {
- row.check (api_root, container, reporter);
+ row.check (api_root, container, reporter, settings);
}
}
diff --git a/src/libvaladoc/content/tablecell.vala b/src/libvaladoc/content/tablecell.vala
index 307a5db..1987520 100755
--- a/src/libvaladoc/content/tablecell.vala
+++ b/src/libvaladoc/content/tablecell.vala
@@ -36,9 +36,9 @@ public class Valadoc.Content.TableCell : InlineContent, StyleAttributes {
_rowspan = 1;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/content/tablerow.vala b/src/libvaladoc/content/tablerow.vala
index 89ea501..a4835de 100755
--- a/src/libvaladoc/content/tablerow.vala
+++ b/src/libvaladoc/content/tablerow.vala
@@ -33,10 +33,10 @@ public class Valadoc.Content.TableRow : ContentElement {
_cells = new ArrayList<TableCell> ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check individual cells
foreach (var cell in _cells) {
- cell.check (api_root, container, reporter);
+ cell.check (api_root, container, reporter, settings);
}
}
diff --git a/src/libvaladoc/content/text.vala b/src/libvaladoc/content/text.vala
index 6bac616..7609696 100755
--- a/src/libvaladoc/content/text.vala
+++ b/src/libvaladoc/content/text.vala
@@ -36,7 +36,7 @@ public class Valadoc.Content.Text : ContentElement, Inline {
}
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
}
public override void accept (ContentVisitor visitor) {
diff --git a/src/libvaladoc/doclet.vala b/src/libvaladoc/doclet.vala
index a08565f..dc72cde 100755
--- a/src/libvaladoc/doclet.vala
+++ b/src/libvaladoc/doclet.vala
@@ -22,7 +22,8 @@
using Gee;
-public static delegate Type Valadoc.DocletRegisterFunction ( );
+[CCode (has_target = false)]
+public delegate Type Valadoc.DocletRegisterFunction ( );
public interface Valadoc.Doclet : GLib.Object {
public abstract void process (Settings settings, Api.Tree tree);
diff --git a/src/libvaladoc/documentation/documentationparser.vala b/src/libvaladoc/documentation/documentationparser.vala
index 7450f83..869c5e0 100644
--- a/src/libvaladoc/documentation/documentationparser.vala
+++ b/src/libvaladoc/documentation/documentationparser.vala
@@ -64,14 +64,14 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
var source_ref = source_comment.source_reference;
try {
Comment doc_comment = parse_comment (content, source_ref.file.filename, source_ref.first_line, source_ref.first_column);
- doc_comment.check (_tree, element, _reporter);
+ doc_comment.check (_tree, element, _reporter, _settings);
return doc_comment;
} catch (ParserError error) {
return null;
}
}
- public Page? parse_wikipage (WikiPage page) {
+ public Page? parse_wikipage (WikiPage page, Api.Package pkg) {
if (page.documentation != null) {
return page.documentation;
}
@@ -82,7 +82,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
try {
Page documentation = parse_wiki (page.documentation_str, page.get_filename ());
- documentation.check (_tree, null, _reporter);
+ documentation.check (_tree, pkg, _reporter, _settings);
return documentation;
} catch (ParserError error) {
return null;
diff --git a/src/libvaladoc/documentation/wiki.vala b/src/libvaladoc/documentation/wiki.vala
index 6fd3954..d79383c 100755
--- a/src/libvaladoc/documentation/wiki.vala
+++ b/src/libvaladoc/documentation/wiki.vala
@@ -62,8 +62,8 @@ public class Valadoc.WikiPage : Object, Documentation {
}
}
- public bool parse (DocumentationParser docparser) {
- documentation = docparser.parse_wikipage ( this );
+ public bool parse (DocumentationParser docparser, Api.Package pkg) {
+ documentation = docparser.parse_wikipage (this, pkg);
return true;
}
}
@@ -74,6 +74,7 @@ public class Valadoc.WikiPageTree : Object {
private ErrorReporter reporter;
private Settings settings;
+ //TODO: reporter, settings -> create_tree
public WikiPageTree (ErrorReporter reporter, Settings settings) {
this.reporter = reporter;
this.settings = settings;
@@ -111,7 +112,7 @@ public class Valadoc.WikiPageTree : Object {
}
}
- public void create_tree (DocumentationParser docparser) throws GLib.FileError {
+ public void create_tree (DocumentationParser docparser, Api.Package pkg) throws GLib.FileError {
try {
weak string path = this.settings.wiki_directory;
if (path == null) {
@@ -122,7 +123,7 @@ public class Valadoc.WikiPageTree : Object {
this.create_tree_from_path (docparser, path);
foreach (WikiPage page in this.wikipages) {
- page.parse (docparser);
+ page.parse (docparser, pkg);
}
}
catch (FileError err) {
diff --git a/src/libvaladoc/html/basicdoclet.vala b/src/libvaladoc/html/basicdoclet.vala
index a98345b..a7de069 100755
--- a/src/libvaladoc/html/basicdoclet.vala
+++ b/src/libvaladoc/html/basicdoclet.vala
@@ -24,7 +24,7 @@ using Valadoc.Content;
using Valadoc.Api;
public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
- protected Settings settings;
+ public Settings settings { protected set; get; }
protected HtmlRenderer _renderer;
protected Html.MarkupWriter writer;
@@ -294,14 +294,14 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
protected bool is_internal_node (Api.Node node) {
return node is Package
- || node is Namespace
- || node is Interface
- || node is Class
- || node is Struct
- || node is Enum
+ || node is Api.Namespace
+ || node is Api.Interface
+ || node is Api.Class
+ || node is Api.Struct
+ || node is Api.Enum
|| node is Api.EnumValue
- || node is ErrorDomain
- || node is ErrorCode;
+ || node is Api.ErrorDomain
+ || node is Api.ErrorCode;
}
public void write_navi_packages_inline (Api.Tree tree) {
@@ -345,12 +345,12 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
writer.end_tag ("div");
}
- public void write_symbol_content (Api.Node node) {
+ public void write_symbol_content (Api.Node node, string image_path_prefix = "") {
string full_name = node.full_name ();
writer.start_tag ("div", {"class", css_style_content});
writer.start_tag ("h1", {"class", css_title, full_name}).text (node.name).end_tag ("h1");
writer.simple_tag ("hr", {"class", css_headline_hr});
- this.write_image_block (node);
+ this.write_image_block (node, image_path_prefix);
writer.start_tag ("h2", {"class", css_title}).text ("Description:").end_tag ("h2");
writer.start_tag ("div", {"class", css_code_definition});
this.write_signature (node, node);
@@ -362,6 +362,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
this.write_namespace_note (node);
this.write_package_note (node);
}
+
if (node.has_children ({
Api.NodeType.ERROR_CODE,
Api.NodeType.ENUM_VALUE,
@@ -490,13 +491,16 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
}
}
- protected void write_image_block (Api.Node element) {
+ protected void write_image_block (Api.Node element, string path_prefix = "") {
if (!(element is Class || element is Interface || element is Struct)) {
return;
}
string realimgpath = this.get_img_real_path (element);
string imgpath = this.get_img_path (element);
+ if (path_prefix != null) {
+ imgpath = Path.build_filename (path_prefix, imgpath);
+ }
if (element is Class) {
Diagrams.write_class_diagram ((Class)element, realimgpath);
diff --git a/src/libvaladoc/html/globals.vala b/src/libvaladoc/html/globals.vala
index 519e60f..c4b82de 100755
--- a/src/libvaladoc/html/globals.vala
+++ b/src/libvaladoc/html/globals.vala
@@ -124,37 +124,37 @@ namespace Valadoc.Html {
}
public string get_html_css_class (Valadoc.Api.Item element) {
- if ( element is Namespace ) {
+ if ( element is Api.Namespace ) {
return css_namespace;
}
- else if ( element is Struct ) {
+ else if ( element is Api.Struct ) {
return css_struct;
}
- else if ( element is Interface ) {
+ else if ( element is Api.Interface ) {
return css_interface;
}
- else if ( element is Class ) {
+ else if ( element is Api.Class ) {
return (((Class)element).is_abstract)? css_abstract_class : css_class;
}
- else if ( element is Enum ) {
+ else if ( element is Api.Enum ) {
return css_enum;
}
- else if ( element is ErrorDomain ) {
+ else if ( element is Api.ErrorDomain ) {
return css_errordomain;
}
- else if ( element is Delegate ) {
+ else if ( element is Api.Delegate ) {
return css_delegate;
}
- else if ( element is Method ) {
- if ( ((Method)element).is_static )
+ else if ( element is Api.Method ) {
+ if ( ((Api.Method)element).is_static )
return css_static_method;
- else if ( ((Method)element).is_static )
+ else if ( ((Api.Method)element).is_static )
return css_static_method;
- else if ( ((Method)element).is_constructor )
+ else if ( ((Api.Method)element).is_constructor )
return css_creation_method;
- else if ( ((Method)element).is_abstract )
+ else if ( ((Api.Method)element).is_abstract )
return css_abstract_method;
- else if ( ((Method)element).is_virtual || ((Method)element).is_override )
+ else if ( ((Api.Method)element).is_virtual || ((Api.Method)element).is_override )
return css_virtual_method;
else
return css_method;
@@ -162,27 +162,27 @@ namespace Valadoc.Html {
else if ( element is Api.Signal ) {
return css_signal;
}
- else if ( element is Property ) {
- if ( ((Property)element).is_virtual || ((Property)element).is_override )
+ else if ( element is Api.Property ) {
+ if ( ((Api.Property)element).is_virtual || ((Property)element).is_override )
return css_virtual_property;
- else if ( ((Property)element).is_abstract )
+ else if ( ((Api.Property)element).is_abstract )
return css_abstract_property;
else
return css_property;
}
- else if ( element is Field ) {
+ else if ( element is Api.Field ) {
return css_field;
}
- else if ( element is Constant ) {
+ else if ( element is Api.Constant ) {
return css_constant;
}
else if ( element is Api.EnumValue ) {
return css_enumvalue;
}
- else if ( element is ErrorCode ) {
+ else if ( element is Api.ErrorCode ) {
return css_errorcode;
}
- else if ( element is Package ) {
+ else if ( element is Api.Package ) {
return css_package;
}
return "";
diff --git a/src/libvaladoc/html/htmlmarkupwriter.vala b/src/libvaladoc/html/htmlmarkupwriter.vala
index 2351ea7..e48865d 100755
--- a/src/libvaladoc/html/htmlmarkupwriter.vala
+++ b/src/libvaladoc/html/htmlmarkupwriter.vala
@@ -35,6 +35,7 @@ public class Valadoc.Html.MarkupWriter : Valadoc.MarkupWriter {
} else {
start_tag ("a", {"href", url, "class", css_class});
}
+
text (label);
end_tag ("a");
return this;
diff --git a/src/libvaladoc/html/htmlrenderer.vala b/src/libvaladoc/html/htmlrenderer.vala
index 306b933..9af3413 100755
--- a/src/libvaladoc/html/htmlrenderer.vala
+++ b/src/libvaladoc/html/htmlrenderer.vala
@@ -25,9 +25,9 @@ using Valadoc.Content;
public class Valadoc.Html.HtmlRenderer : ContentRenderer {
- private BasicDoclet _doclet;
- private Documentation? _container;
- private unowned MarkupWriter writer;
+ protected BasicDoclet _doclet;
+ protected Documentation? _container;
+ protected unowned MarkupWriter writer;
public HtmlRenderer (BasicDoclet doclet) {
_doclet = doclet;
@@ -53,7 +53,7 @@ public class Valadoc.Html.HtmlRenderer : ContentRenderer {
return get_html_link (_doclet.settings, symbol, _container);
}
- private void write_symbol_link (Api.Node symbol, string label) {
+ private void write_symbol_link (Api.Node symbol, string? label) {
var url = get_url (symbol);
writer.link (url,
(label == null || label == "") ? symbol.full_name () : label,
@@ -200,7 +200,13 @@ public class Valadoc.Html.HtmlRenderer : ContentRenderer {
public override void visit_embedded (Embedded element) {
var caption = element.caption;
- writer.image (element.url, (caption == null || caption == "") ? "" : caption);
+
+ var absolute_path = Path.build_filename (_doclet.settings.path, element.package.name, "img", Path.get_basename (element.url));
+ var relative_path = Path.build_filename ("img", Path.get_basename (element.url));
+
+ copy_file (element.url, absolute_path);
+
+ writer.image (relative_path, (caption == null || caption == "") ? "" : caption);
}
public override void visit_headline (Headline element) {
diff --git a/src/libvaladoc/moduleloader.vala b/src/libvaladoc/moduleloader.vala
index 2faa546..963f125 100755
--- a/src/libvaladoc/moduleloader.vala
+++ b/src/libvaladoc/moduleloader.vala
@@ -24,7 +24,8 @@ using GLib.Path;
using Gee;
-public static delegate void Valadoc.TagletRegisterFunction (ModuleLoader loader);
+[CCode (has_target = false)]
+public delegate void Valadoc.TagletRegisterFunction (ModuleLoader loader);
public class Valadoc.ModuleLoader : Object {
@@ -43,8 +44,8 @@ public class Valadoc.ModuleLoader : Object {
return true;
}
- public Content.Taglet create_taglet (string keyword) {
- return (Content.Taglet) GLib.Object.new (taglets.get (keyword));
+ public Content.Taglet? create_taglet (string keyword) {
+ return (taglets.has_key (keyword))? (Content.Taglet) GLib.Object.new (taglets.get (keyword)) : null;
}
private bool load_doclet (string path) {
diff --git a/src/libvaladoc/settings.vala b/src/libvaladoc/settings.vala
index 8cc5e94..58d3670 100755
--- a/src/libvaladoc/settings.vala
+++ b/src/libvaladoc/settings.vala
@@ -45,6 +45,7 @@ public class Valadoc.Settings : Object {
public string[] defines;
public string[] vapi_directories;
+ public string[] docu_directories;
}
diff --git a/src/valadoc/valadoc.vala b/src/valadoc/valadoc.vala
index 9f6ad65..672e82a 100755
--- a/src/valadoc/valadoc.vala
+++ b/src/valadoc/valadoc.vala
@@ -54,6 +54,8 @@ public class ValaDoc : Object {
private static string profile;
[CCode (array_length = false, array_null_terminated = true)]
+ private static string[] docu_directories;
+ [CCode (array_length = false, array_null_terminated = true)]
private static string[] vapi_directories;
[CCode (array_length = false, array_null_terminated = true)]
private static string[] tsources;
@@ -69,6 +71,7 @@ public class ValaDoc : Object {
{ "enable-experimental-non-null", 0, 0, OptionArg.NONE, ref experimental_non_null, "Enable experimental enhancements for non-null types", null },
{ "disable-dbus-transformation", 0, 0, OptionArg.NONE, ref disable_dbus_transformation, "Disable transformation of D-Bus member names", null },
{ "vapidir", 0, 0, OptionArg.FILENAME_ARRAY, ref vapi_directories, "Look for package bindings in DIRECTORY", "DIRECTORY..." },
+ { "docudir", 0, 0, OptionArg.FILENAME_ARRAY, ref docu_directories, "Look for external documentation in DIRECTORY", "DIRECTORY..." },
{ "profile", 0, 0, OptionArg.STRING, ref profile, "Use the given profile instead of the default", "PROFILE" },
@@ -149,6 +152,7 @@ public class ValaDoc : Object {
settings.basedir = basedir;
settings.directory = directory;
settings.vapi_directories = vapi_directories;
+ settings.docu_directories = docu_directories;
settings.profile = profile;
settings.defines = defines;
@@ -184,27 +188,31 @@ public class ValaDoc : Object {
Valadoc.Api.Tree doctree = new Valadoc.Api.Tree (reporter, settings);
Valadoc.DocumentationParser docparser = new Valadoc.DocumentationParser (settings, reporter, doctree, modules);
- if (reporter.errors > 0) {
- return quit (reporter);
- }
+ Valadoc.DocumentationImporter importer = new Valadoc.Xml.DocumentationImporter (doctree, modules, settings, reporter);
doctree.add_depencies (packages);
if (reporter.errors > 0) {
return quit (reporter);
}
-
doctree.add_documented_file (tsources);
if (reporter.errors > 0) {
return quit (reporter);
}
- if (!doctree.create_tree())
+ if (!doctree.create_tree()) {
return quit (reporter);
+ }
doctree.parse_comments (docparser);
- if (reporter.errors > 0)
+ if (reporter.errors > 0) {
+ return quit (reporter);
+ }
+
+ doctree.import_documentation (importer);
+ if (reporter.errors > 0) {
return quit (reporter);
+ }
modules.doclet.process (settings, doctree);
return quit (reporter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]