From: Florian Brosch Date: Sat, 17 Oct 2009 02:18:07 +0000 (+0200) Subject: Add initial support for valadoc.org X-Git-Tag: 0.37.1~3^2~553 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=535b8665ff9cfd95b209fef28bb886d7b10ddfc1;p=thirdparty%2Fvala.git Add initial support for valadoc.org --- diff --git a/configure.in b/configure.in index edbf8aa60..482fd65cf 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ AC_INIT(Valadoc, 0.2, flo.brosch@gmail.com) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/valadoc/valadoc.vala]) AC_CONFIG_HEADER([config.h]) - +AM_MAINTAINER_MODE AC_PROG_CC AC_PROG_LIBTOOL @@ -72,8 +72,6 @@ AC_CONFIG_FILES([Makefile src/doclets/htm/Makefile src/doclets/htm/doclet/Makefile src/doclets/valadoc.org/Makefile - src/doclets/valadoc.org/doclet/Makefile - src/doclets/valadoc.org/taglets/Makefile src/doclets/devhelp/Makefile src/doclets/devhelp/doclet/Makefile src/valadoc/Makefile]) diff --git a/src/doclets/Makefile.am b/src/doclets/Makefile.am index 8f261c9a0..126e927e0 100644 --- a/src/doclets/Makefile.am +++ b/src/doclets/Makefile.am @@ -3,10 +3,10 @@ NULL = -SUBDIRS = \ - htmlhelpers \ - htm \ - devhelp \ +SUBDIRS = htmlhelpers \ + htm \ + devhelp \ + valadoc.org \ $(NULL) diff --git a/src/doclets/htmlhelpers/doclet/htmlrenderer.vala b/src/doclets/htmlhelpers/doclet/htmlrenderer.vala index 8178062dc..0d0cd1795 100755 --- a/src/doclets/htmlhelpers/doclet/htmlrenderer.vala +++ b/src/doclets/htmlhelpers/doclet/htmlrenderer.vala @@ -161,7 +161,7 @@ public class Valadoc.Html.HtmlRenderer : ContentRenderer { public override void visit_embedded (Embedded element) { var caption = element.caption; if (caption == null) { - _stream.printf ("\"%s\"", element.url); + _stream.printf ("", element.url); } else { _stream.printf ("\"%s\"", element.url, caption); } diff --git a/src/doclets/valadoc.org/Makefile.am b/src/doclets/valadoc.org/Makefile.am index 5861f4cde..08c0086eb 100755 --- a/src/doclets/valadoc.org/Makefile.am +++ b/src/doclets/valadoc.org/Makefile.am @@ -1,18 +1,58 @@ -# src/Makefile.am +#src/Makefile.am +libdoclet_VALASOURCES = \ + doclet.vala \ + wikirenderer.vala \ + $(NULL) +BUILT_SOURCES = libdoclet.vala.stamp -if ENABLE_VALADOCORG -NULL = +libdoclet.vala.stamp: $(libdoclet_VALASOURCES) + $(VALAC) -C --vapidir ../../libvaladoc/ --vapidir ../../vapi/ --pkg valadoc-1.0 --pkg gee-1.0 --basedir . --save-temps $^ + touch $@ -SUBDIRS = \ - doclet \ - taglets \ - $(NULL) +docletdir = $(libdir)/valadoc/plugins/valadoc.org/ -endif +doclet_LTLIBRARIES = libdoclet.la + + +libdoclet_la_SOURCES = \ + libdoclet.vala.stamp \ + $(libdoclet_VALASOURCES:.vala=.c) \ + $(libdoclet_VALASOURCES:.vala=.h) \ + $(NULL) + + + +AM_CFLAGS = -g \ + -I ../../libvaladoc/ \ + $(GLIB_CFLAGS) \ + $(LIBGEE_CFLAGS) \ + $(LIBVALA_CFLAGS) \ + $(NULL) + + +libdoclet_la_LDFLAGS = -module -avoid-version \ + $(NULL) + + +libdoclet_la_LIBADD = \ + ../../libvaladoc/libvaladoc.la \ + $(GLIB_LIBS) \ + $(LIBGEE_LIBS) \ + $(LIBVALA_LIBS) \ + $(NULL) + + +EXTRA_DIST = $(libdoclet_VALASOURCES) libdoclet.vala.stamp + + +MAINTAINERCLEANFILES = \ + $(libdoclet_la_SOURCES) \ + $(NULL) + diff --git a/src/doclets/valadoc.org/doclet/doclet.vala b/src/doclets/valadoc.org/doclet.vala similarity index 59% rename from src/doclets/valadoc.org/doclet/doclet.vala rename to src/doclets/valadoc.org/doclet.vala index ea00e2031..aba527fe6 100755 --- a/src/doclets/valadoc.org/doclet/doclet.vala +++ b/src/doclets/valadoc.org/doclet.vala @@ -18,15 +18,13 @@ */ using Valadoc.Diagrams; -using Valadoc.Html; -using Valadoc; -using GLib; +using Valadoc.Content; +using Valadoc.Api; using Gee; - -public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { - private Valadoc.Html.ValaApiWriter langwriter = new Valadoc.Html.ValaApiWriter (); +public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet, Api.Visitor { + private ValadocOrg.WikiRenderer _renderer = new ValadocOrg.WikiRenderer (); private Settings settings; private FileStream types; private FileStream file; @@ -34,32 +32,29 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { private void write_documentation (Api.Node element) { if(element.documentation == null) { - return ; + return; } string path = Path.build_filename (this.settings.path, element.package.name, "documentation", element.full_name ()); FileStream file = FileStream.open (path, "w"); if (file == null) { this.run = false; - return ; + return; } - element.documentation.write_brief (file); - element.documentation.write_content (file); + _renderer.set_container (element); + _renderer.set_filestream (file); + _renderer.render (element.documentation); } - public override void initialisation (Settings settings, Tree tree) { + public void process (Settings settings, Api.Tree tree) { this.settings = settings; this.run = true; DirUtils.create (this.settings.path, 0777); - - foreach (Package pkg in tree.get_package_list ()) { - pkg.visit (this); - - if (this.run == false) { - break; - } + Gee.Collection packages = tree.get_package_list (); + foreach ( Package pkg in packages ) { + pkg.accept (this); } } @@ -102,6 +97,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { // 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 parentnodepkgname; string parentnodename; @@ -120,6 +116,7 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { } this.write_insert_into_code_element_str(element.full_name(), element.package.name, api, parentnodepkgname, parentnodename); +*/ } @@ -127,333 +124,117 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { string path = Path.build_filename(this.settings.path, pkg.name); if (GLib.DirUtils.create (path, 0777) == -1) { this.run = false; - return ; + return; } if (GLib.DirUtils.create (Path.build_filename(path, pkg.name), 0777) == -1) { this.run = false; - return ; + return; } if (GLib.DirUtils.create (Path.build_filename(path, "documentation"), 0777) == -1) { this.run = false; - return ; + return; } string fpath = Path.build_filename(path, "dump.sql"); this.file = FileStream.open (fpath , "w"); if (this.file == null) { this.run = false; - return ; - } - - - string tpath = Path.build_filename(path, "typenames.types"); - this.types = FileStream.open (tpath , "w"); - if (this.file == null) { - this.run = false; - return ; + return; } this.write_insert_into_valadoc_element_str (pkg.name, pkg.name, pkg.name); - if ( this.run == false ) { - return ; + if (this.run == false) { + return; } this.write_insert_into_valadoc_package (pkg); - if ( this.run == false ) { - return ; + if (this.run == false) { + return; } - foreach (Namespace ns in pkg.get_namespace_list()) { - ns.visit(this); - - if (this.run == false) { - return ; - } - } + pkg.visit_namespaces (this); } public override void visit_namespace (Namespace ns) { if (ns.name != null) { this.write_insert_into_valadoc_element (ns); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (ns); if (this.run == false) { - return ; + return; } } - foreach (Namespace sns in ns.get_namespace_list()) { - sns.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Interface iface in ns.get_interface_list()) { - iface.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Class cl in ns.get_class_list()) { - cl.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Struct stru in ns.get_struct_list()) { - stru.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Enum en in ns.get_enum_list()) { - en.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (ErrorDomain err in ns.get_error_domain_list()) { - err.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Delegate del in ns.get_delegate_list()) { - del.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Method m in ns.get_method_list()) { - m.visit(this, ns); - - if (this.run == false) { - return ; - } - } - - foreach (Field f in ns.get_field_list()) { - f.visit(this, ns); - - if (this.run == false) { - return ; - } - } - - foreach (Constant c in ns.get_constant_list()) { - c.visit(this, ns); - - if (this.run == false) { - return ; - } - } + 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); 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); } public override void visit_interface ( Interface iface ) { - this.types.printf ("%s|%s/%s|%s\n", iface.get_cname (), iface.package.name, iface.full_name(), "interface"); write_interface_diagram (iface, this.get_image_path (iface)); this.write_insert_into_valadoc_element (iface); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (iface); if (this.run == false) { - return ; - } - - foreach (Delegate del in iface.get_delegate_list()) { - del.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Struct stru in iface.get_struct_list()) { - stru.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Method m in iface.get_method_list()) { - m.visit(this, iface); - - if (this.run == false) { - return ; - } - } - - foreach (Field f in iface.get_field_list()) { - f.visit(this, iface); - - if (this.run == false) { - return ; - } - } - - foreach (Enum en in iface.get_enum_list()) { - en.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Class cl in iface.get_class_list()) { - cl.visit(this); - - if (this.run == false) { - return ; - } + return; } - foreach (Property prop in iface.get_property_list()) { - prop.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Signal sig in iface.get_signal_list()) { - sig.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Constant c in iface.get_constant_list()) { - c.visit(this, iface); - - if (this.run == false) { - 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 ); 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); } public override void visit_class ( Class cl ) { - this.types.printf ("%s|%s/%s|%s\n", cl.get_cname (), cl.package.name, cl.full_name(), "class"); write_class_diagram (cl, this.get_image_path (cl)); this.write_insert_into_valadoc_element (cl); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (cl); if (this.run == false) { - return ; - } - - foreach (Method m in cl.get_construction_method_list ()) { - m.visit(this, cl); - - if (this.run == false) { - return ; - } - } - - foreach (Delegate del in cl.get_delegate_list()) { - del.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Struct stru in cl.get_struct_list()) { - stru.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Method m in cl.get_method_list()) { - m.visit(this, cl); - - if (this.run == false) { - return ; - } - } - - foreach (Field f in cl.get_field_list()) { - f.visit(this, cl); - - if (this.run == false) { - return ; - } - } - - foreach (Enum en in cl.get_enum_list()) { - en.visit(this); - - if (this.run == false) { - return ; - } + return; } - foreach (Class scl in cl.get_class_list()) { - scl.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Property prop in cl.get_property_list()) { - prop.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Signal sig in cl.get_signal_list()) { - sig.visit(this); - - if (this.run == false) { - return ; - } - } - - foreach (Constant c in cl.get_constant_list()) { - c.visit(this, cl); - - if (this.run == false) { - 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 ); string modifier; if (cl.is_abstract) { @@ -467,131 +248,73 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { this.write_documentation (cl); } - public override void visit_struct ( Struct stru ) { - this.types.printf ("%s|%s/%s|%s\n", stru.get_cname (), stru.package.name, stru.full_name (), "struct"); + public override void visit_struct (Struct stru) { write_struct_diagram (stru, this.get_image_path (stru)); this.write_insert_into_valadoc_element (stru); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (stru); if (this.run == false) { - return ; + return; } - foreach (Method m in stru.get_construction_method_list ()) { - m.visit(this, stru); - - if (this.run == false) { - return ; - } - } - - foreach (Method m in stru.get_method_list()) { - m.visit(this, stru); - - if (this.run == false) { - return ; - } - } - - foreach (Field f in stru.get_field_list()) { - f.visit(this, stru); - - if (this.run == false) { - return ; - } - } - - foreach (Constant c in stru.get_constant_list()) { - c.visit(this, stru); - - if (this.run == false) { - return ; - } - } + stru.visit_construction_methods ( this ); + stru.visit_methods ( this ); + stru.visit_fields ( this ); + stru.visit_constants ( 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); } public override void visit_error_domain ( ErrorDomain errdom ) { - this.types.printf ("%s|%s/%s|%s\n", errdom.get_cname (), errdom.package.name, errdom.full_name (), "errordomain"); this.write_insert_into_valadoc_element (errdom); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (errdom); if (this.run == false) { - return ; + return; } - foreach (Method m in errdom.get_method_list()) { - m.visit(this, errdom); - - if (this.run == false) { - return ; - } - } - - foreach (ErrorCode errc in errdom.get_error_code_list()) { - errc.visit(this); - - if (this.run == false) { - return ; - } - } + errdom.visit_error_codes ( this ); + errdom.visit_methods ( 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); } public override void visit_enum ( Enum en ) { - this.types.printf ("%s|%s/%s|%s\n", en.get_cname (), en.package.name, en.full_name (), "enum"); this.write_insert_into_valadoc_element (en); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (en); if (this.run == false) { - return ; + return; } - foreach (Method m in en.get_method_list()) { - m.visit(this, en); - - if (this.run == false) { - return ; - } - } - - foreach (EnumValue enval in en.get_enum_values()) { - enval.visit(this); - - if (this.run == false) { - return ; - } - } + en.visit_enum_values ( this ); + en.visit_methods ( 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); } public override void visit_property ( Property prop ) { - string pcname = (prop.parent is Class)? ((Class)prop.parent).get_cname() : ((Interface)prop.parent).get_cname (); - this.types.printf ("%s:%s|%s/%s|%s\n", pcname, prop.name, prop.package.name, prop.full_name (), "property"); this.write_insert_into_valadoc_element (prop); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (prop); if (this.run == false) { - return ; + return; } string modifier; @@ -612,32 +335,30 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { this.write_documentation (prop); } - public override void visit_constant ( Constant constant, ConstantHandler parent ) { - this.types.printf ("%s|%s/%s|%s\n", constant.get_cname (), constant.package.name, constant.full_name (), "const"); + public override void visit_constant (Constant constant) { this.write_insert_into_valadoc_element (constant); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (constant); if (this.run == false) { - return ; + return; } this.file.printf ("INSERT INTO `ValadocConstants` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(constant)); this.write_documentation (constant); } - public override void visit_field ( Field field, FieldHandler parent ) { - this.types.printf ("%s|%s/%s|%s\n", field.get_cname (), field.package.name, field.full_name (), "field"); + public override void visit_field (Field field) { this.write_insert_into_valadoc_element (field); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (field); if (this.run == false) { - return ; + return; } string modifier; @@ -653,31 +374,29 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { } public override void visit_error_code ( ErrorCode errcode ) { - this.types.printf ("%s|%s/%s|%s\n", errcode.get_cname (), errcode.package.name, errcode.full_name (), "errorcode"); this.write_insert_into_valadoc_element (errcode); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (errcode); if (this.run == false) { - return ; + return; } this.file.printf ("INSERT INTO `ValadocErrorcodes` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n" , this.get_type_path(errcode)); this.write_documentation (errcode); } - public override void visit_enum_value ( EnumValue enval ) { - this.types.printf ("%s|%s/%s|%s\n", enval.get_cname (), enval.package.name, enval.full_name (), "enumvalue"); + public override void visit_enum_value (Api.EnumValue enval) { this.write_insert_into_valadoc_element (enval); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (enval); if (this.run == false) { - return ; + return; } this.file.printf ("INSERT INTO `ValadocEnumvalues` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(enval)); @@ -685,15 +404,14 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { } public override void visit_delegate ( Delegate del ) { - this.types.printf ("%s|%s/%s|%s\n", del.get_cname (), del.package.name, del.full_name (), "delegate"); this.write_insert_into_valadoc_element (del); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (del); if (this.run == false) { - return ; + return; } string modifier; @@ -708,33 +426,30 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { this.write_documentation (del); } - public override void visit_signal ( Signal sig ) { - string pcname = (sig.parent is Class)? ((Class)sig.parent).get_cname() : ((Interface)sig.parent).get_cname (); - this.types.printf ("%s::%s|%s/%s|%s\n", pcname, sig.name, sig.package.name, sig.full_name (), "signal"); + public override void visit_signal (Api.Signal sig) { this.write_insert_into_valadoc_element (sig); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (sig); if (this.run == false) { - return ; + return; } this.file.printf ("INSERT INTO `ValadocSignals` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(sig)); this.write_documentation (sig); } - public override void visit_method ( Method m, Valadoc.MethodHandler parent ) { - this.types.printf ("%s|%s/%s|%s\n", m.get_cname (), m.package.name, m.full_name (), "method"); + public override void visit_method (Method m) { this.write_insert_into_valadoc_element (m); if (this.run == false) { - return ; + return; } this.write_insert_into_code_element (m); if (this.run == false) { - return ; + return; } @@ -774,6 +489,6 @@ public class Valadoc.ValdocOrg.Doclet : Valadoc.Doclet { [ModuleInit] public Type register_plugin ( ) { - return typeof ( Valadoc.ValdocOrg.Doclet ); + return typeof (Valadoc.ValdocOrg.Doclet); } diff --git a/src/doclets/valadoc.org/doclet/Makefile.am b/src/doclets/valadoc.org/doclet/Makefile.am deleted file mode 100755 index 4511bc4c6..000000000 --- a/src/doclets/valadoc.org/doclet/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -# src/Makefile.am - - -libdoclet_VALASOURCES = \ - doclet.vala \ - $(NULL) - - -BUILT_SOURCES = libdoclet.vala.stamp - - -libdoclet.vala.stamp: $(libdoclet_VALASOURCES) - $(VALAC) -C --vapidir ../../../vapi/ --pkg valadoc-1.0 --basedir . --save-temps $^ - touch $@ - - -docletdir = $(libdir)/valadoc/plugins/valadoc.org/ - - -doclet_LTLIBRARIES = libdoclet.la - - -libdoclet_la_SOURCES = \ - libdoclet.vala.stamp \ - $(libdoclet_VALASOURCES:.vala=.c) \ - $(libdoclet_VALASOURCES:.vala=.h) \ - $(NULL) - - - -AM_CFLAGS = -g \ - -I ../../../libvaladoc/ \ - $(GLIB_CFLAGS) \ - $(LIBVALA_CFLAGS) \ - $(NULL) - - -libdoclet_la_LDFLAGS = -module -avoid-version \ - $(NULL) - - -libdoclet_la_LIBADD = \ - ../../../libvaladoc/libvaladoc.la \ - $(GLIB_LIBS) \ - $(LIBVALA_LIBS) \ - $(NULL) - - -EXTRA_DIST = $(libdoclet_VALASOURCES) libdoclet.vala.stamp - -MAINTAINERCLEANFILES = \ - $(libdoclet_la_SOURCES) \ - $(NULL) - diff --git a/src/doclets/valadoc.org/html-apiwriter/apiwriter-vala.vala b/src/doclets/valadoc.org/html-apiwriter/apiwriter-vala.vala deleted file mode 100755 index 6e4f147f8..000000000 --- a/src/doclets/valadoc.org/html-apiwriter/apiwriter-vala.vala +++ /dev/null @@ -1,631 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2009 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using Valadoc; -using Gee; - -public class Valadoc.Html.ValaApiWriter : ApiWriter { - private Entry keyword (string str) { - Span span = new Span (); - span.add_attribute (this.csskeyword); - span.add_child (new String(str)); - return span; - } - - private Entry parents (Api.Node type) { - Span span = new Span (); - span.add_attribute (this.cssparentlist); - - Gee.Collection? interfaces = null; - Api.Item? basetype = null; - - bool Api.Node; - - if (type is Interface) { - interfaces = ((Interface)type).get_implemented_interface_list (); - basetype = ((Interface)type).base_type; - } - else if (type is Class) { - interfaces = ((Class)type).get_implemented_interface_list (); - basetype = ((Class)type).base_type; - } - else if (type is Struct) { - basetype = ((Struct)type).base_type; - } - - if (basetype != null || (interfaces != null && interfaces.size > 0)) { - span.add_child (new String (" : ")); - } - - if (basetype != null) { - span.add_child (this.type (basetype, out Api.Node)); - } - - if (interfaces != null) { - if (basetype != null && interfaces.size > 0) { - span.add_child (new String (", ")); - } - - int i = 0; - foreach (Interface iface in interfaces) { - span.add_child (this.type (iface, out Api.Node)); - if (interfaces.size < ++i) { - span.add_child (new String (", ")); - } - } - } - - return span; - } - - private Entry type (Api.Item? type, out bool Api.Node) { - ArrayList elements = new ArrayList (); - weak Attribute css = this.csstype; - Api.Node = false; - - while (true) { - if (type == null) { - elements.insert (0, this.keyword("void")); - break; - } - else if (type is Pointer) { - elements.add (new String("*")); - type = ((Pointer)type).data_type; - } - else if (type is Array) { - //TODO: multidim. arrays - elements.add (new String("[]")); - type = ((Array)type).data_type; - } - else if (type is TypeParameter) { - elements.insert (0, new String (((TypeParameter)type).name)); - break; - } - else if (type is Api.Node) { - weak Api.Node dtype = (Api.Node)type; - if (dtype.package.name == "glib-2.0" && dtype.nspace.name == null && (dtype is Struct || dtype is Class)) { - css = this.cssbasictype; - } - - HyperLink link = new HyperLink ("/%s/%s.html".printf (dtype.package.name, dtype.full_name ()), new String (dtype.name)); - link.add_attribute (csslink); - elements.insert (0, link); - Api.Node = true; - break; - } - else { // typereference - // prepend: - ArrayList lst = this.type_reference (((TypeReference)type)); - foreach (Entry e in elements) { - lst.add (e); - } - elements = lst; - break; - } - } - - Span span = new Span.from_list (elements); - span.add_attribute (css); - return span; - } - - private ArrayList? type_parameter_list (TemplateParameterListHandler tplh) { - Collection tpllist = tplh.get_template_param_list (); - if (tpllist.size == 0) { - return null; - } - - ArrayList cnt = new ArrayList (); - int i = 0; - - cnt.add (new String ("<")); - - foreach (TypeParameter tpl in tpllist ) { - Span span = new Span (); - span.add_child (new String (tpl.name)); - span.add_attribute (this.csstype); - cnt.add (span); - - if (++i != tpllist.size) { - cnt.add (new String (", ")); - } - } - - cnt.add (new String (">")); - return cnt; - } - - private ArrayList type_reference (TypeReference typeref) { - ArrayList list = new ArrayList (); - bool Api.Node; - - StringBuilder str = new StringBuilder (); - //if(typeref.pass_ownership) { - //} - - if(typeref.is_dynamic) { - str.append ("dynamic "); - } - - if(typeref.is_owned) { - str.append ("owned "); - } - - if(typeref.is_unowned) { - str.append ("unowned "); - } - - if(typeref.is_weak) { - str.append ("weak "); - } - - if (str.len > 0) { - list.add (this.keyword (str.str)); - } - - list.add (this.type (typeref.data_type, out Api.Node)); - - Collection typeargs = typeref.get_type_arguments (); - if (typeargs.size != 0) { - list.add (new String ("<")); - int i = 0; - - foreach (TypeReference tref in typeargs) { - foreach (Entry e in this.type_reference (tref)) { - list.add (e); - } - - if (++i != typeargs.size) { - list.add (new String (", ")); - } - } - - list.add (new String (">")); - } - - if(typeref.is_nullable && Api.Node) { - list.add(new String("?")); - } - - return list; - } - - private Entry formal_parameter (FormalParameter param) { - Span span = new Span (); - span.add_attribute (this.cssformalparam); - - if (param.ellipsis) { - span.add_child (new String ("...")); - return span; - } - else { - if (param.is_out) { - span.add_child (this.keyword("out ")); - } - else if (param.is_ref) { - span.add_child (this.keyword("ref ")); - } - - span.add_childs (this.type_reference(param.type_reference)); - span.add_child (new String(" "+param.name)); - return span; - } - } - - private Entry parameter_list (ParameterListHandler paramh) { - Span rspan = new Span (); - Span span = rspan; - - span.add_attribute (cssparamlist); - - span.add_child (new String("(")); - bool default_value = false; - int i = 0; - - foreach (FormalParameter param in paramh.param_list) { - if (param.has_default_value && !default_value) { - default_value = true; - - span = new Span (); - span.add_attribute (this.cssoptparamlist); - span.add_child (new String("[")); - rspan.add_child (span); - } - - span.add_child (this.formal_parameter(param)); - if (++i != paramh.param_list.size) { - span.add_child (new String (", ")); - } - } - - if (default_value) { - span.add_child (new String("]")); - span = rspan; - } - - span.add_child (new String(")")); - return rspan; - } - - private string symbol_accessibility (SymbolAccessibility symbol) { - if (symbol.is_public) { - return "public"; - } - else if (symbol.is_protected) { - return "protected "; - } - else if (symbol.is_internal) { - return "internal "; - } - else { - return "private "; - } - } - - private Entry exception (Api.Node element) { - Span span = new Span(); - span.add_child (new String (element.full_name())); - return span; - } - - private Entry? exceptions (ExceptionHandler exh) { - Collection errs = exh.get_error_domains (); - if (errs.size == 0) { - return null; - } - - Span span = new Span (); - span.add_attribute (cssexclist); - - span.add_child (this.keyword(" throws ")); - - foreach (Api.Node type in errs) { - span.add_child (this.exception(type)); - } - - return span; - } - - public override Div from_method (Method m) { - Div api = new Div (); - api.add_attribute (cssapi); - - StringBuilder str = new StringBuilder (this.symbol_accessibility (m)); - str.append_c (' '); - - if ( m.is_abstract ) { - str.append ("abstract "); - } - else if ( m.is_virtual ) { - str.append ("virtual "); - } - else if ( m.is_override ) { - str.append ("override "); - } - - if ( m.is_static ) { - str.append ("static "); - } - - if ( m.is_inline ) { - str.append ("inline "); - } - - api.add_child (this.keyword(str.str)); - str = null; - - - // return type: - if (m.is_constructor == false) { - Collection lst = this.type_reference (m.type_reference); - api.add_childs (lst); - } - - api.add_child (new String (" "+m.name)); - - - Collection lst = this.type_parameter_list ((m.is_constructor)? (TemplateParameterListHandler)m.parent: m); - if (lst != null) { - api.add_childs (lst); - } - - api.add_child (new String (" ")); - - // type parameters - api.add_child (this.parameter_list (m)); - Entry? exceptions = this.exceptions (m); - if (exceptions != null) { - api.add_child (exceptions); - } - - if (m.is_yields) { - api.add_child (this.keyword(" yields")); - } - - api.add_child (new String(";")); - return api; - } - - public override Div from_delegate (Delegate del) { - Div api = new Div (); - api.add_attribute (cssapi); - - - api.add_child (this.keyword(this.symbol_accessibility (del) + " delegate ")); - - - // return type: - Collection lst = this.type_reference (del.type_reference); - foreach (Entry e in lst) { - api.add_child (e); - } - - api.add_child (new String (" "+del.name)); - - lst = this.type_parameter_list (del); - if (lst != null) { - api.add_childs (lst); - } - - api.add_child (new String (" ")); - - - // type parameters - api.add_child (this.parameter_list (del)); - Entry? exceptions = this.exceptions (del); - if (exceptions != null) { - api.add_child (exceptions); - } - - api.add_child (new String(";")); - return api; - } - - public override Div from_signal (Signal sig) { - Div api = new Div (); - api.add_attribute (cssapi); - - - api.add_child (this.keyword(this.symbol_accessibility (sig) + " signal ")); - - // return type: - Collection lst = this.type_reference (sig.type_reference); - foreach (Entry e in lst) { - api.add_child (e); - } - - api.add_child (new String (" "+sig.name+" ")); - // type parameters - api.add_child (this.parameter_list (sig)); - api.add_child (new String(";")); - return api; - } - - public override Div from_field (Field field) { - Div api = new Div (); - api.add_attribute (cssapi); - - StringBuilder str = new StringBuilder (this.symbol_accessibility (field)); - str.append_c (' '); - - if (field.is_volatile) { - str.append ("volatile "); - } - - if (field.is_static) { - str.append ("static "); - } - - api.add_child (this.keyword (str.str)); - - foreach (Entry e in this.type_reference (field.type_reference)) { - api.add_child (e); - } - - api.add_child (new String(" "+field.name+";")); - return api; - } - - public override Div from_constant (Constant c) { - Div api = new Div (); - api.add_attribute (cssapi); - - api.add_child (this.keyword (this.symbol_accessibility (c)+" const ")); - - foreach (Entry e in this.type_reference (c.type_reference)) { - api.add_child (e); - } - - api.add_child (new String(" "+c.name+";")); - return api; - } - - public override Div from_namespace (Namespace ns) { - Div api = new Div (); - api.add_attribute (cssapi); - - api.add_child (this.keyword ("namespace ")); - api.add_child (new String (ns.name+";")); - return api; - } - - public override Div from_enum (Enum en) { - Div api = new Div (); - api.add_attribute (cssapi); - - api.add_child (this.keyword (this.symbol_accessibility (en) + " enum ")); - api.add_child (new String (en.name+";")); - return api; - } - - public override Div from_errordomain (ErrorDomain err) { - Div api = new Div (); - api.add_attribute (cssapi); - - api.add_child (this.keyword (this.symbol_accessibility (err) + " errordomain ")); - api.add_child (new String (err.name+";")); - return api; - } - - public override Div from_enumvalue (EnumValue env) { - Div api = new Div (); - api.add_attribute (cssapi); - api.add_child (new String (env.name)); - return api; - } - - public override Div from_errorcode (ErrorCode errc) { - Div api = new Div (); - api.add_attribute (cssapi); - api.add_child (new String (errc.name)); - return api; - } - - public override Div from_struct (Struct stru) { - Div api = new Div (); - api.add_attribute (cssapi); - - api.add_child (this.keyword (this.symbol_accessibility (stru) + " struct ")); - api.add_child (new String (stru.name)); - - Collection lst = this.type_parameter_list (stru); - if (lst != null) { - api.add_childs (lst); - } - - api.add_child (this.parents (stru)); - api.add_child (new String (";")); - return api; - } - - public override Div from_class (Class cl) { - Div api = new Div (); - api.add_attribute (cssapi); - - StringBuilder str = new StringBuilder (this.symbol_accessibility (cl)); - if (cl.is_abstract) { - str.append (" abstract"); - } - - str.append (" class "); - - api.add_child (this.keyword(str.str)); - str = null; - - api.add_child (new String (cl.name)); - - Collection lst = this.type_parameter_list (cl); - if (lst != null) { - api.add_childs (lst); - } - - api.add_child (this.parents (cl)); - api.add_child (new String (";")); - return api; - } - - public override Div from_interface (Interface iface) { - Div api = new Div (); - api.add_attribute (cssapi); - - - api.add_child (this.keyword (this.symbol_accessibility (iface)+" interface ")); - api.add_child (new String (iface.name)); - - Collection lst = this.type_parameter_list (iface); - if (lst != null) { - api.add_childs (lst); - } - - api.add_child (this.parents (iface)); - api.add_child (new String (";")); - return api; - } - - private Entry from_property_accessor (PropertyAccessor propac) { - StringBuilder str = new StringBuilder (); - - if (propac.is_private) { - str.append ("private "); - } - else if (propac.is_public) { - str.append ("public "); - } - else if (propac.is_protected) { - str.append ("protected "); - } - else { - str.append ("internal "); - } - - if (propac.is_owned) { - str.append ("owned "); - } - - if (propac.is_get ) { - str.append ("get "); - } - else { - str.append ("set "); - } - - Span span = new Span (); - span.add_child (this.keyword (str.str)); - span.add_child (new String ("; ")); - return span; - } - - public override Div from_property (Property prop) { - Div api = new Div (); - api.add_attribute (cssapi); - - - StringBuilder str = new StringBuilder (this.symbol_accessibility (prop)); - if (prop.is_virtual) { - str.append ( " virtual " ); - } - else if (prop.is_abstract) { - str.append ( " abstract " ); - } - else { - str.append ( " override " ); - } - - api.add_child (this.keyword (str.str)); - - foreach (Entry e in this.type_reference (prop.type_reference)) { - api.add_child (e); - } - - api.add_child (new String(" "+prop.name+" { ")); - if (prop.setter != null) { - api.add_child(from_property_accessor (prop.setter)); - } - - if (prop.getter != null) { - api.add_child(from_property_accessor (prop.getter)); - } - - api.add_child (new String("}")); - return api; - } -} - - diff --git a/src/doclets/valadoc.org/html-apiwriter/apiwriter.vala b/src/doclets/valadoc.org/html-apiwriter/apiwriter.vala deleted file mode 100755 index 30df72b2a..000000000 --- a/src/doclets/valadoc.org/html-apiwriter/apiwriter.vala +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2009 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using Valadoc; -using Gee; - -public abstract class Valadoc.Html.ApiWriter { - protected Attribute csskeyword = new Attribute ("class", "apikeyword"); - protected Attribute cssformalparam = new Attribute ("class", "apiformalparameter"); - protected Attribute cssparamlist = new Attribute ("class", "apiparameterlist"); - protected Attribute cssexclist = new Attribute ("class", "apiexceptionlist"); - protected Attribute cssapi = new Attribute ("class", "api"); - protected Attribute csstype = new Attribute ("class", "apitype"); - protected Attribute cssbasictype = new Attribute ("class", "apibasictype"); - protected Attribute csslink = new Attribute ("class", "apilink"); - protected Attribute cssoptparamlist = new Attribute ("class", "apioptparameterlist"); - protected Attribute cssparentlist = new Attribute ("class", "parentlist"); - - public abstract Div from_method (Method m); - public abstract Div from_delegate (Delegate del); - public abstract Div from_signal (Signal sig); - public abstract Div from_field (Field field); - public abstract Div from_constant (Constant c); - public abstract Div from_namespace (Namespace ns); - public abstract Div from_enum (Enum en); - public abstract Div from_errordomain (ErrorDomain err); - public abstract Div from_enumvalue (EnumValue env); - public abstract Div from_errorcode (ErrorCode errc); - public abstract Div from_struct (Struct stru); - public abstract Div from_class (Class cl); - public abstract Div from_interface (Interface iface); - public abstract Div from_property (Property prop); - - public Div from_documented_element (Api.Node el) { - if (el is Method) { - return this.from_method ((Method)el); - } - else if (el is Delegate) { - return this.from_delegate ((Delegate)el); - } - else if (el is Signal) { - return this.from_signal ((Signal)el); - } - else if (el is Field) { - return this.from_field ((Field)el); - } - else if (el is Constant) { - return this.from_constant ((Constant)el); - } - else if (el is Namespace) { - return this.from_namespace ((Namespace)el); - } - else if (el is Enum) { - return this.from_enum ((Enum)el); - } - else if (el is ErrorDomain) { - return this.from_errordomain ((ErrorDomain)el); - } - else if (el is EnumValue) { - return this.from_enumvalue ((EnumValue)el); - } - else if (el is ErrorCode) { - return this.from_errorcode ((ErrorCode)el); - } - else if (el is Struct) { - return this.from_struct ((Struct)el); - } - else if (el is Class) { - return this.from_class ((Class)el); - } - else if (el is Interface) { - return this.from_interface ((Interface)el); - } - else { - return this.from_property ((Property)el); - } - } -} - - diff --git a/src/doclets/valadoc.org/html/attribute.vala b/src/doclets/valadoc.org/html/attribute.vala deleted file mode 100755 index 7d8e89ecc..000000000 --- a/src/doclets/valadoc.org/html/attribute.vala +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2009 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using Gee; - - -public class Valadoc.Html.Attribute { - private string name; - private string val; - - public Attribute (string name, string val) { - this.name = name; - this.val = val; - } - - public string to_string (string path) { - return " %s=\"%s\"".printf (this.name, this.val); - } -} - diff --git a/src/doclets/valadoc.org/html/block.vala b/src/doclets/valadoc.org/html/block.vala deleted file mode 100755 index 706be2cdb..000000000 --- a/src/doclets/valadoc.org/html/block.vala +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2009 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using Gee; - - -public abstract class Valadoc.Html.BlockElement : Valadoc.Html.Element { - public override string to_string (uint depth, string path) { - string depthstr = string.nfill (depth, '\t'); - StringBuilder str = new StringBuilder (depthstr); - str.append_c ('<'); - str.append (this.tag); - str.append (this.attributes_to_string (path)); - if (this.children.size > 0) { - str.append (">\n"); - - str.append (this.children_to_string (depth+1, path)); - - str.append_c ('\n'); - str.append (depthstr); - str.append ("\n"); - } - else { - str.append (" />\n"); - } - return str.str; - } -} - - -public class Valadoc.Html.Html : Valadoc.Html.BlockElement { - private static string mytag = "html"; - - public Html () { - this.tag = mytag; - } -} - - -public class Valadoc.Html.Head : Valadoc.Html.BlockElement { - private static string mytag = "head"; - - public Head () { - this.tag = mytag; - } -} - - -public class Valadoc.Html.Body : Valadoc.Html.BlockElement { - private static string mytag = "body"; - - public Body () { - this.tag = mytag; - } -} - - -public class Valadoc.Html.Div : Valadoc.Html.BlockElement { - private static string mytag = "div"; - - public Div () { - this.tag = mytag; - } -} - -public class Valadoc.Html.Script : Valadoc.Html.BlockElement { - private static string mytag = "script"; - private Attribute lang; - private Attribute type; - private Attribute src; - - public Script (string lang, string src, string type) { - this.lang = new Attribute ("type", lang); - this.type = new Attribute ("rel", type); - this.src = new Attribute ("href", src); - - this.add_attribute (this.lang); - this.add_attribute (this.type); - this.add_attribute (this.src); - - this.tag = mytag; - } -} - -public class Valadoc.Html.Headline : Valadoc.Html.BlockElement { - private static string mytag; - - public Headline (int lvl) { - mytag = "h%d".printf (lvl); - this.tag = mytag; - } -} - -public class Valadoc.Html.Title : Valadoc.Html.BlockElement { - private static string mytag = "title"; - private String title; - - public Title (string title) { - this.tag = mytag; - this.title = new String (title); - this.add_child (this.title); - } -} - -public class Valadoc.Html.Link : Valadoc.Html.BlockElement { - private static string mytag = "link"; - private Attribute lang; - private Attribute type; - private Attribute src; - - public Link (string lang, string src, string type) { - this.lang = new Attribute ("type", lang); - this.type = new Attribute ("rel", type); - this.src = new Attribute ("href", src); - - this.add_attribute (this.lang); - this.add_attribute (this.type); - this.add_attribute (this.src); - - this.tag = mytag; - } -} - diff --git a/src/doclets/valadoc.org/html/htmlwriter.vala b/src/doclets/valadoc.org/html/htmlwriter.vala deleted file mode 100755 index c69ba48f6..000000000 --- a/src/doclets/valadoc.org/html/htmlwriter.vala +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2009 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using Gee; - - -public abstract class Valadoc.Html.Entry { - public abstract string to_string (uint depth, string path); -} - - -public class Valadoc.Html.String : Valadoc.Html.Entry { - private string str; - - public String (string str) { - this.str = str; - } - - public override string to_string (uint depth, string path) { - return this.str; - } -} - - -public abstract class Valadoc.Html.Element : Valadoc.Html.Entry { - protected ArrayList attributes = new ArrayList (); - protected ArrayList children = new ArrayList (); - protected weak string tag; - - public void add_attribute (Attribute att) { - this.attributes.add (att); - } - - public void add_attributes (Collection attributes) { - foreach (Attribute att in attributes) { - this.attributes.add (att); - } - } - - public void add_child (Entry el) { - this.children.add (el); - } - - public void add_childs (Collection elements) { - foreach (Entry el in elements) { - this.children.add (el); - } - } - - protected string children_to_string (uint depth, string path) { - StringBuilder str = new StringBuilder (); - - foreach (Entry child in this.children) { - str.append (child.to_string(depth, path)); - } - return str.str; - } - - protected string attributes_to_string (string path) { - if (this.attributes == null) { - return ""; - } - - StringBuilder str = new StringBuilder (); - - foreach (Attribute att in this.attributes) { - str.append (att.to_string(path)); - } - return str.str; - } -} - - -public class Valadoc.Html.Document { - private Html root; - - public void set_root (Html root) { - this.root = root; - } - - public string to_string (string path) { - if (this.root == null) { - return ""; - } - - return this.root.to_string (0, path); - } -} - diff --git a/src/doclets/valadoc.org/html/inline.vala b/src/doclets/valadoc.org/html/inline.vala deleted file mode 100755 index b408dd179..000000000 --- a/src/doclets/valadoc.org/html/inline.vala +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2009 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using Gee; - - -public abstract class Valadoc.Html.InlineElement : Valadoc.Html.Element { - public override string to_string (uint depth, string path) { - StringBuilder str = new StringBuilder ("<"); - str.append (this.tag); - str.append (this.attributes_to_string (path)); - if (this.children.size > 0) { - str.append_c ('>'); - - str.append (this.children_to_string (depth+1, path)); - - str.append (""); - } - else { - str.append (" />"); - } - return str.str; - } -} - - -public class Valadoc.Html.Span : Valadoc.Html.InlineElement { - private static string mytag = "span"; - - public Span () { - this.tag = mytag; - } - - public Span.from_list (Collection list) { - this.tag = mytag; - - foreach (Entry e in list) { - this.children.add (e); - } - } -} - - -public class Valadoc.Html.HyperLink : Valadoc.Html.InlineElement { - private static string mytag = "a"; - private Attribute path; - - public HyperLink (string path, Entry desc) { - this.path = new Attribute ("href", path); - this.add_attribute (this.path); - this.children.add (desc); - this.tag = mytag; - } - - public HyperLink.from_list (string path, Collection descs) { - this.path = new Attribute ("href", path); - this.add_attribute (this.path); - this.tag = mytag; - - foreach (Entry desc in descs) { - this.children.add (desc); - } - } -} - - -public class Valadoc.Html.Image : Valadoc.Html.InlineElement { - private static string mytag = "img"; - - public Image (string path) { - this.tag = mytag; - } -} - -public class Valadoc.Html.Italic : Valadoc.Html.InlineElement { - private static string mytag = "i"; - - public Italic () { - this.tag = mytag; - } -} - diff --git a/src/doclets/valadoc.org/taglets/Makefile.am b/src/doclets/valadoc.org/taglets/Makefile.am deleted file mode 100755 index bb9e83f6c..000000000 --- a/src/doclets/valadoc.org/taglets/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -NULL = - - -AM_CFLAGS = -g \ - -I ../../../libvaladoc/ \ - $(GLIB_CFLAGS) \ - $(LIBVALA_CFLAGS) \ - $(NULL) - - -BUILT_SOURCES = libbasictaglets.vala.stamp - - -basictagletsdir = $(libdir)/valadoc/plugins/valadoc.org/taglets/ - - -basictaglets_LTLIBRARIES = \ - libbasictaglets.la \ - $(NULL) - - -libbasictaglets_la_VALASOURCES = \ - bold.vala \ - center.vala \ - constant.vala \ - headline.vala \ - image.vala \ - italic.vala \ - link.vala \ - list.vala \ - listelement.vala \ - notification.vala \ - paragraph.vala \ - parameter.vala \ - return.vala \ - right.vala \ - see.vala \ - since.vala \ - source.vala \ - string.vala \ - table.vala \ - tablecell.vala \ - throws.vala \ - typelink.vala \ - underline.vala \ - registerfunction.vala \ - $(NULL) - - -libbasictaglets_la_SOURCES = \ - libbasictaglets.vala.stamp \ - $(libbasictaglets_la_VALASOURCES:.vala=.c) \ - $(NULL) - - -libbasictaglets.vala.stamp: $(libbasictaglets_la_VALASOURCES) - $(VALAC) -C --vapidir ../../../vapi --pkg valadoc-1.0 --basedir . $^ - touch $@ - - -libbasictaglets_la_LDFLAGS = -module -avoid-version - - -libbasictaglets_la_LIBADD = \ - ../../../libvaladoc/libvaladoc.la \ - $(LIBGVC_LIBS) \ - $(LIBVALA_LIBS) \ - $(GLIB_LIBS) \ - $(NULL) - - -EXTRA_DIST = $(libbasictaglets_la_VALASOURCES) libbasictaglets.vala.stamp - - -MAINTAINERCLEANFILES = \ - $(libbasictaglets_la_VALASOURCES:.vala=.c) \ - $(NULL) - diff --git a/src/doclets/valadoc.org/taglets/bold.vala b/src/doclets/valadoc.org/taglets/bold.vala deleted file mode 100755 index 8320fdf02..000000000 --- a/src/doclets/valadoc.org/taglets/bold.vala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.BoldDocElement : Valadoc.BoldDocElement { - private Gee.ArrayList content; - - public override bool parse ( Gee.ArrayList content ) { - this.content = content; - return true; - } - - public override bool write ( void* res, int max, int index ) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.printf ( "++" ); - - foreach ( DocElement element in this.content ) { - element.write ( res, _max, _index ); - _index++; - } - - file.printf ( "++" ); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/center.vala b/src/doclets/valadoc.org/taglets/center.vala deleted file mode 100755 index 1bc3d7997..000000000 --- a/src/doclets/valadoc.org/taglets/center.vala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.CenterDocElement : Valadoc.CenterDocElement { - private Gee.ArrayList content; - - public override bool parse (Gee.ArrayList content) { - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.puts ("\n)( "); - - foreach (DocElement element in this.content) { - element.write ( res, _max, _index ); - _index++; - } - - file.puts ("\n"); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/constant.vala b/src/doclets/valadoc.org/taglets/constant.vala deleted file mode 100755 index f756d034a..000000000 --- a/src/doclets/valadoc.org/taglets/constant.vala +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.CodeConstantDocElement : Valadoc.CodeConstantDocElement { - private string constant; - - public override bool parse (string constant) { - this.constant = constant; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - file.puts (this.constant); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/headline.vala b/src/doclets/valadoc.org/taglets/headline.vala deleted file mode 100755 index 77506a9b6..000000000 --- a/src/doclets/valadoc.org/taglets/headline.vala +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.HeadlineDocElement : Valadoc.HeadlineDocElement { - private string title; - private int lvl; - - public override bool parse (string title, int lvl) { - this.title = title; - this.lvl = lvl; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - file.printf ("\n\n%s %s\n", string.nfill (this.lvl+1, '='), this.title); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/image.vala b/src/doclets/valadoc.org/taglets/image.vala deleted file mode 100755 index beb3dc248..000000000 --- a/src/doclets/valadoc.org/taglets/image.vala +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.ImageDocElement : Valadoc.ImageDocElement { - private string imgpath; - private string path; - private string alt; - - public override bool parse (Settings settings, Documentation pos, owned string path, owned string alt) { - if ( GLib.FileUtils.test (path, GLib.FileTest.EXISTS | GLib.FileTest.IS_REGULAR ) == false) { - return false; - } - - this.imgpath = (pos is Api.Node)? - Path.build_filename (settings.path, ((Api.Node)pos).package.name, "wiki-images", Path.get_basename (path)) : - Path.build_filename (settings.path, settings.pkg_name, "wiki-images", Path.get_basename (path)); - - this.path = path; - this.alt = alt; - - return true; - } - - public override bool write (void* res, int max, int index) { - bool tmp = copy_file (this.path, this.imgpath); - if (tmp == false) { - return false; - } - - ((GLib.FileStream)res).printf ("{{%s|%s}}", this.imgpath, (this.alt==null||this.alt=="")? this.imgpath: this.alt); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/italic.vala b/src/doclets/valadoc.org/taglets/italic.vala deleted file mode 100755 index 564a60d59..000000000 --- a/src/doclets/valadoc.org/taglets/italic.vala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.ItalicDocElement : Valadoc.ItalicDocElement { - private Gee.ArrayList content; - - public override bool parse (Gee.ArrayList content) { - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.printf ("//"); - - foreach (DocElement element in this.content) { - element.write (res, _max, _index); - _index++; - } - - file.printf ("//"); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/link.vala b/src/doclets/valadoc.org/taglets/link.vala deleted file mode 100755 index 5fc30a662..000000000 --- a/src/doclets/valadoc.org/taglets/link.vala +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.LinkDocElement : Valadoc.LinkDocElement { - private string desc; - private string path; - - public override bool parse (Settings settings, Tree tree, Documentation pos, owned string path, owned string desc) { - if ( path.has_suffix(".valadoc")&&path.has_prefix("/") ) { - if ( tree.wikitree == null ) { - return false; - } - - WikiPage? wikipage = tree.wikitree.search(path.offset(1)); - if ( wikipage == null ) { - return false; - } - - this.path = settings.pkg_name+"/"+path.substring (0, path.len()-8); - this.desc = desc; - return true; - } - - this.path = path; - this.desc = desc; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - file.printf ("[[%s|%s]]", this.path, (this.desc==null||this.desc=="")? this.path: this.desc); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/list.vala b/src/doclets/valadoc.org/taglets/list.vala deleted file mode 100755 index 88accd61f..000000000 --- a/src/doclets/valadoc.org/taglets/list.vala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - - -public class Valadoc.ValadocOrg.ListDocElement : Valadoc.ListDocElement { - private Gee.ArrayList entries; - private ListType type; - - public override bool parse (ListType type, Gee.ArrayList entries) { - this.entries = entries; - this.type = type; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.entries.size; - int _index = 0; - - foreach (ListEntryDocElement entry in this.entries) { - entry.write (res, _max, _index); - _index++; - } - - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/listelement.vala b/src/doclets/valadoc.org/taglets/listelement.vala deleted file mode 100755 index f8f95f01c..000000000 --- a/src/doclets/valadoc.org/taglets/listelement.vala +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.ListEntryDocElement : Valadoc.ListEntryDocElement { - private Gee.ArrayList content; - private ListType type; - private long lvl; - - public override bool parse (ListType type, long lvl, Gee.ArrayList content) { - this.content = content; - this.type = type; - this.lvl = lvl; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.printf ("%s%s", string.nfill (this.lvl, ' '), (this.type == ListType.SORTED)? "#": "-"); - - foreach ( DocElement element in this.content ) { - element.write ( res, _max, _index ); - _index++; - } - - file.printf ("\n"); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/notification.vala b/src/doclets/valadoc.org/taglets/notification.vala deleted file mode 100755 index 1da443ff1..000000000 --- a/src/doclets/valadoc.org/taglets/notification.vala +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using GLib; -using Gee; - - - -public class Valadoc.ValadocOrg.NotificationDocElement : Valadoc.NotificationDocElement { - private Gee.ArrayList content; - - public override bool parse ( Gee.ArrayList content ) { - this.content = content; - return true; - } - - public override bool write ( void* res, int max, int index ) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.printf ( "\n[[warning:\n"); - - foreach ( DocElement element in this.content ) { - element.write ( res, _max, _index ); - _index++; - } - - file.printf ( "\n]]\n" ); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/nparagraph.vala b/src/doclets/valadoc.org/taglets/nparagraph.vala deleted file mode 100755 index db398117e..000000000 --- a/src/doclets/valadoc.org/taglets/nparagraph.vala +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -namespace Valadoc.ValdocOrg { - public class ParagraphDocElement : Valadoc.ParagraphDocElement { - private ArrayList content; - - public override bool parse (ArrayList content) { - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - foreach (DocElement element in this.content) { - element.write (res, _max, _index); - _index++; - } - - file.printf ("\n\n"); - return true; - } - } -} - - -[ModuleInit] -public GLib.Type register_plugin (Gee.HashMap taglets) { - return typeof (Valadoc.ValdocOrg.ParagraphDocElement); -} - diff --git a/src/doclets/valadoc.org/taglets/paragraph.vala b/src/doclets/valadoc.org/taglets/paragraph.vala deleted file mode 100755 index 92dfb8d1f..000000000 --- a/src/doclets/valadoc.org/taglets/paragraph.vala +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.ParagraphDocElement : Valadoc.ParagraphDocElement { - private ArrayList content; - - public override bool parse (ArrayList content) { - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - foreach (DocElement element in this.content) { - element.write (res, _max, _index); - _index++; - } - - file.printf ("\n\n"); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/parameter.vala b/src/doclets/valadoc.org/taglets/parameter.vala deleted file mode 100755 index 6ef4d0bab..000000000 --- a/src/doclets/valadoc.org/taglets/parameter.vala +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.ParameterTaglet : Valadoc.MainTaglet { - public override int order { get { return 100; } } - private Gee.Collection content; - private string paramname; - - private static bool check_parameter_name (Valadoc.ParameterListHandler me, string name) { - if (name == "") { - return false; - } - - foreach (Valadoc.FormalParameter param in me.get_parameter_list ()) { - if (param.name == name) { - return true; - } - } - return false; - } - - public override bool write (void* ptr, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - - file.printf (" @param %s \n", this.paramname); - - int _max = this.content.size; - int _index = 0; - - foreach (DocElement tag in this.content) { - tag.write ( ptr, _max, _index ); - _index++; - } - - file.puts ( "\n" ); - return true; - } - - public override bool write_block_start (void* ptr) { - return true; - } - - public override bool write_block_end (void* ptr) { - return true; - } - - public override bool parse (Settings settings, Tree tree, Api.Node me, Gee.Collection content, ref ErrorLevel errlvl, out string errmsg) { - if (me is Valadoc.ParameterListHandler == false) { - errmsg = "Tag @param cannot be used in this context"; - errlvl = ErrorLevel.ERROR; - return false; - } - - if (content.size == 0) { - errmsg = "Parameter name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - Gee.ArrayList contentlst = new Gee.ArrayList (); - foreach (DocElement element in content) { - contentlst.add (element); - } - - DocElement tag = contentlst.get(0); - if (tag is StringTaglet == false) { - errmsg = "Parameter name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - string str = ((StringTaglet)tag).content; - weak string lposa = str.chr (-1, '\n'); - weak string lposb = str.chr (-1, ' '); - weak string lpos; - - long lposaoffset = (lposa == null)? long.MAX : str.pointer_to_offset (lposa); - long lposboffset = (lposb == null)? long.MAX : str.pointer_to_offset (lposb); - - if (lposaoffset < lposboffset) { - lpos = lposa; - } - else { - lpos = lposb; - } - - if (lpos == null) { - this.paramname = str.strip (); - ((StringTaglet)tag).content = ""; - } - else { - int namepos = (int)str.pointer_to_offset (lpos); - this.paramname = str.ndup (namepos).strip (); - ((StringTaglet)tag).content = lpos.ndup (lpos.size ()).chomp (); - } - - bool tmp = this.check_parameter_name ( (Valadoc.ParameterListHandler)me, this.paramname); - if ( tmp == false ) { - errmsg = "Parameter is not available"; - errlvl = ErrorLevel.ERROR; - return false; - } - - this.content = contentlst; - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/registerfunction.vala b/src/doclets/valadoc.org/taglets/registerfunction.vala deleted file mode 100644 index dd5870338..000000000 --- a/src/doclets/valadoc.org/taglets/registerfunction.vala +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using Valadoc; - - -[ModuleInit] -public void register_plugin (ModuleLoader loader) { - loader.underline = typeof (Valadoc.ValadocOrg.UnderlinedDocElement); - loader.table_cell = typeof (Valadoc.ValadocOrg.TableCellDocElement); - loader.table = typeof (Valadoc.ValadocOrg.TableDocElement); - loader.string = typeof (Valadoc.ValadocOrg.StringTaglet); - loader.source = typeof (Valadoc.ValadocOrg.SourceCodeDocElement); - loader.right = typeof (Valadoc.ValadocOrg.RightAlignedDocElement); - loader.paragraph = typeof (Valadoc.ValadocOrg.ParagraphDocElement); - loader.notification = typeof (Valadoc.ValadocOrg.NotificationDocElement); - loader.list_element = typeof (Valadoc.ValadocOrg.ListEntryDocElement); - loader.list = typeof (Valadoc.ValadocOrg.ListDocElement); - loader.link = typeof (Valadoc.ValadocOrg.LinkDocElement); - loader.italic = typeof (Valadoc.ValadocOrg.ItalicDocElement); - loader.image = typeof (Valadoc.ValadocOrg.ImageDocElement); - loader.headline = typeof (Valadoc.ValadocOrg.HeadlineDocElement); - loader.source_inline = typeof (Valadoc.ValadocOrg.CodeConstantDocElement); - loader.center = typeof (Valadoc.ValadocOrg.CenterDocElement); - loader.bold = typeof (Valadoc.ValadocOrg.BoldDocElement); - - loader.taglets.set ("see", typeof (Valadoc.ValadocOrg.SeeTaglet)); - loader.taglets.set ("since", typeof (Valadoc.ValadocOrg.SinceTaglet)); - loader.taglets.set ("link", typeof (Valadoc.ValadocOrg.TypeLinkInlineTaglet)); - loader.taglets.set ("throws", typeof (Valadoc.ValadocOrg.ExceptionTaglet)); - loader.taglets.set ("return", typeof (Valadoc.ValadocOrg.ReturnTaglet)); - loader.taglets.set ("param", typeof (Valadoc.ValadocOrg.ParameterTaglet)); -} - - diff --git a/src/doclets/valadoc.org/taglets/return.vala b/src/doclets/valadoc.org/taglets/return.vala deleted file mode 100755 index e2bcc5a74..000000000 --- a/src/doclets/valadoc.org/taglets/return.vala +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.ReturnTaglet : Valadoc.MainTaglet { - public override int order { get { return 300; } } - private Gee.Collection content; - - public override bool parse (Settings settings, Tree tree, Api.Node me, Gee.Collection content, ref ErrorLevel errlvl, out string errmsg) { - if (!(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate)) { - errmsg = "Tag @return cannot be used in this context"; - errlvl = ErrorLevel.ERROR; - return false; - } - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.printf (" @return "); - - foreach (DocElement element in this.content) { - element.write (res, _max, _index); - _index++; - } - - file.printf ("\n"); - return true; - } - - public override bool write_block_start (void* res) { - return true; - } - - public override bool write_block_end (void* res) { - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/right.vala b/src/doclets/valadoc.org/taglets/right.vala deleted file mode 100755 index 7029ff178..000000000 --- a/src/doclets/valadoc.org/taglets/right.vala +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.RightAlignedDocElement : Valadoc.RightAlignedDocElement { - private Gee.ArrayList content; - - public override bool parse (Gee.ArrayList content) { - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.printf ("\n)( "); - - foreach (DocElement element in this.content) { - element.write (res, _max, _index); - _index++; - } - - file.printf ("\n"); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/see.vala b/src/doclets/valadoc.org/taglets/see.vala deleted file mode 100755 index 05b9a85b2..000000000 --- a/src/doclets/valadoc.org/taglets/see.vala +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using Valadoc; -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.SeeTaglet : MainTaglet { - public override int order { get { return 400; } } - private string typename; - - protected override bool write_block_start (void* res) { - return true; - } - - protected override bool write_block_end (void* res) { - return true; - } - - protected override bool write (void* res, int max, int index) { - ((GLib.FileStream)res).printf (" @see %s\n", this.typename); - return true; - } - - public override bool parse (Settings settings, Tree tree, Api.Node me, Gee.Collection content, ref ErrorLevel errlvl, out string errmsg) { - if (content.size != 1) { - errmsg = "Type name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - Gee.Iterator it = content.iterator (); - it.next (); - - DocElement element = it.get (); - if (element is StringTaglet == false) { - errmsg = "Type name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - Valadoc.Api.Node? node = tree.search_symbol_str (me, ((StringTaglet)element).content.strip ()); - if (node == null) { - errmsg = "Linked type is not available"; - errlvl = ErrorLevel.ERROR; - return false; - } - - this.typename = node.full_name (); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/since.vala b/src/doclets/valadoc.org/taglets/since.vala deleted file mode 100755 index 996914ae4..000000000 --- a/src/doclets/valadoc.org/taglets/since.vala +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.SinceTaglet : Valadoc.MainTaglet { - public override int order { get { return 400; } } - private StringTaglet content; - - public override bool write_block_start (void* ptr) { - return true; - } - - public override bool write_block_end (void* res) { - return true; - } - - public override bool write (void* res, int max, int index) { - if (max != index+1 ) - ((GLib.FileStream)res).printf (" @since %s\n", this.content.content); - - return true; - } - - public override bool parse (Settings settings, Tree tree, Api.Node me, Gee.Collection content, ref ErrorLevel errlvl, out string errmsg) { - if (content.size != 1) { - errmsg = "Version name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - Gee.Iterator it = content.iterator (); - it.next (); - - DocElement element = it.get (); - if (element is StringTaglet == false) { - errmsg = "Version name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - this.content = (StringTaglet)element; - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/source.vala b/src/doclets/valadoc.org/taglets/source.vala deleted file mode 100755 index 98bf2d208..000000000 --- a/src/doclets/valadoc.org/taglets/source.vala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.SourceCodeDocElement : Valadoc.SourceCodeDocElement { - private Language lang; - private int srclines; - private string src; - - public override bool parse (string src, Language lang) { - this.src = src; - this.lang = lang; - this.srclines=0; - - for (weak string str=this.src; str.get_char()!='\0'; str=str.next_char()) { - if (str.get_char () == '\n') { - this.srclines++; - } - } - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - file.printf ("\n{{{\n%s\n}}}\n", src); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/string.vala b/src/doclets/valadoc.org/taglets/string.vala deleted file mode 100755 index e1ff0c638..000000000 --- a/src/doclets/valadoc.org/taglets/string.vala +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.StringTaglet : Valadoc.StringTaglet { - public override bool parse (string content) { - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - file.puts (this.content); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/table.vala b/src/doclets/valadoc.org/taglets/table.vala deleted file mode 100755 index b87b4da4a..000000000 --- a/src/doclets/valadoc.org/taglets/table.vala +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.TableDocElement : Valadoc.TableDocElement { - private Gee.ArrayList> cells; - - public override void parse (Gee.ArrayList> cells) { - this.cells = cells; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - - file.puts ("\n"); - - foreach (Gee.ArrayList row in this.cells) { - int _max = row.size; - int _index = 0; - - foreach (TableCellDocElement cell in row) { - file.puts ("\n ||"); - cell.write (res, _max, _index ); - _index++; - } - } - - file.puts ("\n"); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/tablecell.vala b/src/doclets/valadoc.org/taglets/tablecell.vala deleted file mode 100755 index 8f654096b..000000000 --- a/src/doclets/valadoc.org/taglets/tablecell.vala +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.TableCellDocElement : Valadoc.TableCellDocElement { - private Gee.ArrayList content; - private TextVerticalPosition hpos; - private TextPosition pos; - private int dcells; - private int cells; - - public override void parse (TextPosition pos, TextVerticalPosition hpos, int cells, int dcells, Gee.ArrayList content) { - this.content = content; - this.dcells = dcells; - this.cells = cells; - this.hpos = hpos; - this.pos = pos; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - GLib.StringBuilder td = new GLib.StringBuilder (); - if (this.cells != 1) { - td.append ("|"); - td.append (this.cells.to_string()); - } - - if (this.dcells != 1) { - td.append ("-"); - td.append (this.dcells.to_string()); - } - - switch (this.pos) { - case TextPosition.CENTER: - td.append (")("); - break; - case TextPosition.RIGHT: - td.append (")) "); - break; - } - - switch (this.hpos) { - case TextVerticalPosition.TOP: - td.append ("^"); - break; - case TextVerticalPosition.BOTTOM: - td.append ("v"); - break; - } - - if (td.len > 0) { - file.printf ("<%s>", td.str); - } - - file.printf (" "); - - foreach (DocElement cell in this.content) { - cell.write (res, _max, _index ); - _index++; - } - file.puts (" || \n" ); - return true; - } -} - - diff --git a/src/doclets/valadoc.org/taglets/throws.vala b/src/doclets/valadoc.org/taglets/throws.vala deleted file mode 100755 index fbc3117d0..000000000 --- a/src/doclets/valadoc.org/taglets/throws.vala +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.ExceptionTaglet : Valadoc.MainTaglet { - public override int order { get { return 200; } } - private Gee.ArrayList content; - private string paramname; - - public override bool parse ( Settings settings, Tree tree, Api.Node me, Gee.Collection content, ref ErrorLevel errlvl, out string errmsg ) { - if ( me is Valadoc.ExceptionHandler == false ) { - errmsg = "Tag @throws cannot be used in this context"; - errlvl = ErrorLevel.ERROR; - return false; - } - - if ( content.size == 0 ) { - errmsg = "Exception name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - - Gee.ArrayList contentlst = new Gee.ArrayList (); - foreach ( DocElement element in content ) { - contentlst.add ( element ); - } - - DocElement tag = contentlst.get( 0 ); - if ( tag is StringTaglet == false ) { - errmsg = "Exception name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - string str = ((StringTaglet)tag).content; - weak string lposa = str.chr (-1, '\n'); - weak string lposb = str.chr (-1, ' '); - weak string lpos; - - long lposaoffset = (lposa == null)? long.MAX : str.pointer_to_offset ( lposa ); - long lposboffset = (lposb == null)? long.MAX : str.pointer_to_offset ( lposb ); - - if ( lposaoffset < lposboffset ) { - lpos = lposa; - } - else { - lpos = lposb; - } - - if ( lpos == null ) { - this.paramname = str.strip (); - ((StringTaglet)tag).content = ""; - } - else { - int namepos = (int)str.pointer_to_offset ( lpos ); - this.paramname = str.ndup ( namepos ).strip (); - ((StringTaglet)tag).content = lpos.ndup ( lpos.size () ).chomp (); - } - - bool tmp = this.check_exception_parameter_name ( (Valadoc.ExceptionHandler)me, this.paramname ); - if ( tmp == false ) { - errmsg = "Exception name was expected"; - errlvl = ErrorLevel.ERROR; - return false; - } - - this.content = contentlst; - return true; - } - - private bool check_exception_parameter_name ( Valadoc.ExceptionHandler me, string paramname ) { - string paramname2 = "."+paramname; - - foreach ( Api.Node param in me.get_error_domains() ) { - if ( param.name == paramname || param.full_name() == paramname || param.full_name().has_suffix(paramname2) ) { - return true; - } - } - return false; - } - - public override bool write (void* ptr, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - file.printf (" @throws %s ", this.paramname); - - int _max = this.content.size; - int _index = 0; - - foreach (DocElement element in this.content) { - element.write (ptr, _max, _index); - _index++; - } - - file.puts ( "\n" ); - return true; - } - - public override bool write_block_start (void* ptr) { - return true; - } - - public override bool write_block_end (void* ptr) { - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/taglets/typelink.vala b/src/doclets/valadoc.org/taglets/typelink.vala deleted file mode 100755 index a261fe82d..000000000 --- a/src/doclets/valadoc.org/taglets/typelink.vala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - - -public class Valadoc.ValadocOrg.TypeLinkInlineTaglet : Valadoc.InlineTaglet { - private string typename = null; - - protected override string to_string () { - return this.typename; - } - - protected override bool write (void* res, int max, int index) { - ((GLib.FileStream)res).printf ("{@link %s}", this.typename); - return true; - } - - protected override bool parse (Settings settings, Tree tree, Documentation self, string content, ref ErrorLevel errlvl, out string? errmsg) { - Valadoc.Api.Node? element = tree.search_symbol_str ( (self is Api.Node)? (Api.Node)self : null, content.strip() ); - if (element == null) { - errmsg = "Linked type is not available"; - errlvl = ErrorLevel.ERROR; - return false; - } - - this.typename = element.package.name+"/"+element.full_name (); - return true; - } -} - diff --git a/src/doclets/valadoc.org/taglets/underline.vala b/src/doclets/valadoc.org/taglets/underline.vala deleted file mode 100755 index f009f9bb6..000000000 --- a/src/doclets/valadoc.org/taglets/underline.vala +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Valadoc - a documentation tool for vala. - * Copyright (C) 2008 Florian Brosch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -using GLib; -using Gee; - - -public class Valadoc.ValadocOrg.UnderlinedDocElement : Valadoc.UnderlinedDocElement { - private Gee.ArrayList content; - - public override bool parse (Gee.ArrayList content) { - this.content = content; - return true; - } - - public override bool write (void* res, int max, int index) { - weak GLib.FileStream file = (GLib.FileStream)res; - int _max = this.content.size; - int _index = 0; - - file.printf ("__"); - - foreach (DocElement element in this.content) { - element.write (res, _max, _index); - _index++; - } - - file.printf ("__"); - return true; - } -} - - - diff --git a/src/doclets/valadoc.org/wikirenderer.vala b/src/doclets/valadoc.org/wikirenderer.vala new file mode 100755 index 000000000..716134e8a --- /dev/null +++ b/src/doclets/valadoc.org/wikirenderer.vala @@ -0,0 +1,211 @@ +/* wikirenderer.vala + * + * Valadoc - a documentation tool for vala. + * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Author: + * Florian Brosch + */ + +using Valadoc.Content; + + +public class Valadoc.ValadocOrg.WikiRenderer : ContentRenderer { + private Documentation? _container; + private unowned FileStream _stream; + + public void set_container (Documentation? container) { + _container = container; + } + + public void set_filestream (FileStream stream) { + _stream = stream; + } + + public override void render (ContentElement element) { + element.accept (this); + } + + public override void render_children (ContentElement element) { + element.accept_children (this); + } + + private delegate void TagletWrite (Taglet taglet); + + private void write_taglets (Gee.List taglets, TagletWrite write) { + foreach (var taglet in taglets) { + write (taglet); + } + } + + public override void visit_comment (Comment element) { + Gee.List taglets; + + taglets = element.find_taglets ((Api.Node) _container, typeof (Taglets.Since)); + write_taglets ( + taglets, + (taglet) => { + var since = taglet as Taglets.Since; + _stream.printf ("\n\nSince %s.\n", since.version); + }); + + taglets = element.find_taglets ((Api.Node) _container, typeof (Taglets.Deprecated)); + write_taglets ( + taglets, + (taglet) => { + _stream.puts ("\n\nDeprecated.\n\n"); + }); + + // Write description + element.accept_children (this); + + taglets = element.find_taglets ((Api.Node) _container, typeof (Taglets.Param)); + write_taglets ( + taglets, + (taglet) => { + var param = taglet as Taglets.Param; + _stream.printf ("@param %s ", param.parameter_name); + param.accept_children (this); + _stream.putc ('\n'); + }); + + taglets = element.find_taglets ((Api.Node) _container, typeof (Taglets.Return)); + write_taglets ( + taglets, + (taglet) => { + var param = taglet as Taglets.Return; + _stream.puts ("@return "); + param.accept_children (this); + _stream.putc ('\n'); + }); + + taglets = element.find_taglets ((Api.Node) _container, typeof (Taglets.Throws)); + write_taglets ( + taglets, + (taglet) => { + var exception = taglet as Taglets.Throws; + _stream.printf ("@throws %s ", exception.error_domain_name); + exception.accept_children (this); + _stream.putc ('\n'); + }); + + taglets = element.find_taglets ((Api.Node) _container, typeof (Taglets.See)); + write_taglets ( + taglets, + (taglet) => { + var see = taglet as Taglets.See; + _stream.printf ("@see %s/%s\n", see.symbol.package.name, see.symbol.full_name ()); + }); + } + + public override void visit_embedded (Embedded element) { + var caption = element.caption; + if (caption == null) { + _stream.printf ("{{{%s}}}", element.url); + } else { + _stream.printf ("{{{%s|%s}}}", element.url, caption); + } + } + + public override void visit_headline (Headline element) { + _stream.puts (string.nfill (element.level+1, '=')); + element.accept_children (this); + _stream.putc ('\n'); + } + + public override void visit_link (Link element) { + var label = element.label; + _stream.printf ("[[%s|%s]]", + element.url, + (label == null || label == "") ? element.url : label); + } + + public override void visit_symbol_link (SymbolLink element) { + _stream.printf ("{ @link %s/%s }", element.symbol.package.name, element.symbol.full_name ()); + } + + public override void visit_list (Content.List element) { + } + + public override void visit_list_item (ListItem element) { + } + + public override void visit_page (Page element) { + element.accept_children (this); + } + + public override void visit_paragraph (Paragraph element) { + _stream.printf ("\n\n"); + element.accept_children (this); + } + + public override void visit_run (Run element) { + string tag = null; + switch (element.style) { + case Run.Style.BOLD: + tag = "++"; + break; + case Run.Style.ITALIC: + tag = "//"; + break; + case Run.Style.UNDERLINED: + tag = "__"; + break; +/* case Run.Style.MONOSPACED: + break; + case Run.Style.STROKE: + break; +*/ } + if (tag != null) { + _stream.puts (tag); + } + element.accept_children (this); + if (tag != null) { + _stream.puts (tag); + } + } + + public override void visit_source_code (SourceCode element) { + _stream.printf ("\n{{{\n"); + _stream.printf (element.code); + _stream.printf ("\n}}}\n"); + } + + public override void visit_table (Table element) { + _stream.putc ('\n'); + element.accept_children (this); + _stream.putc ('\n'); + } + + public override void visit_table_cell (TableCell element) { + _stream.putc (' '); + element.accept_children (this); + _stream.puts (" ||"); + } + + public override void visit_table_row (TableRow element) { + element.accept_children (this); + _stream.putc ('\n'); + } + + public override void visit_taglet (Taglet element) { + } + + public override void visit_text (Text element) { + _stream.puts (element.content); + } +}