From: Florian Brosch Date: Mon, 8 Feb 2010 22:11:16 +0000 (+0100) Subject: valadoc.org: switch to static content X-Git-Tag: 0.37.1~3^2~495 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d335559fd8ed8388ec7ef20180fdcf61f6e32233;p=thirdparty%2Fvala.git valadoc.org: switch to static content --- diff --git a/src/doclets/valadoc.org/Makefile.am b/src/doclets/valadoc.org/Makefile.am index 297383839..e9006d227 100755 --- a/src/doclets/valadoc.org/Makefile.am +++ b/src/doclets/valadoc.org/Makefile.am @@ -2,8 +2,8 @@ libdoclet_VALASOURCES = \ + htmlrenderer.vala \ doclet.vala \ - wikirenderer.vala \ $(NULL) diff --git a/src/doclets/valadoc.org/doclet.vala b/src/doclets/valadoc.org/doclet.vala index 1ec23b438..c1dc37cb1 100755 --- a/src/doclets/valadoc.org/doclet.vala +++ b/src/doclets/valadoc.org/doclet.vala @@ -20,459 +20,261 @@ * Florian Brosch */ -using Valadoc.Diagrams; -using Valadoc.Content; -using Valadoc.Html; +using Valadoc; using Valadoc.Api; +using Valadoc.Html; using Gee; + namespace Valadoc.ValadocOrg { public string? get_html_link (Settings settings, Documentation element, Documentation? pos) { - if (element is Api.Node) { - return Path.build_filename("/"+((Api.Node)element).package.name, ((Api.Node)element).full_name () + ".html"); + if (element is Visitable) { + if (((Visitable)element).is_visitor_accessible (settings) == false) { + return null; + } } - return null; - } -} -public class Valadoc.ValadocOrg.Doclet : BasicDoclet { - private WikiRenderer _wikirenderer; - private FileStream file; - private bool run; - - private void write_documentation (Api.Node element) { - if(element.documentation == null) { - return; + if (element is Api.Node) { + if (((Api.Node)element).package.is_visitor_accessible (settings) == false) { + return null; + } } - 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; + if ( pos == null || ((pos!=null)?(pos is WikiPage)? ((WikiPage)pos).name=="index.valadoc": false : false) ) { + if (element is Package) { + return Path.build_filename(((Package)element).name, "index.htm"); + } else if ( element is Api.Node ) { + return Path.build_filename("..", ((Api.Node)element).package.name, ((Api.Node)element).full_name()+".html"); + } else if (element is WikiPage) { + if (pos == element) { + return "#"; + } + else { + string wikiname = ((WikiPage)element).name; + wikiname = wikiname.ndup (wikiname.len()-8); + wikiname = wikiname.replace ("/", ".") + ".html"; + return Path.build_filename ("content", wikiname); + } + } } - - _wikirenderer.set_container (element); - _wikirenderer.set_filestream (file); - _wikirenderer.render (element.documentation); + else if (pos is Api.Node) { + if (element is Package) { + return Path.build_filename("..", ((Package)element).name, "index.htm"); + } else if (element is Api.Node) { + return Path.build_filename("..", ((Api.Node)element).package.name, ((Api.Node)element).full_name()+".html"); + } else if ( element is WikiPage ) { + string wikiname = ((WikiPage)element).name; + wikiname = wikiname.ndup (wikiname.len()-8); + wikiname = wikiname.replace ("/", ".")+".html"; + if ( wikiname == "index.html" ) { + return Path.build_filename ("..", wikiname); + } else { + return Path.build_filename ("..", "content", wikiname); + } + } + } + else if ( pos is WikiPage ) { + if ( element is Package ) { + return Path.build_filename ("..", ((Package)element).name, "index.htm"); + } else if (element is Api.Node) { + return Path.build_filename ("..", ((Api.Node)element).package.name, ((Api.Node)element).full_name()+".html"); + } else if (element is WikiPage) { + string wikiname = ((WikiPage) element).name; + wikiname = wikiname.ndup ( wikiname.len ()-8 ); + wikiname = wikiname.replace ("/", ".")+".html"; + + if (wikiname == "index.html") { + return Path.build_filename ("..", wikiname); + } else { + return wikiname; + } + } + } + return null; } +} - public override void process (Settings settings, Api.Tree tree) { - this.settings = settings; - this.run = true; - //writer - _wikirenderer = new ValadocOrg.WikiRenderer (); - _renderer = new HtmlRenderer (this); +public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet { + private const string css_path_wiki = "../../wiki-style.css"; + private const string css_path = "../reference-style.css"; + private ArrayList nodes = new ArrayList (); + private string package_dir_name = ""; // remove + private Api.Tree tree; - DirUtils.create (this.settings.path, 0777); - Gee.Collection packages = tree.get_package_list (); - foreach ( Package pkg in packages ) { - pkg.accept (this); - } + construct { + _renderer = new ValadocOrg.HtmlRenderer (this); } - private string get_image_path (Api.Node element) { - return Path.build_filename (this.settings.path, element.package.name, element.package.name, element.full_name () + ".png"); + private string get_path (Api.Node element) { + return element.full_name () + ".html"; } - private void write_insert_into_valadoc_element_str (string name, string pkgname, string fullname) { - string fullname2 = (pkgname == fullname)? pkgname : pkgname+"/"+fullname; - this.file.printf ("INSERT INTO `ValadocApiElement` (`name`, `fullname`) VALUES ('%s', '%s');\n", name, fullname2); + private string get_real_path (Api.Node element, string file_extension) { + return GLib.Path.build_filename (this.settings.path, this.package_dir_name, element.full_name () + file_extension); } - private void write_insert_into_valadoc_element (Api.Node element) { - string name = element.name; - string fullname; + public override void process (Settings settings, Api.Tree tree) { + this.settings = settings; + this.tree = tree; - if (name == null) { - name = element.package.name; - fullname = name; - } - else { - fullname = element.full_name(); - } + DirUtils.create (this.settings.path, 0777); - this.write_insert_into_valadoc_element_str(name, element.package.name, fullname); + write_wiki_pages (tree, css_path_wiki, Path.build_filename (this.settings.path, this.settings.pkg_name, "content")); + tree.accept (this); } - private void write_insert_into_valadoc_package (Package pkg) { - this.file.printf ("INSERT INTO `ValadocPackage` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE `fullname`='%s' LIMIT 1));\n", pkg.name); + public override void visit_tree (Api.Tree tree) { + tree.accept_children (this); } + public override void visit_package (Package package) { + string pkg_name = package.name; + string path = GLib.Path.build_filename (this.settings.path, pkg_name); + string imgpath = GLib.Path.build_filename (path, "img"); - private void write_insert_into_code_element (Api.Node element) { - string fullname = element.full_name (); - string pkgname = element.package.name; - string parentnodepkgname; - string parentnodename; + var rt = DirUtils.create (path, 0777); + rt = DirUtils.create (imgpath, 0777); - Api.Item parent = element.parent; - if (parent is Api.Node) { - parentnodepkgname = ((Api.Node)parent).package.name; - parentnodename = ((Api.Node)parent).full_name(); - if (parentnodename == null) { - parentnodename = parentnodepkgname; - } - } - else { - parentnodepkgname = ((Package)parent).name; - parentnodename = parentnodepkgname; - } - string parentnodetypepath = (parentnodepkgname == parentnodename)? parentnodepkgname : parentnodepkgname+"/"+parentnodename; - string typepath = pkgname+"/"+fullname; - this.file.printf ("INSERT INTO `ValadocCodeElement` (`id`, `parent`, `valaapi`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), (SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), '", typepath, parentnodetypepath); - var writer = new Html.MarkupWriter (file, false); - writer.set_wrap (false); - _renderer.set_writer (writer); - _renderer.set_container (element); - _renderer.render (element.signature); - this.file.puts ("');\n"); - } - - public override void visit_package (Package pkg) { - string path = Path.build_filename(this.settings.path, pkg.name); - if (GLib.DirUtils.create (path, 0777) == -1) { - this.run = false; - return; - } - - if (GLib.DirUtils.create (Path.build_filename(path, pkg.name), 0777) == -1) { - this.run = false; - return; - } - - if (GLib.DirUtils.create (Path.build_filename(path, "documentation"), 0777) == -1) { - this.run = false; - return; - } + this.package_dir_name = pkg_name; - string fpath = Path.build_filename(path, "dump.sql"); - this.file = FileStream.open (fpath , "w"); - if (this.file == null) { - this.run = false; - return; - } - this.write_insert_into_valadoc_element_str (pkg.name, pkg.name, pkg.name); - if (this.run == false) { - return; - } + // content area: + string filepath = GLib.Path.build_filename (path, "index.content.tpl"); - this.write_insert_into_valadoc_package (pkg); - if (this.run == false) { - return; + WikiPage wikipage = null; + if (this.settings.pkg_name == package.name && this.tree.wikitree != null) { + wikipage = this.tree.wikitree.search ("index.valadoc"); } - pkg.accept_all_children (this); - } + GLib.FileStream file = GLib.FileStream.open (filepath, "w"); + writer = new Html.MarkupWriter (file, false); + _renderer.set_writer (writer); + write_package_content (package, package, wikipage); + file = null; - public override void visit_namespace (Namespace ns) { - if (ns.name != null) { - this.write_insert_into_valadoc_element (ns); - if (this.run == false) { - return; - } - this.write_insert_into_code_element (ns); - if (this.run == false) { - return; - } - } + // navigation: + filepath = GLib.Path.build_filename (path, "index.navi.tpl"); + file = GLib.FileStream.open (filepath, "w"); + writer = new Html.MarkupWriter (file, false); + _renderer.set_writer (writer); + write_navi_package (package); + file = null; - ns.accept_all_children (this); - this.file.printf ("INSERT INTO `ValadocNamespaces` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(ns)); - this.write_documentation (ns); + package.accept_all_children (this); } - public override void visit_interface ( Interface iface ) { - write_interface_diagram (iface, this.get_image_path (iface)); + private void process_compound_node (Api.Node node) { + if (node.name != null) { + // content area: + string rpath = this.get_real_path (node, ".content.tpl"); + GLib.FileStream file = GLib.FileStream.open (rpath, "w"); + writer = new Html.MarkupWriter (file, false); + _renderer.set_writer (writer); + write_symbol_content (node, "/doc/glib-2.0/img/"); + file = null; - this.write_insert_into_valadoc_element (iface); - if (this.run == false) { - return; - } - this.write_insert_into_code_element (iface); - if (this.run == false) { - return; + // navigation: + rpath = this.get_real_path (node, ".navi.tpl"); + file = GLib.FileStream.open (rpath, "w"); + writer = new Html.MarkupWriter (file, false); + _renderer.set_writer (writer); + write_navi_symbol (node); + file = null; } - iface.accept_all_children (this); - - this.file.printf ("INSERT INTO `ValadocInterfaces` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(iface)); - this.write_documentation (iface); + node.accept_all_children (this); } - public override void visit_class ( Class cl ) { - write_class_diagram (cl, this.get_image_path (cl)); - - this.write_insert_into_valadoc_element (cl); - if (this.run == false) { - return; - } + private void process_node (Api.Node node) { + // content area: + string rpath = this.get_real_path (node, ".content.tpl"); + GLib.FileStream file = GLib.FileStream.open (rpath, "w"); + writer = new Html.MarkupWriter (file, false); + _renderer.set_writer (writer); + write_symbol_content (node, "/doc/glib-2.0/img/"); + file = null; - this.write_insert_into_code_element (cl); - if (this.run == false) { - return; - } - cl.accept_all_children (this); + // navigation: + rpath = this.get_real_path (node, ".navi.tpl"); + file = GLib.FileStream.open (rpath, "w"); + writer = new Html.MarkupWriter (file, false); + _renderer.set_writer (writer); + write_navi_symbol (node); + file = null; - string modifier; - if (cl.is_abstract) { - modifier = "ABSTRACT"; - } - else { - modifier = "NORMAL"; - } - this.file.printf ("INSERT INTO `ValadocClasses` (`id`, `modifier`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1),'%s');\n", this.get_type_path(cl), modifier); - this.write_documentation (cl); + node.accept_all_children (this); } - 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; - } - - this.write_insert_into_code_element (stru); - if (this.run == false) { - return; - } - - stru.accept_all_children (this); - - this.file.printf ("INSERT INTO `ValadocStructs` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(stru)); - this.write_documentation (stru); + public override void visit_namespace (Api.Namespace item) { + process_compound_node (item); } - public override void visit_error_domain ( ErrorDomain errdom ) { - this.write_insert_into_valadoc_element (errdom); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (errdom); - if (this.run == false) { - return; - } - - errdom.accept_all_children (this); - - this.file.printf ("INSERT INTO `ValadocErrordomains` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(errdom)); - this.write_documentation (errdom); + public override void visit_interface (Api.Interface item) { + process_compound_node (item); } - public override void visit_enum ( Enum en ) { - this.write_insert_into_valadoc_element (en); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (en); - if (this.run == false) { - return; - } - - en.accept_all_children (this); - - this.file.printf ("INSERT INTO `ValadocEnum` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1));\n", this.get_type_path(en)); - this.write_documentation (en); + public override void visit_class (Api.Class item) { + process_compound_node (item); } - public override void visit_property ( Property prop ) { - this.write_insert_into_valadoc_element (prop); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (prop); - if (this.run == false) { - return; - } - - string modifier; - if (prop.is_virtual) { - modifier = "VIRTUAL"; - } - else if (prop.is_abstract) { - modifier = "ABSTRACT"; - } - //else if (prop.is_static) { - // modifier = "STATIC"; - //} - else { - modifier = "NORMAL"; - } - - this.file.printf ("INSERT INTO `ValadocProperties` (`id`, `modifier`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), '%s');\n", this.get_type_path(prop), modifier); - this.write_documentation (prop); + public override void visit_struct (Api.Struct item) { + process_compound_node (item); } - public override void visit_constant (Constant constant) { - this.write_insert_into_valadoc_element (constant); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (constant); - if (this.run == false) { - 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_error_domain (Api.ErrorDomain item) { + process_node (item); } - public override void visit_field (Field field) { - this.write_insert_into_valadoc_element (field); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (field); - if (this.run == false) { - return; - } - - string modifier; - if (field.is_static) { - modifier = "STATIC"; - } - else { - modifier = "NORMAL"; - } - - this.file.printf ("INSERT INTO `ValadocFields` (`id`, `modifier`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), '%s');\n", this.get_type_path(field), modifier); - this.write_documentation (field); + public override void visit_enum (Api.Enum item) { + process_node (item); } - public override void visit_error_code ( ErrorCode errcode ) { - this.write_insert_into_valadoc_element (errcode); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (errcode); - if (this.run == false) { - 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_property (Api.Property item) { + process_node (item); } - public override void visit_enum_value (Api.EnumValue enval) { - this.write_insert_into_valadoc_element (enval); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (enval); - if (this.run == false) { - 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)); - this.write_documentation (enval); + public override void visit_constant (Api.Constant item) { + process_node (item); } - public override void visit_delegate ( Delegate del ) { - this.write_insert_into_valadoc_element (del); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (del); - if (this.run == false) { - return; - } - - string modifier; - if (del.is_static) { - modifier = "STATIC"; - } - else { - modifier = "NORMAL"; - } - - this.file.printf ("INSERT INTO `ValadocDelegates` (`id`, `modifier`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY`fullname`='%s' LIMIT 1), '%s');\n", this.get_type_path(del), modifier); - this.write_documentation (del); + public override void visit_field (Api.Field item) { + process_node (item); } - public override void visit_signal (Api.Signal sig) { - this.write_insert_into_valadoc_element (sig); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (sig); - if (this.run == false) { - 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_error_code (Api.ErrorCode item) { + process_node (item); } - public override void visit_method (Method m) { - this.write_insert_into_valadoc_element (m); - if (this.run == false) { - return; - } - - this.write_insert_into_code_element (m); - if (this.run == false) { - return; - } - - - if (m.is_constructor) { - this.file.printf ("INSERT INTO `ValadocConstructors` (`id`) VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE `fullname`='%s' LIMIT 1));\n", this.get_type_path(m)); - } - else { - string modifier; - if (m.is_abstract) { - modifier = "ABSTRACT"; - } - else if (m.is_static) { - modifier = "STATIC"; - } - else if (m.is_virtual) { - modifier = "VIRTUAL"; - } - else { - modifier = "NORMAL"; - } + public override void visit_enum_value (Api.EnumValue item) { + process_node (item); + } - this.file.printf("INSERT INTO `ValadocMethods` (`id`, `modifier`)VALUES ((SELECT `id` FROM `ValadocApiElement` WHERE BINARY `fullname`='%s' LIMIT 1), '%s');\n", this.get_type_path(m), modifier); - } - this.write_documentation (m); + public override void visit_delegate (Api.Delegate item) { + process_node (item); } - private string get_type_path (Api.Node element) { - if(element.name == null) { - return element.package.name; - } + public override void visit_signal (Api.Signal item) { + process_node (item); + } - return element.package.name+"/"+element.full_name(); + public override void visit_method (Api.Method item) { + process_node (item); } } - - [ModuleInit] -public Type register_plugin ( ) { +public Type register_plugin () { Valadoc.Html.get_html_link_imp = Valadoc.ValadocOrg.get_html_link; return typeof (Valadoc.ValadocOrg.Doclet); } diff --git a/src/doclets/valadoc.org/htmlrenderer.vala b/src/doclets/valadoc.org/htmlrenderer.vala new file mode 100755 index 000000000..31741c272 --- /dev/null +++ b/src/doclets/valadoc.org/htmlrenderer.vala @@ -0,0 +1,43 @@ +/* htmlrenderer.vala + * + * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Didier 'Ptitjes Villevalois + */ + +using GLib; +using Valadoc.Content; +using Valadoc.Html; + +public class Valadoc.ValadocOrg.HtmlRenderer : Html.HtmlRenderer { + public HtmlRenderer (BasicDoclet doclet) { + base (doclet); + } + + public override void visit_embedded (Embedded element) { + var caption = element.caption; + + var absolute_path = Path.build_filename (_doclet.settings.path, element.package.name, "img", Path.get_basename (element.url)); + var relative_path = Path.build_filename ("/doc", element.package.name, "img", Path.get_basename (element.url)); + + copy_file (element.url, absolute_path); + + writer.image (relative_path, (caption == null || caption == "") ? "" : caption); + } +} + diff --git a/src/doclets/valadoc.org/wikirenderer.vala b/src/doclets/valadoc.org/wikirenderer.vala deleted file mode 100755 index 89cf54408..000000000 --- a/src/doclets/valadoc.org/wikirenderer.vala +++ /dev/null @@ -1,212 +0,0 @@ -/* wikirenderer.vala - * - * Copyright (C) 2008-2009 Florian Brosch - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; 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) { - _stream.printf ("[[%s", element.url); - if (element.content.size > 0) { - _stream.printf ("|"); - element.accept_children (this); - } - _stream.printf ("]]"); - } - - 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) { - element.accept_children (this); - _stream.printf ("\n\n"); - } - - 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"); - _stream.printf (element.code); - _stream.printf ("\n}}}\n\n"); - } - - public override void visit_table (Table element) { - 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) { - _stream.puts (" ||"); - 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); - } -} -