[valadoc] valadoc.org-doclt: api export
- From: Florian Brosch <flobrosch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [valadoc] valadoc.org-doclt: api export
- Date: Wed, 21 Oct 2009 10:47:41 +0000 (UTC)
commit ad824a423a5092fd41d01c545e53d0f770b51610
Author: Florian Brosch <flo brosch gmail com>
Date: Wed Oct 21 11:51:29 2009 +0200
valadoc.org-doclt: api export
src/doclets/devhelp/doclet/doclet.vala | 3 +
src/doclets/htm/doclet/doclet.vala | 5 +-
src/doclets/htmlhelpers/doclet/doclet.vala | 1 +
src/doclets/htmlhelpers/doclet/markupwriter.vala | 4 +
src/doclets/valadoc.org/.doclet.vala.swp | Bin 0 -> 16384 bytes
src/doclets/valadoc.org/Makefile.am | 4 +-
src/doclets/valadoc.org/doclet.vala | 103 +++++++++-------------
src/doclets/valadoc.org/wikirenderer.vala | 1 +
8 files changed, 59 insertions(+), 62 deletions(-)
---
diff --git a/src/doclets/devhelp/doclet/doclet.vala b/src/doclets/devhelp/doclet/doclet.vala
index 3a4714b..39e5cca 100755
--- a/src/doclets/devhelp/doclet/doclet.vala
+++ b/src/doclets/devhelp/doclet/doclet.vala
@@ -252,6 +252,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open ( filepath, "w" );
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
write_file_header (this.css_path, pkg_name);
write_package_content (package, package, wikipage);
@@ -272,6 +273,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
write_file_header (css_path, node.full_name());
write_symbol_content (node);
@@ -293,6 +295,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
write_file_header (css_path, node.full_name());
write_symbol_content (node);
diff --git a/src/doclets/htm/doclet/doclet.vala b/src/doclets/htm/doclet/doclet.vala
index 58b3685..266c1de 100755
--- a/src/doclets/htm/doclet/doclet.vala
+++ b/src/doclets/htm/doclet/doclet.vala
@@ -123,6 +123,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open ( GLib.Path.build_filename ( settings.path, "index.html" ), "w" );
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
write_file_header (this.css_path_package, settings.pkg_name);
write_navi_packages (tree);
@@ -146,6 +147,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open ( GLib.Path.build_filename ( path, "index.htm" ), "w" );
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
write_file_header (this.css_path, pkg_name);
write_navi_package (package);
@@ -162,6 +164,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
if ( ns.name != null ) {
GLib.FileStream file = GLib.FileStream.open ( rpath, "w" );
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
write_file_header (this.css_path, ns.full_name());
write_navi_symbol (ns);
@@ -178,6 +181,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
write_file_header (css_path, node.full_name());
if (is_internal_node (node)) {
@@ -188,7 +192,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
write_symbol_content (node);
write_file_footer ();
file = null;
-
node.accept_all_children (this);
}
diff --git a/src/doclets/htmlhelpers/doclet/doclet.vala b/src/doclets/htmlhelpers/doclet/doclet.vala
index db5de47..cb3799e 100755
--- a/src/doclets/htmlhelpers/doclet/doclet.vala
+++ b/src/doclets/htmlhelpers/doclet/doclet.vala
@@ -85,6 +85,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
if (page.name != "index.valadoc") {
GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.ndup(page.name.len()-7).replace ("/", ".")+"html"), "w");
writer = new MarkupWriter (file);
+ writer.xml_declaration ();
_renderer.set_writer (writer);
this.write_file_header (css_path_wiki, this.settings.pkg_name);
_renderer.set_container (page);
diff --git a/src/doclets/htmlhelpers/doclet/markupwriter.vala b/src/doclets/htmlhelpers/doclet/markupwriter.vala
index 3ed3a49..ce821da 100755
--- a/src/doclets/htmlhelpers/doclet/markupwriter.vala
+++ b/src/doclets/htmlhelpers/doclet/markupwriter.vala
@@ -35,6 +35,10 @@ public class Valadoc.Html.MarkupWriter {
public MarkupWriter (FileStream stream) {
this.stream = stream;
+ last_was_tag = true;
+ }
+
+ public void xml_declaration () {
do_write ("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
indent = -1;
last_was_tag = true;
diff --git a/src/doclets/valadoc.org/.doclet.vala.swp b/src/doclets/valadoc.org/.doclet.vala.swp
new file mode 100644
index 0000000..63d05b5
Binary files /dev/null and b/src/doclets/valadoc.org/.doclet.vala.swp differ
diff --git a/src/doclets/valadoc.org/Makefile.am b/src/doclets/valadoc.org/Makefile.am
index 08c0086..c56d978 100755
--- a/src/doclets/valadoc.org/Makefile.am
+++ b/src/doclets/valadoc.org/Makefile.am
@@ -11,7 +11,7 @@ BUILT_SOURCES = libdoclet.vala.stamp
libdoclet.vala.stamp: $(libdoclet_VALASOURCES)
- $(VALAC) -C --vapidir ../../libvaladoc/ --vapidir ../../vapi/ --pkg valadoc-1.0 --pkg gee-1.0 --basedir . --save-temps $^
+ $(VALAC) -C --vapidir ../htmlhelpers/doclet/ --pkg libhtmlhelpers-1.0 --vapidir ../../libvaladoc/ --vapidir ../../vapi/ --pkg valadoc-1.0 --pkg gee-1.0 --basedir . --save-temps $^
touch $@
@@ -31,6 +31,7 @@ libdoclet_la_SOURCES = \
AM_CFLAGS = -g \
-I ../../libvaladoc/ \
+ -I ../htmlhelpers/doclet/ \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
$(LIBVALA_CFLAGS) \
@@ -43,6 +44,7 @@ libdoclet_la_LDFLAGS = -module -avoid-version \
libdoclet_la_LIBADD = \
../../libvaladoc/libvaladoc.la \
+ ../htmlhelpers/doclet/libhtmlhelpers.la \
$(GLIB_LIBS) \
$(LIBGEE_LIBS) \
$(LIBVALA_LIBS) \
diff --git a/src/doclets/valadoc.org/doclet.vala b/src/doclets/valadoc.org/doclet.vala
index 9573438..2df7a1f 100755
--- a/src/doclets/valadoc.org/doclet.vala
+++ b/src/doclets/valadoc.org/doclet.vala
@@ -19,13 +19,21 @@
using Valadoc.Diagrams;
using Valadoc.Content;
+using Valadoc.Html;
using Valadoc.Api;
using Gee;
+namespace Valadoc.ValadocOrg {
+ public string? get_html_link (Settings settings, Documentation element, Documentation? pos) {
+ if (element is Api.Node) {
+ return Path.build_filename("/"+((Api.Node)element).package.name, ((Api.Node)element).full_name () + ".html");
+ }
+ return null;
+ }
+}
-public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
- private ValadocOrg.WikiRenderer _renderer = new ValadocOrg.WikiRenderer ();
- private Settings settings;
+public class Valadoc.ValadocOrg.Doclet : BasicDoclet {
+ private WikiRenderer _wikirenderer;
private FileStream file;
private bool run;
@@ -41,15 +49,21 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return;
}
- _renderer.set_container (element);
- _renderer.set_filestream (file);
- _renderer.render (element.documentation);
+ _wikirenderer.set_container (element);
+ _wikirenderer.set_filestream (file);
+ _wikirenderer.render (element.documentation);
}
- public void process (Settings settings, Api.Tree tree) {
+ public override void process (Settings settings, Api.Tree tree) {
this.settings = settings;
this.run = true;
+ //writer
+
+ _wikirenderer = new ValadocOrg.WikiRenderer ();
+ _renderer = new HtmlRenderer (this);
+
+
DirUtils.create (this.settings.path, 0777);
Gee.Collection<Package> packages = tree.get_package_list ();
foreach ( Package pkg in packages ) {
@@ -61,13 +75,11 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return Path.build_filename (this.settings.path, element.package.name, element.package.name, element.full_name () + ".png");
}
- // get_type_path()
private void write_insert_into_valadoc_element_str (string name, string pkgname, string fullname) {
string fullname2 = (pkgname == fullname)? pkgname : pkgname+"/"+fullname;
this.file.printf ("INSERT INTO `ValadocApiElement` (`name`, `fullname`) VALUES ('%s', '%s');\n", name, fullname2);
}
- // get_type_path()
private void write_insert_into_valadoc_element (Api.Node element) {
string name = element.name;
string fullname;
@@ -87,17 +99,12 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
this.file.printf ("INSERT INTO `ValadocPackage` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE `fullname`='%s' LIMIT 1));\n", pkg.name);
}
- // get_type_path()
- private void write_insert_into_code_element_str (string fullname, string pkgname, string valaapi, string parentnodepkgname, string parentnodefullname) {
- string parentnodetypepath = (parentnodepkgname == parentnodefullname)? parentnodepkgname : parentnodepkgname+"/"+parentnodefullname;
- string typepath = pkgname+"/"+fullname;
- this.file.printf ("INSERT INTO `ValadocCodeElement` (`id`, `parent`, `valaapi`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), (SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), '%s');\n", typepath, parentnodetypepath, valaapi);
- }
- // get_type_path()
+
+
private void write_insert_into_code_element (Api.Node element) {
-/*
- string api = this.langwriter.from_documented_element (element).to_string (0, "");
+ string fullname = element.full_name ();
+ string pkgname = element.package.name;
string parentnodepkgname;
string parentnodename;
@@ -114,11 +121,17 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
parentnodename = parentnodepkgname;
}
- this.write_insert_into_code_element_str(element.full_name(), element.package.name, api, parentnodepkgname, parentnodename);
-*/
+ string parentnodetypepath = (parentnodepkgname == parentnodename)? parentnodepkgname : parentnodepkgname+"/"+parentnodename;
+ string typepath = pkgname+"/"+fullname;
+ this.file.printf ("INSERT INTO `ValadocCodeElement` (`id`, `parent`, `valaapi`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), (SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), '", typepath, parentnodetypepath);
+ var writer = new MarkupWriter (file);
+ writer.set_source_wrap (false);
+ _renderer.set_writer (writer);
+ _renderer.set_container (element);
+ _renderer.render (element.signature);
+ this.file.puts ("');\n");
}
-
public override void visit_package (Package pkg) {
string path = Path.build_filename(this.settings.path, pkg.name);
if (GLib.DirUtils.create (path, 0777) == -1) {
@@ -153,7 +166,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return;
}
- pkg.visit_namespaces (this);
+ pkg.accept_all_children (this);
}
public override void visit_namespace (Namespace ns) {
@@ -169,16 +182,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
}
}
- ns.visit_namespaces ( this );
- ns.visit_classes ( this );
- ns.visit_interfaces ( this );
- ns.visit_structs ( this );
- ns.visit_enums ( this );
- ns.visit_error_domains ( this );
- ns.visit_delegates ( this );
- ns.visit_methods ( this );
- ns.visit_fields ( this );
- ns.visit_constants (this);
+ ns.accept_all_children (this);
this.file.printf ("INSERT INTO `ValadocNamespaces` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(ns));
this.write_documentation (ns);
@@ -197,15 +201,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return;
}
- iface.visit_classes ( this );
- iface.visit_structs ( this );
- iface.visit_enums ( this );
- iface.visit_delegates ( this );
- iface.visit_methods ( this );
- iface.visit_signals ( this );
- iface.visit_properties ( this );
- iface.visit_fields ( this );
- iface.visit_constants ( this );
+ iface.accept_all_children (this);
this.file.printf ("INSERT INTO `ValadocInterfaces` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(iface));
this.write_documentation (iface);
@@ -224,16 +220,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return;
}
- cl.visit_construction_methods ( this );
- cl.visit_classes ( this );
- cl.visit_structs ( this );
- cl.visit_enums ( this );
- cl.visit_delegates ( this );
- cl.visit_methods ( this );
- cl.visit_signals ( this );
- cl.visit_properties ( this );
- cl.visit_fields ( this );
- cl.visit_constants ( this );
+ cl.accept_all_children (this);
string modifier;
if (cl.is_abstract) {
@@ -260,10 +247,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return;
}
- stru.visit_construction_methods ( this );
- stru.visit_methods ( this );
- stru.visit_fields ( this );
- stru.visit_constants ( this );
+ stru.accept_all_children (this);
this.file.printf ("INSERT INTO `ValadocStructs` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(stru));
this.write_documentation (stru);
@@ -280,8 +264,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return;
}
- errdom.visit_error_codes ( this );
- errdom.visit_methods ( this );
+ errdom.accept_all_children (this);
this.file.printf ("INSERT INTO `ValadocErrordomains` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(errdom));
this.write_documentation (errdom);
@@ -298,8 +281,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
return;
}
- en.visit_enum_values ( this );
- en.visit_methods ( this );
+ en.accept_all_children (this);
this.file.printf ("INSERT INTO `ValadocEnum` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(en));
this.write_documentation (en);
@@ -488,6 +470,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor {
[ModuleInit]
public Type register_plugin ( ) {
- return typeof (Valadoc.ValdocOrg.Doclet);
+ Valadoc.Html.get_html_link_imp = Valadoc.ValadocOrg.get_html_link;
+ return typeof (Valadoc.ValadocOrg.Doclet);
}
diff --git a/src/doclets/valadoc.org/wikirenderer.vala b/src/doclets/valadoc.org/wikirenderer.vala
index 4926c10..130deb7 100755
--- a/src/doclets/valadoc.org/wikirenderer.vala
+++ b/src/doclets/valadoc.org/wikirenderer.vala
@@ -209,3 +209,4 @@ public class Valadoc.ValadocOrg.WikiRenderer : ContentRenderer {
_stream.puts (element.content);
}
}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]