From: Florian Brosch Date: Tue, 4 Nov 2008 22:35:00 +0000 (+0000) Subject: - valadoc.org-doclet, html-doclet, devhelp-doclet - cleanups X-Git-Tag: 0.37.1~3^2~624 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00be65f674ec397ffeb873f84c030772ae3b39c6;p=thirdparty%2Fvala.git - valadoc.org-doclet, html-doclet, devhelp-doclet - cleanups - valadoc.org-doclet, html-doclet, devhelp-doclet - cleanups svn path=/trunk/; revision=10 --- diff --git a/configure.in b/configure.in index 57787e455..eb5395eb5 100644 --- a/configure.in +++ b/configure.in @@ -54,6 +54,7 @@ AC_CONFIG_FILES([Makefile src/libvaladoc/Makefile src/vapi/Makefile src/doclets/Makefile + src/doclets/htmlhelpers/Makefile src/doclets/html/Makefile src/doclets/html/linkhelper/Makefile src/doclets/html/doclet/Makefile diff --git a/src/doclets/Makefile.am b/src/doclets/Makefile.am index e67eae4fa..0f213e2d5 100644 --- a/src/doclets/Makefile.am +++ b/src/doclets/Makefile.am @@ -4,6 +4,7 @@ NULL = SUBDIRS = \ + htmlhelpers \ html \ devhelp \ valadoc.org \ diff --git a/src/doclets/devhelp/deps/style.css b/src/doclets/devhelp/deps/style.css index be46c21c1..2b0cbbc73 100644 --- a/src/doclets/devhelp/deps/style.css +++ b/src/doclets/devhelp/deps/style.css @@ -80,7 +80,7 @@ div.site_navigation { .site_content { font-size: 10px; - margin-left: 255px; + margin-left: 5px; margin-right: 5px; text-align: left; } diff --git a/src/doclets/devhelp/doclet/Makefile.am b/src/doclets/devhelp/doclet/Makefile.am index 650750b54..411b38090 100644 --- a/src/doclets/devhelp/doclet/Makefile.am +++ b/src/doclets/devhelp/doclet/Makefile.am @@ -12,7 +12,7 @@ BUILT_SOURCES = libdoclet.vala.stamp libdoclet.vala.stamp: $(libdoclet_VALASOURCES) - $(VALAC) -C --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libxml-2.0 --pkg libhtmlhelper-1.0 --vapidir . --pkg docletconfig --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libxml-2.0 --pkg libhtmlhelper-1.0 --vapidir . --pkg docletconfig --basedir . --disable-non-null --save-temps $^ touch $@ @@ -34,6 +34,7 @@ libdoclet_la_SOURCES = \ AM_CFLAGS = -g \ -DPACKAGE_PLUGINDIR=\"$(libdir)/valadoc/plugins/devhelp/\" \ -I ../../../libvaladoc/ \ + -I ../../htmlhelpers/ \ -I ../linkhelper/ \ -I ../ \ $(GLIB_CFLAGS) \ @@ -45,12 +46,13 @@ AM_CFLAGS = -g \ libdoclet_la_LDFLAGS = -module -avoid-version -libdoclet_la_LIBADD = \ - ../../../libvaladoc/libvaladoc.la \ - ../linkhelper/libhtmlhelper.la \ - $(LIBXML2_LIBS) \ - $(GLIB_LIBS) \ - $(LIBVALA_LIBS) \ +libdoclet_la_LIBADD = \ + ../../../libvaladoc/libvaladoc.la \ + ../../htmlhelpers/libhtmlhelpers.la \ + ../linkhelper/libhtmlhelper.la \ + $(LIBXML2_LIBS) \ + $(GLIB_LIBS) \ + $(LIBVALA_LIBS) \ $(NULL) diff --git a/src/doclets/devhelp/doclet/template.vala b/src/doclets/devhelp/doclet/template.vala index 21f2cd9a3..b4d78ee60 100644 --- a/src/doclets/devhelp/doclet/template.vala +++ b/src/doclets/devhelp/doclet/template.vala @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + using Valadoc; using GLib; using Xml; @@ -24,445 +25,13 @@ using Gee; - - -public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper { - public Valadoc.Settings settings { - construct set; - protected get; +public class Valadoc.LangletIndex : Valadoc.BasicHtmlLanglet, Valadoc.HtmlHelper { + protected override string get_link ( Basic element, Basic pos ) { + return this.get_html_link ( this.settings, element, pos ); } public LangletIndex ( Settings settings ) { - this.settings = settings; - } - - private Basic position = null; - - private inline bool is_basic_type ( string name ) { - string[] basic_types = new string[] { "bool", "char", "uchar", "int", "uint", "short", "ushort", - "long", "ulong", "size_t", "ssize_t", "int8", "uint8", "int16", "uint16", "int32", - "uint32", "int64", "uint64", "float", "double", "time_t", "unichar", "string" - }; - - foreach ( string str in basic_types ) { - if ( str == name ) - return true; - } - - return false; - } - - private void write_type_name ( DataType? datatype, GLib.FileStream file ) { - if ( datatype == null ) { - file.printf ( "void", css_keyword ); - return ; - } - - string typename = datatype.full_name ( ); - if ( datatype.parent.name == null && (datatype is Class || datatype is Struct) ) { - if ( this.is_basic_type ( typename ) ) { - string link = this.get_link( datatype ); - if ( link == null ) - file.printf ( "%s", css_basic_type, typename ); - else - file.printf ( "%s", css_basic_type, link, typename ); - return ; - } - } - - string link = this.get_link( datatype ); - if ( link == null ) - file.printf ( "%s", css_other_type, typename ); - else - file.printf ( "%s", css_other_type, link, typename ); - } - - private void write_type_reference_name ( TypeReference type_reference, GLib.FileStream file ) { - if ( type_reference.type_name == "void" ) { - file.printf ( "void", css_keyword ); - } - else { - if ( type_reference.data_type == null ) { - file.printf ( "%s", css_other_type, type_reference.type_name ); - } - else { - this.write_type_name ( type_reference.data_type, file ); - } - } - } - - private void write_type_reference_template_arguments ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { - Gee.Collection arglst = type_reference.get_type_arguments ( ); - int size = arglst.size; - if ( size == 0 ) - return ; - - file.puts ( "<" ); - int i = 0; - - foreach ( TypeReference arg in arglst ) { - i++; - - this.write_nested_type_referene ( arg, file ); - if ( i != size ) - file.puts ( ", " ); - } - - file.puts ( ">" ); - } - - private void write_nested_type_referene ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { - if ( type_reference.type_name == null ) - return ; - - if ( type_reference.is_weak ) - file.printf ( "weak ", css_keyword ); - - this.write_type_reference_name ( type_reference, file ); - this.write_type_reference_template_arguments ( type_reference, file ); - - if ( type_reference.is_array ) { - string str = string.nfill ( type_reference.array_rank-1, ','); - file.printf ( "[%s]", str ); - } - - if ( type_reference.pass_ownership ) { - file.putc ( '#' ); - } - - if ( type_reference.is_nullable ) { - file.putc ( '?' ); - } - - string str = string.nfill ( type_reference.pointer_rank, '*' ); - file.puts ( str ); - - } - - public override void write_type_reference ( Valadoc.TypeReference type_reference, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - - if ( type_reference == null ) - return ; - - this.write_nested_type_referene ( type_reference, file ); - file.putc ( ' ' ); - } - - private void write_formal_parameter ( FormalParameter param, GLib.FileStream file ) { - if ( param.ellipsis ) { - file.puts ( " ..." ); - } - else { - if ( param.is_out ) - file.printf ( "out ", css_keyword ); - else if ( param.is_ref ) - file.printf ( "ref ", css_keyword ); - - this.write_type_reference ( param.type_reference, file ); - file.printf ( " %s", param.name ); - } - } - - public override void write_parameter_list ( ParameterListHandler thandler, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - bool open_bracket = false; - - Gee.ArrayList params = thandler.param_list; - int size = params.size; - int i = 0; - - file.putc ( '(' ); - - foreach ( FormalParameter param in params ) { - i++; - - if ( param.default_value != null && open_bracket == false ) { - file.printf ( "[", css_optional_parameter ); - open_bracket = true; - } - - this.write_formal_parameter ( param, file ); - if ( i != size ) { - file.puts ( ", " ); - } - else if ( open_bracket == true ) { - file.puts ( "]" ); - } - } - - file.putc ( ')' ); - } - - private void write_exception_list ( ExceptionHandler exception_handler, GLib.FileStream file ) { - Gee.ReadOnlyCollection error_domains = exception_handler.get_error_domains (); - int size = error_domains.size; - int i = 1; - - if ( size == 0 ) - return ; - - file.printf ( " throws ", css_keyword ); - - foreach ( TypeReference type_reference in error_domains ) { - this.write_type_reference ( type_reference, file ); - if ( error_domains.size > i ) { - file.puts ( ", " ); - } - i++; - } - } - - public override void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler parent ) { - this.position = m; - - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( m, file ); - - if ( m.is_abstract ) - modifiers.append ( " abstract" ); - if ( m.is_virtual ) - modifiers.append ( " virtual" ); - if ( m.is_override ) - modifiers.append ( " override" ); - if ( m.is_static ) - modifiers.append ( " static" ); - if ( m.is_inline ) - modifiers.append ( " inline" ); - - file.printf ( " %s ", css_keyword, modifiers.str ); - this.write_type_reference ( m.return_type, file ); - file.puts ( m.name ); - this.write_parameter_list ( m, file ); - this.write_exception_list ( m, file ); - } - - public override void write_type_parameter ( TypeParameter param, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - file.puts ( param.datatype_name ); - } - - public override void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - int i = 1; - - var lst = thandler.get_template_param_list( ); - if ( lst.size == 0 ) - return ; - - file.puts ( "<" ); // < - - - foreach ( TypeParameter param in lst ) { - param.write ( this, file ); - if ( lst.size > i ) - file.puts ( ", " ); - - i++; - } - file.puts ( ">" ); // > - } - - public override void write_field ( Valadoc.Field field, Valadoc.FieldHandler parent, void* ptr ) { - this.position = field; - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( field, file ); - - if ( field.is_volatile ) - file.printf ( " volatile", css_keyword ); - - this.write_type_reference ( field.type_reference, file ); - - file.printf ( " %s", field.name ); - } - - public override void write_constant ( Constant constant, ConstantHandler parent, void* ptr ) { - this.position = constant; - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( constant, file ); - file.printf ( " const ", css_keyword ); - this.write_type_reference ( constant.type_reference, file ); - file.printf ( " %s", constant.name ); - } - - public override void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - - Property prop = (Property)propac.parent; - - if ( !(prop.is_public == propac.is_public && prop.is_private == propac.is_private && prop.is_protected == propac.is_protected) ) { - // FIXME: PropertyAccessor isn't a SymbolAccessibility. (Valac-Bug.) - if ( propac.is_public ) - file.printf ( "public ", css_keyword ); - else if ( propac.is_protected ) - file.printf ( "protected ", css_keyword ); - else if ( propac.is_private ) - file.printf ( "private ", css_keyword ); - } - - - if ( propac.is_get ) { - file.printf ( " get;", css_keyword ); - } - else if ( propac.is_set ) { - if ( propac.is_construct ) { - file.printf ( " construct ", css_keyword ); - } - - file.printf ( " set;", css_keyword ); - } - } - - public override void write_property ( Valadoc.Property prop, void* ptr ) { - this.position = prop; - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( prop, file ); - - if ( prop.is_virtual ) - modifiers.append ( " virtual " ); - if ( prop.is_abstract ) - modifiers.append ( " abstract " ); - if ( prop.is_override ) - modifiers.append ( " override " ); - - - this.write_type_reference ( prop.return_type, file ); - file.printf ( " %s%s { ", css_keyword, modifiers.str, prop.name ); - - if ( prop.setter != null ) - this.write_property_accessor ( prop.setter, file ); - - - file.printf ( " " ); - - if ( prop.getter != null ) - this.write_property_accessor ( prop.getter, file ); - - file.printf ( " }" ); - } - - public override void write_signal ( Valadoc.Signal sig, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = sig; - - this.write_accessor ( sig, file ); - - file.printf ( " signal ", css_keyword ); - this.write_type_reference ( sig.return_type, file ); - file.printf ( " %s ", sig.name ); - this.write_parameter_list ( sig, file ); - } - - public override void write_enum_value ( Valadoc.EnumValue enval, void* ptr ) { - } - - public override void write_error_code ( Valadoc.ErrorCode errcode, void* ptr ) { - } - - public override void write_delegate ( Valadoc.Delegate del, void* ptr ) { - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = del; - - this.write_accessor ( del, file ); - - file.printf ( " delegate ", css_keyword ); - this.write_type_reference ( del.return_type, file ); - file.printf ( " %s ", del.name ); - this.write_parameter_list ( del, file ); - this.write_exception_list ( del, file ); - } - - public override void write_enum ( Valadoc.Enum en, void* ptr ) { - } - - public override void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr ) { - } - - private void write_accessor ( Valadoc.SymbolAccessibility element, GLib.FileStream file ) { - if ( element.is_public ) - file.printf ( "public ", css_keyword ); - else if ( element.is_protected ) - file.printf ( "protected ", css_keyword ); - else if ( element.is_private ) - file.printf ( "private ", css_keyword ); - } - - - public override void write_struct ( Valadoc.Struct stru, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = stru; - - this.write_accessor ( stru, file ); - file.printf ( "struct %s", css_keyword, stru.name ); - this.write_template_parameters ( stru, ptr ); - this.write_inheritance_list ( stru, file ); - } - - private void write_inheritance_list ( Valadoc.ContainerDataType dtype, GLib.FileStream file ) { - Gee.Collection lst = dtype.get_parent_types ( ); - int size = lst.size; - int i = 1; - - if ( size == 0 ) - return ; - - file.puts ( " : " ); - - foreach ( DataType cntype in lst ) { - this.write_type_name ( cntype, file ); - if ( size > i ) - file.puts ( ", " ); - - i++; - } - - file.putc ( ' ' ); - } - - public override void write_class ( Valadoc.Class cl, void* ptr ) { - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = cl; - - this.write_accessor ( cl, file ); - - if ( cl.is_abstract ) - modifiers.append ( "abstract " ); - else if ( cl.is_static ) - modifiers.append ( "static " ); - - file.printf ( "%s class %s", css_keyword, modifiers.str, cl.name ); - - this.write_template_parameters ( cl, file ); - this.write_inheritance_list ( cl, file ); - } - - public override void write_interface ( Valadoc.Interface iface, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = iface; - - this.write_accessor ( iface, file ); - - if ( iface.is_static ) - file.printf ( "static interface %s", css_keyword, iface.name ); - else - file.printf ( "interface %s", css_keyword, iface.name ); - - this.write_template_parameters ( iface, ptr ); - this.write_inheritance_list ( iface, file ); - } - - public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) { - } - - public override void write_file ( Valadoc.Package file, void* ptr ) { + base ( settings ); } } @@ -471,7 +40,6 @@ public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper { - public enum KeywordType { NAMESPACE = 0, CLASS = 1, @@ -566,41 +134,24 @@ public class DevhelpFormat : Object { } -public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { - private Valadoc.LangletIndex langlet; - private DevhelpFormat devhelp; - private const string css_style_body = "site_body"; - private const string css_site_header = "site_header"; - private string package_dir_name = ""; - private void write_file_header_template ( GLib.FileStream file, string title ) { - file.puts ( "\n" ); - file.puts ( "\t\n" ); - file.puts ( "\t\tVala Binding Reference\n" ); - file.printf ( "\t\t\n" ); - file.puts ( "\t\n" ); - file.puts ( "\t\n\n" ); +//public string get_html_link ( Settings settings, Basic el, Basic? pos ) { +// return "../" + this.get_package_name ( tag.file.name ) + "/" + tag.full_name () + ".html"; +//} - file.printf ( "\t
\n", this.css_site_header ); - file.printf ( "\t\t%s Reference Manual\n", title ); - file.puts ( "\t
\n\n" ); - file.printf ( "\t\t
\n", this.css_style_body ); - } - private void write_file_footer ( GLib.FileStream file ) { - file.puts ( "\t
\n" ); - - file.puts ( "\t
\n" ); - file.puts ( "\t\t
\n" ); - file.puts ( "\t\t
\n" ); - file.puts ( "\t\t\tcreated by valadoc\n" ); - file.puts ( "\t\t
\n" ); - file.puts ( "\t
\n" ); - file.puts ( "\t\n" ); - file.puts ( "" ); + + + +public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.HtmlHelper { + private string package_dir_name = ""; + private DevhelpFormat devhelp; + + protected override string get_link ( Valadoc.Basic p1, Valadoc.Basic p2 ) { + return this.get_html_link ( this.settings, p1, p2 ); } private string get_path ( Valadoc.Basic element ) { @@ -611,11 +162,11 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { return this.settings.get_real_path ( ) + "/" + this.package_dir_name + "/" + element.full_name () + ".html"; } - private string get_img_path ( Valadoc.Basic element ) { + protected override string get_img_path ( Valadoc.Basic element ) { return "img/" + element.full_name () + ".png"; } - private string get_img_real_path ( Valadoc.Basic element ) { + protected override string get_img_real_path ( Valadoc.Basic element ) { return this.settings.get_real_path ( ) + "/" + this.package_dir_name + "/" + "img/" + element.full_name () + ".png"; } @@ -634,30 +185,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp = new DevhelpFormat ( settings.pkg_name, "" ); } - private void write_image_block ( GLib.FileStream file, DataType element ) { - string rpath = this.get_img_real_path ( element ); - string path = this.get_img_path ( element ); - - if ( element is Class ) { - Diagrams.write_class_diagram ( (Class)element, rpath ); - } - else if ( element is Interface ) { - Diagrams.write_interface_diagram ( (Interface)element, rpath ); - } - else if ( element is Struct ) { - Diagrams.write_struct_diagram ( (Struct)element, rpath ); - } - - file.printf ( "

Object Hierarchy:

\n", css_title ); - file.printf ( "\n", css_diagram, path ); - } - private string vala_file_package_name; private bool visited_non_package = false; public override void visit_package ( Package file ) { - string pkg_name = get_package_name ( file.name ); + string pkg_name = file.name; string path = this.settings.get_real_path () + pkg_name + "/"; this.package_dir_name = pkg_name; @@ -668,7 +201,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp = new DevhelpFormat ( pkg_name, "" ); GLib.FileStream ifile = GLib.FileStream.open ( path + "index.htm", "w" ); - this.write_file_header_template ( ifile, pkg_name ); + this.write_file_header ( ifile, "style.css", pkg_name ); this.write_file_footer ( ifile ); ifile = null; @@ -677,19 +210,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.save_file ( path + pkg_name + ".devhelp2" ); } - public void write_namespace_content ( GLib.FileStream file, Namespace ns ) { - file.printf ( "

%s:

\n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name() ); - file.printf ( "
\n", css_hr ); - file.printf ( "

Description:

\n", css_title ); - ns.write_comment ( file ); - } - public override void visit_namespace ( Namespace ns ) { string rpath = this.get_real_path ( ns ); string path = this.get_path ( ns ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w" ); - this.write_file_header_template ( file, ns.full_name() ); + this.write_file_header ( file, "style.css", ns.full_name() ); this.write_namespace_content ( file, ns ); this.write_file_footer ( file ); file = null; @@ -716,198 +242,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { } } - private void write_child_classes ( GLib.FileStream file, ClassHandler clh ) { - Gee.ReadOnlyCollection classes = clh.get_class_list (); - if ( classes.size > 0 ) { - file.printf ( "

Classes:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Class subcl in classes ) { - string name; - if ( subcl.is_abstract ) { - name = "" + subcl.name + ""; - } - else { - name = subcl.name; - } - - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_class, css_navi_link, this.get_link(subcl), name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_enums ( GLib.FileStream file, EnumHandler eh ) { - Gee.Collection enums = eh.get_enum_list (); - if ( enums.size > 0 ) { - file.printf ( "

Enums:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Enum en in enums ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_enum, css_navi_link, this.get_link(en), en.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_structs ( GLib.FileStream file, StructHandler struh ) { - Gee.Collection structs = struh.get_struct_list (); - if ( structs.size > 0 ) { - file.printf ( "

Structs:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Struct stru in structs ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_struct, css_navi_link, this.get_link(stru), stru.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_methods ( GLib.FileStream file, MethodHandler mh ) { - Gee.ReadOnlyCollection methods = mh.get_method_list (); - if ( methods.size > 0 ) { - file.printf ( "

Methods:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Method m in methods ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_method, css_navi_link, this.get_link(m), m.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_delegates ( GLib.FileStream file, DelegateHandler dh ) { - Gee.Collection delegates = dh.get_delegate_list (); - if ( delegates.size > 0 ) { - file.printf ( "

Delegates:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Delegate d in delegates ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_delegate, css_navi_link, this.get_link(d), d.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh ) { - Gee.ReadOnlyCollection methods = cmh.get_construction_method_list (); - if ( methods.size > 0 ) { - file.printf ( "

Construction Methods:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Method m in methods ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_method, css_navi_link, this.get_link(m), m.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_signals ( GLib.FileStream file, SignalHandler sh ) { - Gee.ReadOnlyCollection signals = sh.get_signal_list (); - if ( signals.size > 0 ) { - file.printf ( "

Signals:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Signal sig in signals ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_signal, css_navi_link, this.get_link(sig), sig.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_properties ( GLib.FileStream file, PropertyHandler ph ) { - Gee.ReadOnlyCollection properties = ph.get_property_list (); - if ( properties.size > 0 ) { - file.printf ( "

Properties:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Property prop in properties ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_property, css_navi_link, this.get_link(prop), prop.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_fields ( GLib.FileStream file, FieldHandler fh ) { - Gee.ReadOnlyCollection fields = fh.get_field_list (); - if ( fields.size > 0 ) { - file.printf ( "

Fields:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Field f in fields ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_fields, css_navi_link, this.get_link(f), f.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_constants ( GLib.FileStream file, ConstantHandler ch ) { - Gee.ReadOnlyCollection constants = ch.get_constant_list (); - if ( constants.size > 0 ) { - file.printf ( "

Constants:

\n", css_title ); - file.printf ( "
    \n", css_inline_navigation ); - foreach ( Constant c in constants ) { - file.printf ( "\t
  • %s
  • \n", css_inline_navigation_constant, css_navi_link, this.get_link(c), c.name ); - } - file.puts ( "
\n" ); - } - } - - private void write_child_error_values ( GLib.FileStream file, ErrorDomain errdom ) { - Gee.ReadOnlyCollection error_codes = errdom.get_error_code_list (); - if ( error_codes.size > 0 ) { - file.printf ( "

Error Codes:

\n", css_title ); - file.printf ( "\n", css_errordomain_table ); - foreach ( ErrorCode errcode in error_codes ) { - file.puts ( "\n" ); - file.printf ( "\t\n", css_errordomain_table_name, errcode.name, errcode.name ); - file.printf ( "\t\n" ); - file.puts ( "\n" ); - } - file.puts ( "
%s\n", css_errordomain_table_text ); - - errcode.write_comment ( file ); - - file.puts ( "\t
\n" ); - } - } - - private void write_child_enum_values ( GLib.FileStream file, Enum en ) { - Gee.ReadOnlyCollection enum_values = en.get_enum_values (); - if ( enum_values.size > 0 ) { - file.printf ( "

Enum Values:

\n", css_title ); - file.printf ( "\n", css_enum_table ); - foreach ( EnumValue enval in enum_values ) { - file.puts ( "\n" ); - file.printf ( "\t\n", css_enum_table_name, enval.name, enval.name ); - file.printf ( "\t\n" ); - file.puts ( "\n" ); - } - file.puts ( "
%s\n", css_enum_table_text ); - - enval.write_comment ( file ); - - file.puts ( "\t
\n" ); - } - } - - public void write_interface_content ( GLib.FileStream file, Interface iface ) { - string full_name = iface.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - - this.write_image_block ( file, iface ); - - file.printf ( "

Description:

\n", css_title ); - - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_interface ( iface, file ); - file.printf ( "\n
\n" ); - - iface.write_comment ( file ); - this.write_namespace_note ( file, iface ); - this.write_package_note ( file, iface ); - file.printf ( "\n

Content:

\n", css_title ); - this.write_child_classes ( file, iface ); - this.write_child_structs ( file, iface ); - this.write_child_delegates ( file, iface ); - this.write_child_methods ( file, iface ); - this.write_child_signals ( file, iface ); - this.write_child_properties ( file, iface ); - this.write_child_fields ( file, iface ); - } - public override void visit_interface ( Interface iface ) { string rpath = this.get_real_path ( iface ); string path = this.get_path ( iface ); @@ -928,40 +262,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_keyword ( KeywordType.INTERFACE, iface.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, iface.full_name() ); + this.write_file_header ( file, "style.css", iface.full_name() ); this.write_interface_content ( file, iface ); this.write_file_footer ( file ); file = null; } - public void write_class_content ( GLib.FileStream file, Class cl ) { - string full_name = cl.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - - this.write_image_block ( file, cl ); - - file.printf ( "

Description:

\n", css_title ); - - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_class ( cl, file ); - file.printf ( "\n
\n" ); - cl.write_comment ( file ); - this.write_namespace_note ( file, cl ); - this.write_package_note ( file, cl ); - file.printf ( "\n

Content:

\n", css_title ); - this.write_child_construction_methods ( file, cl ); - this.write_child_classes ( file, cl ); - this.write_child_structs ( file, cl ); - this.write_child_enums ( file, cl ); - this.write_child_delegates ( file, cl ); - this.write_child_methods ( file, cl ); - this.write_child_signals ( file, cl ); - this.write_child_properties ( file, cl ); - this.write_child_fields ( file, cl ); - this.write_child_constants ( file, cl ); - } - public override void visit_class ( Class cl ) { string rpath = this.get_real_path ( cl ); string path = this.get_path ( cl ); @@ -985,34 +291,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, cl.full_name() ); + this.write_file_header ( file, "style.css", cl.full_name() ); this.write_class_content ( file, cl ); this.write_file_footer ( file ); file = null; } - public void write_struct_content ( GLib.FileStream file, Struct stru ) { - string full_name = stru.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - - this.write_image_block ( file, stru ); - - file.printf ( "

Description:

\n", css_title ); - stru.write_comment ( file ); - this.write_namespace_note ( file, stru ); - this.write_package_note ( file, stru ); - file.printf ( "\n

Content:

\n", css_title ); - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_struct ( stru, file ); - file.printf ( "\n
\n" ); - - this.write_child_construction_methods ( file, stru ); - this.write_child_methods ( file, stru ); - this.write_child_fields ( file, stru ); - this.write_child_constants ( file, stru ); - } - public override void visit_struct ( Struct stru ) { string rpath = this.get_real_path ( stru ); string path = this.get_path ( stru ); @@ -1030,25 +314,14 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, stru.full_name() ); + this.write_file_header ( file, "style.css", stru.full_name() ); + + // HIER CRASHT ES!! this.write_struct_content ( file, stru ); this.write_file_footer ( file ); file = null; } - public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom ) { - string full_name = errdom.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - errdom.write_comment ( file ); - this.write_namespace_note ( file, errdom ); - this.write_package_note ( file, errdom ); - file.printf ( "\n

Content:

\n", css_title ); - this.write_child_error_values ( file, errdom ); - this.write_child_methods ( file, errdom ); - } - public override void visit_error_domain ( ErrorDomain errdom ) { string rpath = this.get_real_path ( errdom ); string path = this.get_path ( errdom ); @@ -1059,25 +332,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( errdom.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, errdom.full_name() ); + this.write_file_header ( file, "style.css", errdom.full_name() ); this.write_error_domain_content ( file, errdom ); this.write_file_footer ( file ); file = null; } - public void write_enum_content ( GLib.FileStream file, Enum en ) { - string full_name = en.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - en.write_comment ( file ); - this.write_namespace_note ( file, en ); - this.write_package_note ( file, en ); - file.printf ( "\n

Content:

\n", css_title ); - this.write_child_enum_values ( file, en ); - this.write_child_methods ( file, en ); - } - public override void visit_enum ( Enum en ) { string rpath = this.get_real_path ( en ); string path = this.get_path ( en ); @@ -1089,44 +349,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( en.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, en.full_name() ); + this.write_file_header ( file, "style.css", en.full_name() ); this.write_enum_content ( file, en ); this.write_file_footer ( file ); file = null; } - public void write_property_content ( GLib.FileStream file, Property prop ) { - string full_name = prop.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_property ( prop, file ); - file.printf ( "\n
\n" ); - prop.write_comment ( file ); - } - - private void write_package_note ( GLib.FileStream file, Basic element ) { - string package = element.package; - if ( package == null ) - return ; - - file.printf ( "\n\n
\nPackage: %s\n\n", package ); - } - - private void write_namespace_note ( GLib.FileStream file, Basic element ) { - for ( ; element is Namespace == false; element = element.parent ) - ; - - if ( element.parent == null ) - return ; - - if ( element.name == null ) - return ; - - file.printf ( "\n\n
\nNamespace: %s\n\n", element.full_name() ); - } - public override void visit_property ( Property prop ) { string rpath = this.get_real_path ( prop ); string path = this.get_path ( prop ); @@ -1135,27 +363,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( prop.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, prop.full_name() ); + this.write_file_header ( file, "style.css", prop.full_name() ); this.write_property_content ( file, prop ); this.write_file_footer ( file ); file = null; } - public void write_constant_content ( GLib.FileStream file, Constant constant, ConstantHandler parent ) { - string full_name = constant.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_constant ( constant, parent, file ); - file.printf ( "\n
\n" ); - constant.write_comment ( file ); - if ( constant.parent is Namespace ) { - this.write_namespace_note ( file, constant ); - this.write_package_note ( file, constant ); - } - } - public override void visit_constant ( Constant constant, ConstantHandler parent ) { string rpath = this.get_real_path ( constant ); string path = this.get_path ( constant ); @@ -1164,27 +377,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( constant.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, constant.full_name() ); + this.write_file_header ( file, "style.css", constant.full_name() ); this.write_constant_content ( file, constant, parent ); this.write_file_footer ( file ); file = null; } - public void write_field_content ( GLib.FileStream file, Field field, FieldHandler parent ) { - string full_name = field.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_field ( field, parent, file ); - file.printf ( "\n
\n" ); - field.write_comment ( file ); - if ( field.parent is Namespace ) { - this.write_namespace_note ( file, field ); - this.write_package_note ( file, field ); - } - } - public override void visit_field ( Field field, FieldHandler parent ) { string rpath = this.get_real_path ( field ); string path = this.get_path ( field ); @@ -1193,7 +391,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( field.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, field.full_name() ); + this.write_file_header ( file, "style.css", field.full_name() ); this.write_field_content ( file, field, parent ); this.write_file_footer ( file ); file = null; @@ -1205,21 +403,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { public override void visit_enum_value ( EnumValue enval ) { } - public void write_delegate_content ( GLib.FileStream file, Delegate del ) { - string full_name = del.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_delegate ( del, file ); - file.printf ( "\n
\n" ); - del.write_comment ( file ); - if ( del.parent is Namespace ) { - this.write_namespace_note ( file, del ); - this.write_package_note ( file, del ); - } - } - public override void visit_delegate ( Delegate del ) { string rpath = this.get_real_path ( del ); string path = this.get_path ( del ); @@ -1228,23 +411,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( del.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, del.full_name() ); + this.write_file_header ( file, "style.css", del.full_name() ); this.write_delegate_content ( file, del ); this.write_file_footer ( file ); file = null; } - public void write_signal_content ( GLib.FileStream file, Signal sig ) { - string full_name = sig.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_signal ( sig, file ); - file.printf ( "\n
\n" ); - sig.write_comment ( file ); - } - public override void visit_signal ( Signal sig ) { string rpath = this.get_real_path ( sig ); string path = this.get_path ( sig ); @@ -1253,27 +425,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( sig.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, sig.full_name() ); + this.write_file_header ( file, "style.css", sig.full_name() ); write_signal_content ( file, sig ); this.write_file_footer ( file ); file = null; } - public void write_method_content ( GLib.FileStream file, Method m , Valadoc.MethodHandler parent ) { - string full_name = m.full_name ( ); - file.printf ( "

%s:

\n", css_title, full_name ); - file.printf ( "
\n", css_headline_hr ); - file.printf ( "

Description:

\n", css_title ); - file.printf ( "
\n\t", css_code_definition ); - this.langlet.write_method ( file, m, parent ); - file.printf ( "\n
\n" ); - m.write_comment ( file ); - if ( m.parent is Namespace ) { - this.write_namespace_note ( file, m ); - this.write_package_note ( file, m ); - } - } - public override void visit_method ( Method m, Valadoc.MethodHandler parent ) { string rpath = this.get_real_path ( m ); string path = this.get_path ( m ); @@ -1282,7 +439,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.devhelp.add_chapter ( m.name, path ); GLib.FileStream file = GLib.FileStream.open ( rpath, "w"); - this.write_file_header_template ( file, m.full_name() ); + this.write_file_header ( file, "style.css", m.full_name() ); this.write_method_content ( file, m, parent ); this.write_file_footer ( file ); file = null; diff --git a/src/doclets/devhelp/linkhelper/Makefile.am b/src/doclets/devhelp/linkhelper/Makefile.am index b95164549..3bae029c2 100644 --- a/src/doclets/devhelp/linkhelper/Makefile.am +++ b/src/doclets/devhelp/linkhelper/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libhtmlhelper.vala.stamp libhtmlhelper.vala.stamp: $(libhtmlhelper_VALASOURCES) - $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^ + $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^ touch $@ @@ -29,6 +29,7 @@ libhtmlhelper_la_SOURCES = \ AM_CFLAGS = \ -I ../../../libvaladoc/ \ + -I ../../htmlhelpers/ \ $(LIBVALA_CFLAGS) \ $(GLIB_CFLAGS) \ $(NULL) @@ -36,6 +37,7 @@ AM_CFLAGS = \ libhtmlhelper_la_LIBADD = \ ../../../libvaladoc/libvaladoc.la \ + ../../htmlhelpers/libhtmlhelpers.la \ $(LIBVALA_LIBS) \ $(GLIB_LIBS) \ $(NULL) diff --git a/src/doclets/devhelp/linkhelper/helper.vala b/src/doclets/devhelp/linkhelper/helper.vala index 9ad8fe184..45fefbdac 100755 --- a/src/doclets/devhelp/linkhelper/helper.vala +++ b/src/doclets/devhelp/linkhelper/helper.vala @@ -17,118 +17,27 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -using GLib; - - - -/* css-class-names: */ -public const string css_inline_navigation = "main_inline_navigation"; -public const string css_inline_navigation_property = "main_inline_navigation_property"; -public const string css_inline_navigation_method = "main_inline_navigation_method"; -public const string css_inline_navigation_signal = "main_inline_navigation_signal"; -public const string css_inline_navigation_fields = "main_inline_navigation_fields"; -public const string css_inline_navigation_class = "main_inline_navigation_class"; -public const string css_inline_navigation_enum = "main_inline_navigation_enum"; -public const string css_inline_navigation_struct = "main_inline_navigation_struct"; -public const string css_inline_navigation_delegate = "main_inline_navigation_delegate"; -public const string css_inline_navigation_constant = "main_inline_navigation_constant"; - -public const string css_navi_package_index = "navi_package_index"; -public const string css_navi_package = "navi_package"; -public const string css_navi_construction_method = "navi_construction_method"; -public const string css_navi_error_domain = "navi_error_domain"; -public const string css_navi_namespace = "navi_namespace"; -public const string css_navi_method = "navi_method"; -public const string css_navi_struct = "navi_struct"; -public const string css_navi_iface = "navi_iface"; -public const string css_navi_field = "navi_field"; -public const string css_navi_class = "navi_class"; -public const string css_navi_enum = "navi_enum"; -public const string css_navi_link = "navi_link"; -public const string css_navi_constant = "navi_constant"; -public const string css_navi_prop = "navi_prop"; -public const string css_navi_del = "navi_del"; -public const string css_navi_sig = "navi_sig"; -public const string css_navi = "navi_main"; -public const string css_navi_enval = "main_navi_enval"; -public const string css_navi_errdomcode = "main_navi_errdomcode"; -public const string css_navi_hr = "navi_hr"; - -public const string css_errordomain_table_name = "main_errordomain_table_name"; -public const string css_errordomain_table_text = "main_errordomain_table_text"; -public const string css_errordomain_table = "main_errordomain_table"; - - -public const string css_enum_table_name = "main_enum_table_name"; -public const string css_enum_table_text = "main_enum_table_text"; -public const string css_enum_table = "main_enum_table"; - -public const string css_diagram = "main_diagram"; -public const string css_see_list = "main_see_list"; -public const string css_exception_table = "main_parameter_table"; -public const string css_parameter_table_text = "main_parameter_table_text"; -public const string css_parameter_table_name = "main_parameter_table_name"; -public const string css_parameter_table = "main_parameter_table"; -public const string css_title = "main_title"; -public const string css_other_type = "main_other_type"; -public const string css_basic_type = "main_basic_type"; -public const string css_keyword = "main_keyword"; -public const string css_optional_parameter = "main_optional_parameter"; -public const string css_code_definition = "main_code_definition"; -public const string css_headline_hr = "main_hr"; -public const string css_hr = "main_hr"; -public const string css_list_errdom = "main_list_errdom"; -public const string css_list_en = "main_list_en"; -public const string css_list_ns = "main_list_ns"; -public const string css_list_cl = "main_list_cl"; -public const string css_list_iface = "main_list_iface"; -public const string css_list_stru = "main_list_stru"; -public const string css_list_field = "main_list_field"; -public const string css_list_prop = "main_list_prop"; -public const string css_list_del = "main_list_del"; -public const string css_list_sig = "main_list_sig"; -public const string css_list_m = "main_list_m"; - +using Valadoc; +using GLib; -public interface Valadoc.LinkHelper : Object { - private static string package_name = null; - - public abstract Settings settings { - construct set; - get; - } - - private string get_dirname ( string file_name ) { - if ( file_name[file_name.len()-1] == '/' ) - return GLib.Path.get_dirname ( file_name ); - else - return GLib.Path.get_basename ( file_name ); - } - protected string get_package_name ( string file_path ) { - if ( file_path.has_suffix (".vapi") ) { - string file_name = GLib.Path.get_basename (file_path); - return file_name.ndup ( file_name.size() - ".vapi".size() ); +public interface Valadoc.HtmlHelper { + protected string? get_html_link ( Settings settings, Basic element, Basic pos ) { + string tmp = ""; + string prefix = ""; + + if ( element != pos ) { + prefix = "../" + element.file.name; } - return this.settings.pkg_name; - } - - public string get_file_name ( Valadoc.Basic tag ) { - Valadoc.Basic pos = tag; - while ( pos != null ) { - if ( pos is Valadoc.Package ) - return pos.name; - - pos = pos.parent; + if ( element is Valadoc.EnumValue || element is Valadoc.ErrorCode ) { + tmp = "#" + element.name; + element = element.parent; } - return null; - } - protected string? get_link ( Valadoc.Basic tag ) { - return "../" + this.get_package_name ( tag.file.name ) + "/" + tag.full_name () + ".html"; + return prefix + "/" + element.full_name () + ".html" + tmp; } } diff --git a/src/doclets/devhelp/taglets/author/Makefile.am b/src/doclets/devhelp/taglets/author/Makefile.am index 86a8c150d..12af194cd 100644 --- a/src/doclets/devhelp/taglets/author/Makefile.am +++ b/src/doclets/devhelp/taglets/author/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletversion.vala.stamp libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletversion_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletversion_la_LDFLAGS = -module -avoid-version libtagletversion_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/devhelp/taglets/link/Makefile.am b/src/doclets/devhelp/taglets/link/Makefile.am index 084500ff8..bd3eefc49 100644 --- a/src/doclets/devhelp/taglets/link/Makefile.am +++ b/src/doclets/devhelp/taglets/link/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletlink.vala.stamp libtagletlink.vala.stamp: $(libtagletlink_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletlink_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletlink_la_LDFLAGS = -module -avoid-version libtagletlink_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/devhelp/taglets/link/taglet.vala b/src/doclets/devhelp/taglets/link/taglet.vala index cf8e06c89..898779270 100644 --- a/src/doclets/devhelp/taglets/link/taglet.vala +++ b/src/doclets/devhelp/taglets/link/taglet.vala @@ -24,7 +24,7 @@ using Gee; -public class LinkHtmlTaglet : InlineTaglet, LinkHelper { +public class LinkHtmlTaglet : InlineTaglet, HtmlHelper { private string content; private string path; @@ -45,7 +45,8 @@ public class LinkHtmlTaglet : InlineTaglet, LinkHelper { } this.settings = settings; - this.path = this.get_link ( element ); + this.path = this.get_html_link ( this.settings, element, me ); + this.content = str; return true; } diff --git a/src/doclets/devhelp/taglets/parameter/Makefile.am b/src/doclets/devhelp/taglets/parameter/Makefile.am index ae5591af2..da02537fa 100644 --- a/src/doclets/devhelp/taglets/parameter/Makefile.am +++ b/src/doclets/devhelp/taglets/parameter/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletparameter.vala.stamp libtagletparameter.vala.stamp: $(libtagletparameter_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletparameter_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletparameter_la_LDFLAGS = -module -avoid-version libtagletparameter_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/devhelp/taglets/return/Makefile.am b/src/doclets/devhelp/taglets/return/Makefile.am index e65ae9576..6a4282ebc 100644 --- a/src/doclets/devhelp/taglets/return/Makefile.am +++ b/src/doclets/devhelp/taglets/return/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletXXXX.vala.stamp libtagletXXXX.vala.stamp: $(libtagletXXXX_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletXXXX_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletXXXX_la_LDFLAGS = -module -avoid-version libtagletXXXX_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/devhelp/taglets/see/Makefile.am b/src/doclets/devhelp/taglets/see/Makefile.am index 15903ef2a..9264d0b5e 100644 --- a/src/doclets/devhelp/taglets/see/Makefile.am +++ b/src/doclets/devhelp/taglets/see/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletsee.vala.stamp libtagletsee.vala.stamp: $(libtagletsee_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletsee_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletsee_la_LDFLAGS = -module -avoid-version libtagletsee_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/devhelp/taglets/see/taglet.vala b/src/doclets/devhelp/taglets/see/taglet.vala index 17fe5b0ef..2ca210669 100644 --- a/src/doclets/devhelp/taglets/see/taglet.vala +++ b/src/doclets/devhelp/taglets/see/taglet.vala @@ -23,7 +23,7 @@ using Vala; using Gee; -public class SeeHtmlTaglet : MainTaglet, LinkHelper { +public class SeeHtmlTaglet : MainTaglet, HtmlHelper { private string name; private string path; @@ -76,8 +76,10 @@ public class SeeHtmlTaglet : MainTaglet, LinkHelper { } this.settings = settings; - this.path = this.get_link ( element ); - this.name = str; + + + this.path = this.get_html_link ( this.settings, element, me ); + this.name = element.full_name(); return true; } diff --git a/src/doclets/devhelp/taglets/string/Makefile.am b/src/doclets/devhelp/taglets/string/Makefile.am index b4d91f379..3bc77e4eb 100644 --- a/src/doclets/devhelp/taglets/string/Makefile.am +++ b/src/doclets/devhelp/taglets/string/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletstring.vala.stamp libtagletstring.vala.stamp: $(libtagletstring_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletstring_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletstring_la_LDFLAGS = -module -avoid-version libtagletstring_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/devhelp/taglets/throws/Makefile.am b/src/doclets/devhelp/taglets/throws/Makefile.am index b55bdd249..0b68ac376 100644 --- a/src/doclets/devhelp/taglets/throws/Makefile.am +++ b/src/doclets/devhelp/taglets/throws/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libexceptionparameter.vala.stamp libexceptionparameter.vala.stamp: $(libexceptionparameter_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libexceptionparameter_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libexceptionparameter_la_LDFLAGS = -module -avoid-version libexceptionparameter_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/devhelp/taglets/version/Makefile.am b/src/doclets/devhelp/taglets/version/Makefile.am index 86a8c150d..12af194cd 100644 --- a/src/doclets/devhelp/taglets/version/Makefile.am +++ b/src/doclets/devhelp/taglets/version/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletversion.vala.stamp libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletversion_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletversion_la_LDFLAGS = -module -avoid-version libtagletversion_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/html/deps/main.css b/src/doclets/html/deps/main.css index be46c21c1..d97790a7c 100644 --- a/src/doclets/html/deps/main.css +++ b/src/doclets/html/deps/main.css @@ -191,7 +191,7 @@ h3.main_title { .navi_method, .main_inline_navigation_method { list-style-image: url(method.png) } -.navi_struct, .main_list_stru { +.navi_struct, .main_list_stru, .main_inline_navigation_struct { list-style-image: url(struct.png) } .navi_iface, .main_list_iface { diff --git a/src/doclets/html/doclet/Makefile.am b/src/doclets/html/doclet/Makefile.am index 606935d05..2b67e048f 100644 --- a/src/doclets/html/doclet/Makefile.am +++ b/src/doclets/html/doclet/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libdoclet.vala.stamp libdoclet.vala.stamp: $(libdoclet_VALASOURCES) - $(VALAC) -C --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libhtmlhelper-1.0 --basedir . --vapidir . --pkg docletconfig --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libhtmlhelper-1.0 --basedir . --vapidir . --pkg docletconfig --disable-non-null --save-temps $^ touch $@ @@ -33,6 +33,7 @@ libdoclet_la_SOURCES = \ AM_CFLAGS = -g \ -DPACKAGE_PLUGINDIR=\"$(libdir)/valadoc/plugins/template/\" \ -I ../../../libvaladoc/ \ + -I ../../htmlhelpers/ \ -I ../linkhelper/ \ -I ../ \ $(GLIB_CFLAGS) \ @@ -43,11 +44,12 @@ AM_CFLAGS = -g \ libdoclet_la_LDFLAGS = -module -avoid-version -libdoclet_la_LIBADD = \ - ../../../libvaladoc/libvaladoc.la \ - ../linkhelper/libhtmlhelper.la \ - $(GLIB_LIBS) \ - $(LIBVALA_LIBS) \ +libdoclet_la_LIBADD = \ + ../../htmlhelpers/libhtmlhelpers.la \ + ../../../libvaladoc/libvaladoc.la \ + ../linkhelper/libhtmlhelper.la \ + $(GLIB_LIBS) \ + $(LIBVALA_LIBS) \ $(NULL) diff --git a/src/doclets/html/doclet/template.vala b/src/doclets/html/doclet/template.vala index d0d252ed3..95e74a53d 100644 --- a/src/doclets/html/doclet/template.vala +++ b/src/doclets/html/doclet/template.vala @@ -25,475 +25,13 @@ using Gee; - - -public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper { - public Valadoc.Settings settings { - construct set; - protected get; +public class Valadoc.LangletIndex : Valadoc.BasicHtmlLanglet, Valadoc.LinkHelper { + protected override string get_link ( Basic element, Basic pos ) { + return this.get_html_link ( this.settings, element, pos ); } public LangletIndex ( Settings settings ) { - this.settings = settings; - } - - private Basic position = null; - - private inline bool is_basic_type ( string name ) { - string[] basic_types = new string[] { "bool", "char", "uchar", "int", "uint", "short", "ushort", - "long", "ulong", "size_t", "ssize_t", "int8", "uint8", "int16", "uint16", "int32", - "uint32", "int64", "uint64", "float", "double", "time_t", "unichar", "string" - }; - - foreach ( string str in basic_types ) { - if ( str == name ) - return true; - } - - return false; - } - - private void write_type_name ( DataType? datatype, GLib.FileStream file ) { - if ( datatype == null ) { - file.printf ( "void", css_keyword ); - return ; - } - - string typename = datatype.full_name (); - if ( datatype.parent.name == null && (datatype is Class || datatype is Struct) ) { - if ( this.is_basic_type ( typename ) ) { - string link = this.get_link(datatype, this.position ); - if ( link == null ) - file.printf ( "%s", css_basic_type, typename ); - else - file.printf ( "%s", css_basic_type, link, typename ); - return ; - } - } - - string link = this.get_link(datatype, this.position); - if ( link == null ) - file.printf ( "%s", css_other_type, typename ); - else - file.printf ( "%s", css_other_type, link, typename ); - } - - private void write_type_reference_name ( TypeReference type_reference, GLib.FileStream file ) { - if ( type_reference.type_name == "void" ) { - file.printf ( "void", css_keyword ); - } - else { - if ( type_reference.data_type == null ) { - file.printf ( "%s", css_other_type, type_reference.type_name ); - } - else { - this.write_type_name ( type_reference.data_type, file ); - } - } - } - - private void write_type_reference_template_arguments ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { - Gee.Collection arglst = type_reference.get_type_arguments ( ); - int size = arglst.size; - if ( size == 0 ) - return ; - - file.puts ( "<" ); - int i = 0; - - foreach ( TypeReference arg in arglst ) { - i++; - - this.write_nested_type_referene ( arg, file ); - if ( i != size ) - file.puts ( ", " ); - } - - file.puts ( ">" ); - } - - private void write_nested_type_referene ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { - if ( type_reference.type_name == null ) - return ; - - if ( type_reference.is_weak ) - file.printf ( "weak ", css_keyword ); - - this.write_type_reference_name ( type_reference, file ); - this.write_type_reference_template_arguments ( type_reference, file ); - - if ( type_reference.is_array ) { - string str = string.nfill ( type_reference.array_rank-1, ','); - file.printf ( "[%s]", str ); - } - - if ( type_reference.pass_ownership ) { - file.putc ( '#' ); - } - - if ( type_reference.is_nullable ) { - file.putc ( '?' ); - } - - string str = string.nfill ( type_reference.pointer_rank, '*' ); - file.puts ( str ); - - } - - public override void write_type_reference ( Valadoc.TypeReference type_reference, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - - if ( type_reference == null ) - return ; - - this.write_nested_type_referene ( type_reference, file ); - file.putc ( ' ' ); - - /* - if ( type_reference.is_weak ) { - file.printf ( "weak ", css_keyword ); - } - - this.write_type_name ( type_reference.data_type, file ); - - if ( type_reference.is_array ) { - string str = string.nfill ( type_reference.array_rank-1, ','); - file.printf ( "[%s]", str ); - } - - if ( type_reference.pass_ownership ) { - file.putc ( '#' ); - } - - if ( type_reference.is_nullable ) { - file.putc ( '?' ); - } - - string str = string.nfill ( type_reference.pointer_rank, '*' ); - file.puts ( str ); - */ - } - - private void write_formal_parameter ( FormalParameter param, GLib.FileStream file ) { - if ( param.ellipsis ) { - file.puts ( " ..." ); - } - else { - if ( param.is_out ) - file.printf ( "out ", css_keyword ); - else if ( param.is_ref ) - file.printf ( "ref ", css_keyword ); - - this.write_type_reference ( param.type_reference, file ); - file.printf ( " %s", param.name ); - } - } - - public override void write_parameter_list ( ParameterListHandler thandler, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - bool open_bracket = false; - - Gee.ArrayList params = thandler.param_list; - int size = params.size; - int i = 0; - - file.putc ( '(' ); - - foreach ( FormalParameter param in params ) { - i++; - - if ( param.default_value != null && open_bracket == false ) { - file.printf ( "[", css_optional_parameter ); - open_bracket = true; - } - - this.write_formal_parameter ( param, file ); - if ( i != size ) { - file.puts ( ", " ); - } - else if ( open_bracket == true ) { - file.puts ( "]" ); - } - } - - file.putc ( ')' ); - } - - private void write_exception_list ( ExceptionHandler exception_handler, GLib.FileStream file ) { - Gee.ReadOnlyCollection error_domains = exception_handler.get_error_domains (); - int size = error_domains.size; - int i = 1; - - if ( size == 0 ) - return ; - - file.printf ( " throws ", css_keyword ); - - foreach ( TypeReference type_reference in error_domains ) { - if ( type_reference == null ) { - file.printf ( "GLib.Error", css_other_type ); - } - else { - this.write_type_reference ( type_reference, file ); - } - - if ( error_domains.size > i ) { - file.puts ( ", " ); - } - i++; - } - } - - public override void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler parent ) { - this.position = m; - - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( m, file ); - - if ( m.is_abstract ) - modifiers.append ( " abstract" ); - if ( m.is_virtual ) - modifiers.append ( " virtual" ); - if ( m.is_override ) - modifiers.append ( " override" ); - if ( m.is_static ) - modifiers.append ( " static" ); - if ( m.is_inline ) - modifiers.append ( " inline" ); - - file.printf ( " %s ", css_keyword, modifiers.str ); - this.write_type_reference ( m.return_type, file ); - file.puts ( m.name ); - file.puts ( " " ); - this.write_parameter_list ( m, file ); - this.write_exception_list ( m, file ); - } - - public override void write_type_parameter ( TypeParameter param, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - file.puts ( param.datatype_name ); - } - - public override void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - int i = 1; - - var lst = thandler.get_template_param_list( ); - if ( lst.size == 0 ) - return ; - - file.puts ( "<" ); // < - - foreach ( TypeParameter param in lst ) { - param.write ( this, file ); - if ( lst.size > i ) - file.puts ( ", " ); - - i++; - } - file.puts ( ">" ); // > - } - - public override void write_field ( Valadoc.Field field, Valadoc.FieldHandler parent, void* ptr ) { - this.position = field; - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( field, file ); - - if ( field.is_volatile ) - file.printf ( " volatile", css_keyword ); - - this.write_type_reference ( field.type_reference, file ); - - file.printf ( " %s", field.name ); - } - - public override void write_constant ( Constant constant, ConstantHandler parent, void* ptr ) { - this.position = constant; - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( constant, file ); - file.printf ( " const ", css_keyword ); - this.write_type_reference ( constant.type_reference, file ); - file.printf ( " %s", constant.name ); - } - - public override void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - - Property prop = (Property)propac.parent; - - if ( !(prop.is_public == propac.is_public && prop.is_private == propac.is_private && prop.is_protected == propac.is_protected) ) { - // FIXME: PropertyAccessor isn't a SymbolAccessibility. (Valac-Bug.) - if ( propac.is_public ) - file.printf ( "public ", css_keyword ); - else if ( propac.is_protected ) - file.printf ( "protected ", css_keyword ); - else if ( propac.is_private ) - file.printf ( "private ", css_keyword ); - } - - - if ( propac.is_get ) { - file.printf ( " get;", css_keyword ); - } - else if ( propac.is_set ) { - if ( propac.is_construct ) { - file.printf ( " construct ", css_keyword ); - } - - file.printf ( " set;", css_keyword ); - } - } - - public override void write_property ( Valadoc.Property prop, void* ptr ) { - this.position = prop; - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( prop, file ); - - if ( prop.is_virtual ) - modifiers.append ( " virtual " ); - if ( prop.is_abstract ) - modifiers.append ( " abstract " ); - if ( prop.is_override ) - modifiers.append ( " override " ); - - - this.write_type_reference ( prop.return_type, file ); - file.printf ( " %s%s { ", css_keyword, modifiers.str, prop.name ); - - if ( prop.setter != null ) - this.write_property_accessor ( prop.setter, file ); - - - file.printf ( " " ); - - if ( prop.getter != null ) - this.write_property_accessor ( prop.getter, file ); - - file.printf ( " }" ); - } - - public override void write_signal ( Valadoc.Signal sig, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = sig; - - this.write_accessor ( sig, file ); - - file.printf ( " signal ", css_keyword ); - this.write_type_reference ( sig.return_type, file ); - file.printf ( " %s ", sig.name ); - this.write_parameter_list ( sig, file ); - } - - public override void write_enum_value ( Valadoc.EnumValue enval, void* ptr ) { - } - - public override void write_error_code ( Valadoc.ErrorCode errcode, void* ptr ) { - } - - public override void write_delegate ( Valadoc.Delegate del, void* ptr ) { - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = del; - - this.write_accessor ( del, file ); - - file.printf ( " delegate ", css_keyword ); - this.write_type_reference ( del.return_type, file ); - file.printf ( " %s ", del.name ); - this.write_parameter_list ( del, file ); - this.write_exception_list ( del, file ); - } - - public override void write_enum ( Valadoc.Enum en, void* ptr ) { - } - - public override void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr ) { - } - - private void write_accessor ( Valadoc.SymbolAccessibility element, GLib.FileStream file ) { - if ( element.is_public ) - file.printf ( "public ", css_keyword ); - else if ( element.is_protected ) - file.printf ( "protected ", css_keyword ); - else if ( element.is_private ) - file.printf ( "private ", css_keyword ); - } - - - public override void write_struct ( Valadoc.Struct stru, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = stru; - - this.write_accessor ( stru, file ); - file.printf ( "struct %s", css_keyword, stru.name ); - this.write_template_parameters ( stru, ptr ); - this.write_inheritance_list ( stru, file ); - } - - private void write_inheritance_list ( Valadoc.ContainerDataType dtype, GLib.FileStream file ) { - Gee.Collection lst = dtype.get_parent_types ( ); - int size = lst.size; - int i = 1; - - if ( size == 0 ) - return ; - - file.puts ( " : " ); - - foreach ( DataType cntype in lst ) { - this.write_type_name ( cntype, file ); - if ( size > i ) - file.puts ( ", " ); - - i++; - } - - file.putc ( ' ' ); - } - - public override void write_class ( Valadoc.Class cl, void* ptr ) { - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = cl; - - this.write_accessor ( cl, file ); - - if ( cl.is_abstract ) - modifiers.append ( "abstract " ); - else if ( cl.is_static ) - modifiers.append ( "static " ); - - file.printf ( "%s class %s", css_keyword, modifiers.str, cl.name ); - - this.write_template_parameters ( cl, file ); - this.write_inheritance_list ( cl, file ); - } - - public override void write_interface ( Valadoc.Interface iface, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = iface; - - this.write_accessor ( iface, file ); - - if ( iface.is_static ) - file.printf ( "static interface %s", css_keyword, iface.name ); - else - file.printf ( "interface %s", css_keyword, iface.name ); - - this.write_template_parameters ( iface, ptr ); - this.write_inheritance_list ( iface, file ); - } - - public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) { - } - - public override void write_file ( Valadoc.Package file, void* ptr ) { + base ( settings ); } } @@ -502,529 +40,32 @@ public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper { -public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { - private Valadoc.LangletIndex langlet; - +public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.LinkHelper { private string current_path = null; private string package_name = null; private bool is_vapi = false; private int directory_level = 1; - private void write_navi_entry_html_template ( GLib.FileStream file, string style, string content ) { - file.printf ( "\t
  • %s
  • \n", style, content ); - } - - private void write_navi_entry_html_template_with_link ( GLib.FileStream file, string style, string link, string content ) { - file.printf ( "\t
  • %s
  • \n", style, css_navi_link, link, content ); - } - - private void write_navi_entry ( GLib.FileStream file, Basic element, Basic pos, string style, bool link, bool full_name = false ) { - string name; - - if ( element is Class ) { - if ( ((Class)element).is_abstract ) - name = "" + element.name +""; - else - name = element.name; - } - else if ( element is Package ) { - string path = this.get_file_name ( element ); - name = this.get_package_name ( path ); - } - else if ( full_name == true && element is Namespace ) { - string tmp = ((Namespace)element).full_name (); - name = (element.name == null)? "Global Namespace" : tmp; - } - else { - string tmp = element.name; - name = (tmp == null)? "Global Namespace" : tmp; - } - - if ( link == true ) - this.write_navi_entry_html_template_with_link ( file, style, this.get_link (element, pos), name ); - else - this.write_navi_entry_html_template ( file, style, name ); - } - - private void write_navi_top_entry ( GLib.FileStream file, Basic element, Basic mself ) { - string name = (element.name == null)? "Global Namespace" : element.name; - string style = null; - - if ( element is Namespace ) - style = css_navi_namespace; - else if ( element is Enum ) - style = css_navi_enum; - else if ( element is ErrorDomain ) - style = css_navi_error_domain; - else if ( element is Struct ) - style = css_navi_struct; - else if ( element is Class ) - style = css_navi_class; - else if ( element is Interface ) - style = css_navi_iface; - else if ( element is Package ) { - name = this.get_package_name ( element.name ); - style = css_navi_package; + private string get_css_link ( ) { + GLib.StringBuilder css_path = new GLib.StringBuilder ( ); + for ( int i = 0; this.directory_level > i; i++ ) { + css_path.append ( "../" ); } - - file.printf ( "
      \n", css_navi ); - - if ( element == mself ) - this.write_navi_entry ( file, element, mself, style, false ); - else - this.write_navi_entry ( file, element, mself, style, true ); - - file.puts ( "
    \n" ); - file.printf ( "\n
    \n", css_navi_hr ); + css_path.append ( "main.css" ); + return css_path.str; } - - private void write_top_element_template ( GLib.FileStream file, string link ) { - file.printf ( "\n
    \n", css_navi, css_navi_package_index, css_navi_link, link, css_navi_hr ); + protected override string get_link ( Valadoc.Basic element, Valadoc.Basic pos ) { + return this.get_html_link ( this.settings, element, pos ); } - private void write_top_element ( GLib.FileStream file, Basic pos ) { - string top = this.get_top_link ( pos ); + protected override void write_top_element ( GLib.FileStream file, Basic pos ) { + string top = get_html_top_link ( pos ); this.write_top_element_template ( file, top+"index.html" ); } - private void write_top_elements ( GLib.FileStream file, Basic element, Basic? mself ) { - Gee.ArrayList lst = new Gee.ArrayList (); - Basic pos = element; - if ( mself == null ) - mself = element; - - string file_name = this.get_file_name ( element ); - string package_name = this.get_package_name ( file_name ); - - this.write_top_element ( file, mself ); - - while ( pos != null ) { - lst.add ( pos ); - pos = pos.parent; - } - - for ( int i = lst.size-1; i >= 0 ; i-- ) { - Basic el = lst.get ( i ); - this.write_navi_top_entry ( file, el, mself ); - } - } - - - private void fetch_subnamespace_names ( NamespaceHandler pos, Gee.ArrayList lst ) { - Gee.ReadOnlyCollection nspaces = pos.get_namespace_list (); - - foreach ( Namespace ns in nspaces ) { - lst.add ( ns ); - this.fetch_subnamespace_names ( ns, lst ); - } - } - - private void write_navi_file ( GLib.FileStream file, Package efile ) { - Gee.ArrayList ns_list = new Gee.ArrayList (); - this.fetch_subnamespace_names (efile, ns_list ); - - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_element_template ( file, "../index.html" ); - file.printf ( "\t\t\t\t
      \n", css_navi ); - - foreach ( Namespace ns in ns_list ) { - this.write_navi_entry ( file, ns, efile, css_navi_namespace, true, true ); - } - - file.puts ( "\t\t\t\t
    \n" ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_namespace ( GLib.FileStream file, Namespace ns ) { - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, ns, ns ); - this.write_navi_child_namespaces_inline ( file, ns, ns ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_namespaces_without_childs ( file, ns, mself ); - this.write_navi_child_classes_without_childs ( file, ns, mself ); - this.write_navi_child_interfaces_without_childs ( file, ns, mself ); - this.write_navi_child_structs_without_childs ( file, ns, mself ); - this.write_navi_child_enums_without_childs ( file, ns, mself ); - this.write_navi_child_error_domains_without_childs ( file, ns, mself ); - this.write_navi_child_delegates ( file, ns, mself ); - this.write_navi_child_methods ( file, ns, mself ); - this.write_navi_child_fields ( file, ns, mself ); - this.write_navi_child_constants ( file, ns, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_child_namespaces ( GLib.FileStream file, Namespace ns, Basic mself ) { - this.write_top_elements ( file, ns, mself ); - this.write_navi_child_namespaces_inline ( file, ns, mself ); - } - - private void write_navi_struct_inline ( GLib.FileStream file, Struct stru, Basic mself ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_construction_methods ( file, stru, mself ); - this.write_navi_child_methods ( file, stru, mself ); - this.write_navi_child_fields ( file, stru, mself ); - this.write_navi_child_constants ( file, stru, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_struct ( GLib.FileStream file, Struct stru, Basic mself ) { - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, stru, mself ); - this.write_navi_struct_inline ( file, stru, mself ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_interface_inline ( GLib.FileStream file, Interface iface, Basic mself ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_delegates ( file, iface, mself ); - this.write_navi_child_methods ( file, iface, mself ); - this.write_navi_child_signals ( file, iface, mself ); - this.write_navi_child_properties ( file, iface, mself ); - this.write_navi_child_fields ( file, iface, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_interface ( GLib.FileStream file, Interface iface, Basic mself ) { - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, iface, mself ); - this.write_navi_interface_inline ( file, iface, mself ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_enum_inline ( GLib.FileStream file, Enum en, Basic mself ) { - Gee.ReadOnlyCollection enum_values = en.get_enum_values ( ); - file.printf ( "
      \n", css_navi ); - - foreach ( EnumValue env in enum_values ) { - this.write_navi_entry ( file, env, mself, css_navi_enval, true ); - } - - this.write_navi_child_methods ( file, en, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_enum ( GLib.FileStream file, Enum en, Basic mself ) { - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, en, mself ); - this.write_navi_enum_inline ( file, en, mself ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_error_domain_inline ( GLib.FileStream file, ErrorDomain errdom, Basic mself ) { - Gee.ReadOnlyCollection error_codes = errdom.get_error_code_list ( ); - file.printf ( "
      \n", css_navi ); - - foreach ( ErrorCode ec in error_codes ) { - this.write_navi_entry ( file, ec, mself, css_navi_errdomcode, true ); - } - - this.write_navi_child_methods ( file, errdom, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_error_domain ( GLib.FileStream file, ErrorDomain errdom, Basic mself ) { - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, errdom, mself ); - this.write_navi_error_domain_inline ( file, errdom, mself ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_class_inline ( GLib.FileStream file, Class cl, Basic mself ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_construction_methods ( file, cl, mself ); - this.write_navi_child_classes_without_childs ( file, cl, mself ); - this.write_navi_child_structs_without_childs ( file, cl, mself ); - this.write_navi_child_enums_without_childs ( file, cl, mself ); - this.write_navi_child_delegates ( file, cl, mself ); - this.write_navi_child_methods ( file, cl, mself ); - this.write_navi_child_signals ( file, cl, mself ); - this.write_navi_child_properties ( file, cl, mself ); - this.write_navi_child_fields ( file, cl, mself ); - this.write_navi_child_constants ( file, cl, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_class ( GLib.FileStream file, Class cl, Basic mself ) { - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, cl, mself ); - this.write_navi_class_inline ( file, cl, mself ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_method ( GLib.FileStream file, Method m ) { - Basic parent = m.parent; - - file.printf ( "\t\t\t
    \n", css_style_navigation ); - - this.write_top_elements ( file, parent, m ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, m ); - else if ( m.parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, m ); - else if ( m.parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, m ); - else if ( m.parent is Enum ) - this.write_navi_enum_inline ( file, (Enum)parent, m ); - else if ( m.parent is ErrorDomain ) - this.write_navi_error_domain_inline ( file, (ErrorDomain)parent, m ); - else if ( m.parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, m ); - - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_property ( GLib.FileStream file, Property prop ) { - Basic parent = prop.parent; - - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, prop.parent, prop ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, prop ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, prop ); - - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_signal ( GLib.FileStream file, Signal sig ) { - Basic parent = sig.parent; - - file.printf ( "\t\t\t
    \n", css_style_navigation ); - - this.write_top_elements ( file, sig.parent, sig ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, sig ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, sig ); - - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_constant ( GLib.FileStream file, Constant c ) { - Basic parent = c.parent; - - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, parent, c ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, c ); - else if ( parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, c ); - else if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, c ); - //else if ( parent is Interface ) - // this.write_navi_interface_inline ( file, (Interface)parent, c ); - - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_field ( GLib.FileStream file, Field f ) { - Basic parent = f.parent; - - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, parent, f ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, f ); - else if ( parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, f ); - else if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, f ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, f ); - - file.puts ( "\t\t\t
    \n" ); - } - - private void write_navi_delegate ( GLib.FileStream file, Delegate del ) { - Basic parent = del.parent; - - file.printf ( "\t\t\t
    \n", css_style_navigation ); - this.write_top_elements ( file, parent, del ); - - if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, del ); - else if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, del ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, del ); - - file.puts ( "\t\t\t
    \n" ); - } - - - private void write_navi_child_methods_collection ( GLib.FileStream file, Gee.Collection methods, Basic mself ) { - foreach ( Method m in methods ) { - if ( m == mself ) - this.write_navi_entry ( file, m, mself, css_navi_construction_method, false ); - else - this.write_navi_entry ( file, m, mself, css_navi_construction_method, true ); - } - } - - private void write_navi_child_methods ( GLib.FileStream file, MethodHandler mh, Basic mself ) { - Gee.ReadOnlyCollection methods = mh.get_method_list ( ); - this.write_navi_child_methods_collection ( file, methods, mself ); - } - - private void write_navi_child_classes_without_childs_collection ( GLib.FileStream file, Gee.Collection classes, Basic mself ) { - foreach ( Class cl in classes ) { - if ( cl == mself ) - this.write_navi_entry ( file, cl, mself, css_navi_class, false ); - else - this.write_navi_entry ( file, cl, mself, css_navi_class, true ); - } - } - - private void write_navi_child_classes_without_childs ( GLib.FileStream file, ClassHandler clh, Basic mself ) { - Gee.ReadOnlyCollection classes = clh.get_class_list ( ); - this.write_navi_child_classes_without_childs_collection ( file, classes, mself ); - } - - private void write_navi_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh, Basic mself ) { - Gee.ReadOnlyCollection methods = cmh.get_construction_method_list ( ); - this.write_navi_child_methods_collection ( file, methods, mself ); - } - - private void write_navi_child_signals ( GLib.FileStream file, SignalHandler sh, Basic mself ) { - Gee.ReadOnlyCollection signals = sh.get_signal_list ( ); - - foreach ( Signal sig in signals ) { - if ( sig == mself ) - this.write_navi_entry ( file, sig, mself, css_navi_sig, false ); - else - this.write_navi_entry ( file, sig, mself, css_navi_sig, true ); - } - } - - private void write_navi_child_properties ( GLib.FileStream file, PropertyHandler ph, Basic mself ) { - Gee.ReadOnlyCollection properties = ph.get_property_list ( ); - - foreach ( Property p in properties ) { - if ( p == mself ) - this.write_navi_entry ( file, p, mself, css_navi_prop, false ); - else - this.write_navi_entry ( file, p, mself, css_navi_prop, true ); - } - } - - private void write_navi_child_fields_collection ( GLib.FileStream file, Gee.Collection fields, Basic mself ) { - foreach ( Field f in fields ) { - if ( f == mself ) - this.write_navi_entry ( file, f, mself, css_navi_field, false ); - else - this.write_navi_entry ( file, f, mself, css_navi_field, true ); - } - } - - private void write_navi_child_fields ( GLib.FileStream file, FieldHandler fh, Basic mself ) { - Gee.ReadOnlyCollection fields = fh.get_field_list ( ); - this.write_navi_child_fields_collection ( file, fields, mself ); - } - - private void write_navi_child_constants_collection ( GLib.FileStream file, Gee.Collection constants, Basic mself ) { - foreach ( Constant c in constants ) { - if ( c == mself ) - this.write_navi_entry ( file, c, mself, css_navi_constant, false ); - else - this.write_navi_entry ( file, c, mself, css_navi_constant, true ); - } - } - - private void write_navi_child_constants ( GLib.FileStream file, ConstantHandler ch, Basic mself ) { - Gee.ReadOnlyCollection constants = ch.get_constant_list ( ); - this.write_navi_child_constants_collection ( file, constants, mself ); - } - - private void write_navi_child_structs_without_childs_collection ( GLib.FileStream file, Gee.Collection structs, Basic mself ) { - foreach ( Struct stru in structs ) { - if ( stru == mself ) - this.write_navi_entry ( file, stru, mself, css_navi_struct, false ); - else - this.write_navi_entry ( file, stru, mself, css_navi_struct, true ); - } - } - - private void write_navi_child_structs_without_childs ( GLib.FileStream file, StructHandler strh, Basic mself ) { - Gee.Collection structs = strh.get_struct_list ( ); - this.write_navi_child_structs_without_childs_collection ( file, structs, mself ); - } - - private void write_navi_child_delegates_collection ( GLib.FileStream file, Gee.Collection delegates, Basic mself ) { - foreach ( Delegate del in delegates ) { - if ( del == mself ) - this.write_navi_entry ( file, del, mself, css_navi_del, false ); - else - this.write_navi_entry ( file, del, mself, css_navi_del, true ); - } - } - - private void write_navi_child_delegates ( GLib.FileStream file, DelegateHandler delh, Basic mself ) { - Gee.Collection delegates = delh.get_delegate_list ( ); - this.write_navi_child_delegates_collection ( file, delegates, mself ); - } - - private void write_navi_child_interfaces_without_childs_collection ( GLib.FileStream file, Gee.Collection interfaces, Basic mself ) { - foreach ( Interface iface in interfaces ) { - if ( iface == mself ) - this.write_navi_entry ( file, iface, mself, css_navi_iface, false ); - else - this.write_navi_entry ( file, iface, mself, css_navi_iface, true ); - } - } - - private void write_navi_child_interfaces_without_childs ( GLib.FileStream file, Namespace ifh, Basic mself ) { - Gee.Collection interfaces = ifh.get_interface_list ( ); - this.write_navi_child_interfaces_without_childs_collection ( file, interfaces, mself ); - } - - private void write_navi_child_enums_without_childs_collection ( GLib.FileStream file, Gee.Collection enums, Basic mself ) { - foreach ( Enum en in enums ) { - if ( en == mself ) - this.write_navi_entry ( file, en, mself, css_navi_enum, false ); - else - this.write_navi_entry ( file, en, mself, css_navi_enum, true ); - } - } - - private void write_navi_child_enums_without_childs ( GLib.FileStream file, EnumHandler eh, Basic mself ) { - Gee.Collection enums = eh.get_enum_list ( ); - this.write_navi_child_enums_without_childs_collection ( file, enums, mself ); - } - - private void write_navi_child_error_domains_without_childs_collection ( GLib.FileStream file, Gee.Collection errordomains, Basic mself ) { - foreach ( ErrorDomain errdom in errordomains ) { - if ( errdom == mself ) - this.write_navi_entry ( file, errdom, mself, css_navi_error_domain, false ); - else - this.write_navi_entry ( file, errdom, mself, css_navi_error_domain, true ); - } - } - - private void write_navi_child_error_domains_without_childs ( GLib.FileStream file, Namespace errdomh, Basic mself ) { - Gee.Collection errordomains = errdomh.get_error_domain_list ( ); - this.write_navi_child_error_domains_without_childs_collection ( file, errordomains, mself ); - } - - private void write_navi_child_namespaces_without_childs ( GLib.FileStream file, NamespaceHandler nsh, Basic mself ) { - Gee.ReadOnlyCollection namespaces = nsh.get_namespace_list ( ); - foreach ( Namespace ns in namespaces ) { - if ( ns == mself ) - this.write_navi_entry ( file, ns, mself, css_navi_namespace, false ); - else - this.write_navi_entry ( file, ns, mself, css_navi_namespace, true ); - } - } private string get_full_path ( Basic element ) { if ( element.name == null ) @@ -1044,8 +85,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { str.prepend ( pos.name ); } - string file_path = get_file_name ( element ); - string package_name = get_package_name ( file_path ) + "/"; + string package_name = element.file.name + "/"; str.prepend ( package_name ); str.append_unichar ( '/' ); @@ -1064,34 +104,16 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.langlet = new Valadoc.LangletIndex ( settings ); } - private void write_image_block ( GLib.FileStream file, DataType element ) { - string realimgpath = this.current_path + "tree.png"; - string imgpath = "tree.png"; - - if ( element is Class ) { - Diagrams.write_class_diagram ( (Class)element, realimgpath ); - } - else if ( element is Interface ) { - Diagrams.write_interface_diagram ( (Interface)element, realimgpath ); - } - else if ( element is Struct ) { - Diagrams.write_struct_diagram ( (Struct)element, realimgpath ); - } - - file.printf ( "

    Object Hierarchy:

    \n", css_title ); - file.printf ( "\n", css_diagram, imgpath ); + protected override string get_img_real_path ( Basic element ) { + return this.current_path + "tree.png"; } - private void write_file_content ( GLib.FileStream file, Package f ) { - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, this.package_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.puts ( "\t\t\t
    \n" ); + protected override string get_img_path ( Basic element ) { + return "tree.png"; } public override void visit_package ( Package file ) { - this.package_name = this.get_package_name ( file.name ); + this.package_name = file.name; this.is_vapi = file.is_external_package; if ( this.is_vapi ) @@ -1102,7 +124,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { var rt = DirUtils.create ( new_path, 0777 ); GLib.FileStream sfile = GLib.FileStream.open ( new_path + "index.html", "w" ); - this.write_file_header ( sfile ); + this.write_file_header ( sfile, this.get_css_link ( ), file.name ); this.write_navi_file ( sfile, file ); this.write_file_content ( sfile, file ); this.write_file_footer ( sfile ); @@ -1127,12 +149,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { ~HtmlDoclet () { - this.directory_level = 1; + this.directory_level = 0; copy_directory ( Config.doclet_path + "deps/", this.settings.path ); GLib.FileStream sfile = GLib.FileStream.open ( this.settings.path + "index.html", "w" ); string title = ( this.settings.pkg_name == null )? "" : this.settings.pkg_name; - this.write_file_header_template ( sfile, title, 0 ); + this.write_file_header ( sfile, this.get_css_link ( ), title ); if ( this.source_namespaces.size > 0 ) { sfile.printf ( "

    Namespaces:

    \n", css_title ); @@ -1152,468 +174,22 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { continue; if ( this.settings.with_deps ) - sfile.printf ( "\t
  • %s
  • \n", css_inline_navigation_package, css_navi_link, this.get_package_name(file.name), this.get_package_name(file.name) ); + sfile.printf ( "\t
  • %s
  • \n", css_inline_navigation_package, css_navi_link, file.name, file.name ); else - sfile.printf ( "\t
  • %s
  • \n", css_inline_navigation_package, this.get_package_name(file.name) ); + sfile.printf ( "\t
  • %s
  • \n", css_inline_navigation_package, file.name ); } sfile.puts ( "\n" ); this.write_file_footer ( sfile ); } - public void write_namespace_content ( GLib.FileStream file, Namespace ns ) { - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name () ); - file.printf ( "\t\t\t\t
    \n", css_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - ns.write_comment ( file ); - file.puts ( "\t\t\t
    \n" ); - } - - private void write_child_classes ( GLib.FileStream file, ClassHandler clh ) { - Gee.ReadOnlyCollection classes = clh.get_class_list (); - if ( classes.size > 0 ) { - file.printf ( "

    Classes:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Class subcl in classes ) { - string name; - if ( subcl.is_abstract ) { - name = "" + subcl.name + ""; - } - else { - name = subcl.name; - } - - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_class, css_navi_link, this.get_link(subcl, clh), name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_enums ( GLib.FileStream file, EnumHandler eh ) { - Gee.Collection enums = eh.get_enum_list (); - if ( enums.size > 0 ) { - file.printf ( "

    Enums:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Enum en in enums ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_enum, css_navi_link, this.get_link(en, eh), en.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_structs ( GLib.FileStream file, StructHandler struh ) { - Gee.Collection structs = struh.get_struct_list (); - if ( structs.size > 0 ) { - file.printf ( "

    Structs:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Struct stru in structs ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_struct, css_navi_link, this.get_link(stru, struh), stru.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_methods ( GLib.FileStream file, MethodHandler mh ) { - Gee.ReadOnlyCollection methods = mh.get_method_list (); - if ( methods.size > 0 ) { - file.printf ( "

    Methods:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Method m in methods ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m, mh), m.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_delegates ( GLib.FileStream file, DelegateHandler dh ) { - Gee.Collection delegates = dh.get_delegate_list (); - if ( delegates.size > 0 ) { - file.printf ( "

    Delegates:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Delegate d in delegates ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_delegate, css_navi_link, this.get_link(d, dh), d.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh ) { - Gee.ReadOnlyCollection methods = cmh.get_construction_method_list (); - if ( methods.size > 0 ) { - file.printf ( "

    Construction Methods:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Method m in methods ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m, cmh), m.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_signals ( GLib.FileStream file, SignalHandler sh ) { - Gee.ReadOnlyCollection signals = sh.get_signal_list (); - if ( signals.size > 0 ) { - file.printf ( "

    Signals:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Signal sig in signals ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_signal, css_navi_link, this.get_link(sig, sh), sig.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_properties ( GLib.FileStream file, PropertyHandler ph ) { - Gee.ReadOnlyCollection properties = ph.get_property_list (); - if ( properties.size > 0 ) { - file.printf ( "

    Properties:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Property prop in properties ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_property, css_navi_link, this.get_link(prop, ph), prop.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_fields ( GLib.FileStream file, FieldHandler fh ) { - Gee.ReadOnlyCollection fields = fh.get_field_list (); - if ( fields.size > 0 ) { - file.printf ( "

    Fields:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Field f in fields ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_fields, css_navi_link, this.get_link(f, fh), f.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_constants ( GLib.FileStream file, ConstantHandler ch ) { - Gee.ReadOnlyCollection constants = ch.get_constant_list (); - if ( constants.size > 0 ) { - file.printf ( "

    Constants:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Constant c in constants ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_constant, css_navi_link, this.get_link(c, ch), c.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_error_values ( GLib.FileStream file, ErrorDomain errdom ) { - Gee.ReadOnlyCollection error_codes = errdom.get_error_code_list (); - if ( error_codes.size > 0 ) { - file.printf ( "

    Error Codes:

    \n", css_title ); - file.printf ( "\n", css_errordomain_table ); - foreach ( ErrorCode errcode in error_codes ) { - file.puts ( "\n" ); - file.printf ( "\t\n", css_errordomain_table_name, errcode.name, errcode.name ); - file.printf ( "\t\n" ); - file.puts ( "\n" ); - } - file.puts ( "
    %s\n", css_errordomain_table_text ); - - errcode.write_comment ( file ); - - file.puts ( "\t
    \n" ); - } - } - - private void write_child_enum_values ( GLib.FileStream file, Enum en ) { - Gee.ReadOnlyCollection enum_values = en.get_enum_values (); - if ( enum_values.size > 0 ) { - file.printf ( "

    Enum Values:

    \n", css_title ); - file.printf ( "\n", css_enum_table ); - foreach ( EnumValue enval in enum_values ) { - file.puts ( "\n" ); - file.printf ( "\t\n", css_enum_table_name, enval.name, enval.name ); - file.printf ( "\t\n" ); - file.puts ( "\n" ); - } - file.puts ( "
    %s\n", css_enum_table_text ); - - enval.write_comment ( file ); - - file.puts ( "\t
    \n" ); - } - } - - public void write_interface_content ( GLib.FileStream file, Interface iface ) { - string full_name = iface.full_name (); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - this.write_image_block ( file, iface ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_interface ( iface, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - iface.write_comment ( file ); - this.write_namespace_note ( file, iface ); - this.write_package_note ( file, iface ); - file.printf ( "\t\t\t\t

    Content:

    \n", css_title ); - this.write_child_classes ( file, iface ); - this.write_child_structs ( file, iface ); - this.write_child_delegates ( file, iface ); - this.write_child_methods ( file, iface ); - this.write_child_signals ( file, iface ); - this.write_child_properties ( file, iface ); - this.write_child_fields ( file, iface ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_class_content ( GLib.FileStream file, Class cl ) { - string full_name = cl.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - this.write_image_block ( file, cl ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_class ( cl, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - cl.write_comment ( file ); - this.write_namespace_note ( file, cl ); - this.write_package_note ( file, cl ); - file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); - this.write_child_construction_methods ( file, cl ); - this.write_child_classes ( file, cl ); - this.write_child_structs ( file, cl ); - this.write_child_enums ( file, cl ); - this.write_child_delegates ( file, cl ); - this.write_child_methods ( file, cl ); - this.write_child_signals ( file, cl ); - this.write_child_properties ( file, cl ); - this.write_child_fields ( file, cl ); - this.write_child_constants ( file, cl ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_struct_content ( GLib.FileStream file, Struct stru ) { - string full_name = stru.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - this.write_image_block ( file, stru ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - stru.write_comment ( file ); - this.write_namespace_note ( file, stru ); - this.write_package_note ( file, stru ); - file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_struct ( stru, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - this.write_child_construction_methods ( file, stru ); - this.write_child_methods ( file, stru ); - this.write_child_fields ( file, stru ); - this.write_child_constants ( file, stru ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom ) { - string full_name = errdom.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - errdom.write_comment ( file ); - this.write_namespace_note ( file, errdom ); - this.write_package_note ( file, errdom ); - file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); - this.write_child_error_values ( file, errdom ); - this.write_child_methods ( file, errdom ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_enum_content ( GLib.FileStream file, Enum en ) { - string full_name = en.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - en.write_comment ( file ); - this.write_namespace_note ( file, en ); - this.write_package_note ( file, en ); - file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); - this.write_child_enum_values ( file, en ); - this.write_child_methods ( file, en ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_property_content ( GLib.FileStream file, Property prop ) { - string full_name = prop.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_property ( prop, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - prop.write_comment ( file ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_constant_content ( GLib.FileStream file, Constant constant, ConstantHandler parent ) { - string full_name = constant.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_constant ( constant, parent, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - constant.write_comment ( file ); - - if ( constant.parent is Namespace ) { - this.write_namespace_note ( file, constant ); - } - - this.write_package_note ( file, constant ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_field_content ( GLib.FileStream file, Field field, FieldHandler parent ) { - string full_name = field.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_field ( field, parent, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - field.write_comment ( file ); - - if ( field.parent is Namespace ) { - this.write_namespace_note ( file, field ); - } - - this.write_package_note ( file, field ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_delegate_content ( GLib.FileStream file, Delegate del ) { - string full_name = del.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_delegate ( del, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - del.write_comment ( file ); - - if ( del.parent is Namespace ) { - this.write_namespace_note ( file, del ); - this.write_package_note ( file, del ); - } - - file.puts ( "\t\t\t
    \n" ); - } - - public void write_signal_content ( GLib.FileStream file, Signal sig ) { - string full_name = sig.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_signal ( sig, file ); - file.printf ( "\n\t\t\t\t
    \n" ); - sig.write_comment ( file ); - file.puts ( "\t\t\t
    \n" ); - } - - public void write_method_content ( GLib.FileStream file, Method m , Valadoc.MethodHandler parent ) { - string full_name = m.full_name ( ); - file.printf ( "\t\t\t
    \n", css_style_content ); - file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); - file.printf ( "\t\t\t\t
    \n", css_headline_hr ); - file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); - file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); - this.langlet.write_method ( file, m, parent ); - file.printf ( "\n\t\t\t\t
    \n" ); - m.write_comment ( file ); - - if ( m.parent is Namespace ) { - this.write_namespace_note ( file, m ); - } - - this.write_package_note ( file, m ); - file.puts ( "\t\t\t
    \n" ); - } - - private string css_site_header = "site_header"; - - private void write_file_header_template ( GLib.FileStream file, string title, int level ) { - GLib.StringBuilder css_path = new GLib.StringBuilder ( ); - for ( int i = 0; level > i; i++ ) { - css_path.append ( "../" ); - } - - css_path.append ( "main.css" ); - - file.puts ( "\n" ); - file.puts ( "\t\n" ); - file.puts ( "\t\tVala Binding Reference\n" ); - file.printf ( "\t\t\n", css_path.str ); - file.puts ( "\t\n" ); - file.puts ( "\t\n\n" ); - - file.printf ( "\t
    \n", this.css_site_header ); - file.printf ( "\t\t%s Reference Manual\n", title ); - file.puts ( "\t
    \n\n" ); - - file.printf ( "\t\t
    \n", this.css_style_body ); - } - - private void write_package_note ( GLib.FileStream file, Basic element ) { - string package = element.package; - if ( package == null ) - return ; - - file.printf ( "\n\n
    \nPackage: %s\n\n", package ); - } - - private void write_namespace_note ( GLib.FileStream file, Basic element ) { - for ( ; element is Namespace == false; element = element.parent ) - ; - - if ( element.parent == null ) - return ; - - if ( element.name == null ) - return ; - - file.printf ( "\n\n
    \nNamespace: %s\n\n", ((Namespace)element).full_name () ); - } - - private void write_file_header ( GLib.FileStream file ) { - this.write_file_header_template ( file, this.package_name, this.directory_level ); - } - - private const string css_style_navigation = "site_navigation"; - private const string css_style_content = "site_content"; - private const string css_style_body = "site_body"; - - - private void write_file_footer ( GLib.FileStream file ) { - file.puts ( "\t
    \n" ); - - file.puts ( "\t
    \n" ); - file.puts ( "\t\t
    \n" ); - file.puts ( "\t\t
    \n" ); - file.puts ( "\t\t\tcreated by valadoc\n" ); - file.puts ( "\t\t
    \n" ); - file.puts ( "\t
    \n" ); - file.puts ( "\t\n" ); - file.puts ( "" ); - } - public override void visit_property ( Property prop ) { string path = this.current_path + prop.name + "/"; var rt = DirUtils.create ( path, 0777 ); this.directory_level++; GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), prop.name ); this.write_navi_property ( file, prop ); this.write_property_content ( file, prop ); this.write_file_footer ( file ); @@ -1628,7 +204,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { var rt = DirUtils.create ( path, 0777 ); this.directory_level++; GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), constant.name ); this.write_navi_constant ( file, constant ); this.write_constant_content ( file, constant, parent ); this.write_file_footer ( file ); @@ -1641,7 +217,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { var rt = DirUtils.create ( path, 0777 ); this.directory_level++; GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), field.name ); this.write_navi_field ( file, field ); this.write_field_content ( file, field, parent ); this.write_file_footer ( file ); @@ -1655,7 +231,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.directory_level++; GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), del.name ); this.write_navi_delegate ( file, del ); this.write_delegate_content ( file, del ); this.write_file_footer ( file ); @@ -1670,7 +246,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { var rt = DirUtils.create ( path, 0777 ); GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), sig.name ); this.write_navi_signal ( file, sig ); write_signal_content ( file, sig ); this.write_file_footer ( file ); @@ -1685,7 +261,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.directory_level++; GLib.FileStream file = GLib.FileStream.open ( path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), m.name ); this.write_navi_method ( file, m ); this.write_method_content ( file, m, parent ); this.write_file_footer ( file ); @@ -1713,7 +289,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { var rt = DirUtils.create ( this.current_path, 0777 ); GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" ); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), ns.name ); this.write_navi_namespace ( file, ns ); this.write_namespace_content ( file, ns ); this.write_file_footer ( file ); @@ -1746,7 +322,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { en.visit_methods ( this ); GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), en.name ); this.write_navi_enum ( file, en, en ); this.write_enum_content ( file, en ); this.write_file_footer ( file ); @@ -1766,7 +342,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { errdom.visit_methods ( this ); GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), errdom.name ); this.write_navi_error_domain ( file, errdom, errdom ); this.write_error_domain_content ( file, errdom ); this.write_file_footer ( file ); @@ -1789,7 +365,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { stru.visit_constants ( this ); GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), stru.name ); this.write_navi_struct ( file, stru, stru ); this.write_struct_content ( file, stru ); this.write_file_footer ( file ); @@ -1818,7 +394,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { cl.visit_constants ( this ); GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w"); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), cl.name ); this.write_navi_class ( file, cl, cl ); this.write_class_content ( file, cl ); this.write_file_footer ( file ); @@ -1844,7 +420,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { iface.visit_fields ( this ); GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" ); - this.write_file_header ( file ); + this.write_file_header ( file, this.get_css_link ( ), iface.name ); this.write_navi_interface ( file, iface, iface ); this.write_interface_content ( file, iface ); this.write_file_footer ( file ); diff --git a/src/doclets/html/linkhelper/Makefile.am b/src/doclets/html/linkhelper/Makefile.am index aca36ba5f..831d6ec73 100644 --- a/src/doclets/html/linkhelper/Makefile.am +++ b/src/doclets/html/linkhelper/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libhtmlhelper.vala.stamp libhtmlhelper.vala.stamp: $(libhtmlhelper_VALASOURCES) - $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^ + $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^ touch $@ @@ -29,6 +29,7 @@ libhtmlhelper_la_SOURCES = \ AM_CFLAGS = \ -I ../../../libvaladoc/ \ + -I ../../htmlhelpers/ \ $(LIBVALA_CFLAGS) \ $(GLIB_CFLAGS) \ $(NULL) @@ -36,6 +37,7 @@ AM_CFLAGS = \ libhtmlhelper_la_LIBADD = \ ../../../libvaladoc/libvaladoc.la \ + ../../htmlhelpers/libhtmlhelpers.la \ $(LIBVALA_LIBS) \ $(GLIB_LIBS) \ $(NULL) diff --git a/src/doclets/html/linkhelper/helper.vala b/src/doclets/html/linkhelper/helper.vala index 4bcdc7d4a..831edb85e 100755 --- a/src/doclets/html/linkhelper/helper.vala +++ b/src/doclets/html/linkhelper/helper.vala @@ -20,116 +20,8 @@ using GLib; - -/* css-class-names: */ -public const string css_inline_navigation = "main_inline_navigation"; -public const string css_inline_navigation_namespace = "main_inline_navigation_namespace"; -public const string css_inline_navigation_property = "main_inline_navigation_property"; -public const string css_inline_navigation_method = "main_inline_navigation_method"; -public const string css_inline_navigation_signal = "main_inline_navigation_signal"; -public const string css_inline_navigation_fields = "main_inline_navigation_fields"; -public const string css_inline_navigation_class = "main_inline_navigation_class"; -public const string css_inline_navigation_enum = "main_inline_navigation_enum"; -public const string css_inline_navigation_struct = "main_inline_navigation_struct"; -public const string css_inline_navigation_delegate = "main_inline_navigation_delegate"; -public const string css_inline_navigation_constant = "main_inline_navigation_constant"; -public const string css_inline_navigation_package = "main_inline_navigation_package"; - -public const string css_navi_package_index = "navi_package_index"; -public const string css_navi_package = "navi_package"; -public const string css_navi_construction_method = "navi_construction_method"; -public const string css_navi_error_domain = "navi_error_domain"; -public const string css_navi_namespace = "navi_namespace"; -public const string css_navi_method = "navi_method"; -public const string css_navi_struct = "navi_struct"; -public const string css_navi_iface = "navi_iface"; -public const string css_navi_field = "navi_field"; -public const string css_navi_class = "navi_class"; -public const string css_navi_enum = "navi_enum"; -public const string css_navi_link = "navi_link"; -public const string css_navi_constant = "navi_constant"; -public const string css_navi_prop = "navi_prop"; -public const string css_navi_del = "navi_del"; -public const string css_navi_sig = "navi_sig"; -public const string css_navi = "navi_main"; -public const string css_navi_enval = "main_navi_enval"; -public const string css_navi_errdomcode = "main_navi_errdomcode"; -public const string css_navi_hr = "navi_hr"; - -public const string css_errordomain_table_name = "main_errordomain_table_name"; -public const string css_errordomain_table_text = "main_errordomain_table_text"; -public const string css_errordomain_table = "main_errordomain_table"; - - -public const string css_enum_table_name = "main_enum_table_name"; -public const string css_enum_table_text = "main_enum_table_text"; -public const string css_enum_table = "main_enum_table"; - -public const string css_diagram = "main_diagram"; -public const string css_see_list = "main_see_list"; -public const string css_exception_table = "main_parameter_table"; -public const string css_parameter_table_text = "main_parameter_table_text"; -public const string css_parameter_table_name = "main_parameter_table_name"; -public const string css_parameter_table = "main_parameter_table"; -public const string css_title = "main_title"; -public const string css_other_type = "main_other_type"; -public const string css_basic_type = "main_basic_type"; -public const string css_keyword = "main_keyword"; -public const string css_optional_parameter = "main_optional_parameter"; -public const string css_code_definition = "main_code_definition"; -public const string css_headline_hr = "main_hr"; -public const string css_hr = "main_hr"; -public const string css_list_errdom = "main_list_errdom"; -public const string css_list_en = "main_list_en"; -public const string css_list_ns = "main_list_ns"; -public const string css_list_cl = "main_list_cl"; -public const string css_list_iface = "main_list_iface"; -public const string css_list_stru = "main_list_stru"; -public const string css_list_field = "main_list_field"; -public const string css_list_prop = "main_list_prop"; -public const string css_list_del = "main_list_del"; -public const string css_list_sig = "main_list_sig"; -public const string css_list_m = "main_list_m"; - - - -public interface Valadoc.LinkHelper : Object { - private static string package_name = null; - - public abstract Settings settings { - construct set; - get; - } - - private string get_dirname ( string file_name ) { - if ( file_name[file_name.len()-1] == '/' ) - return GLib.Path.get_dirname ( file_name ); - else - return GLib.Path.get_basename ( file_name ); - } - - protected string get_package_name ( string file_path ) { - if ( file_path.has_suffix (".vapi") ) { - string file_name = GLib.Path.get_basename (file_path); - return file_name.ndup ( file_name.size() - ".vapi".size() ); - } - - return this.settings.pkg_name; - } - - public string get_file_name ( Valadoc.Basic tag ) { - Valadoc.Basic pos = tag; - - while ( pos != null ) { - if ( pos is Valadoc.Package ) - return pos.name; - - pos = pos.parent; - } - return null; - } - - protected string get_top_link ( Valadoc.Basic? postag ) { +public interface Valadoc.LinkHelper { + protected string get_html_top_link ( Valadoc.Basic? postag ) { if ( postag == null ) return ""; @@ -143,18 +35,14 @@ public interface Valadoc.LinkHelper : Object { return str.str; } - protected string? get_link ( Valadoc.Basic tag, Valadoc.Basic? postag ) { - if ( !this.settings.to_doc( tag.file_name ) ) - return null; - + protected string? get_html_link ( Valadoc.Settings settings, Valadoc.Basic element, Valadoc.Basic pos2 ) { GLib.StringBuilder str = new GLib.StringBuilder ( "" ); - Valadoc.Basic pos = tag; - + Valadoc.Basic pos = element; string? link_id = null; - if ( tag is Valadoc.Package == false ) { - if ( tag is Valadoc.EnumValue || tag is Valadoc.ErrorCode ) { - link_id = "#"+tag.name; + if ( element is Valadoc.Package == false ) { + if ( element is Valadoc.EnumValue || element is Valadoc.ErrorCode ) { + link_id = "#" + element.name; pos = pos.parent; } @@ -172,10 +60,9 @@ public interface Valadoc.LinkHelper : Object { pos = pos.parent; } } - string filename = this.get_file_name ( tag ); - string package_name = this.get_package_name ( filename ); - str.prepend ( package_name ); - str.prepend ( this.get_top_link ( postag ) ); + + str.prepend ( pos.file.name ); + str.prepend ( this.get_html_top_link ( pos2 ) ); str.append ( "/index.html" ); if ( link_id != null ) @@ -185,4 +72,3 @@ public interface Valadoc.LinkHelper : Object { } } - diff --git a/src/doclets/html/taglets/author/Makefile.am b/src/doclets/html/taglets/author/Makefile.am index f26055f6c..199e13e92 100644 --- a/src/doclets/html/taglets/author/Makefile.am +++ b/src/doclets/html/taglets/author/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletversion.vala.stamp libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletversion_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletversion_la_LDFLAGS = -module -avoid-version libtagletversion_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/html/taglets/link/Makefile.am b/src/doclets/html/taglets/link/Makefile.am index 1ff506414..7e0ad1df0 100644 --- a/src/doclets/html/taglets/link/Makefile.am +++ b/src/doclets/html/taglets/link/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletlink.vala.stamp libtagletlink.vala.stamp: $(libtagletlink_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletlink_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletlink_la_LDFLAGS = -module -avoid-version libtagletlink_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/html/taglets/link/taglet.vala b/src/doclets/html/taglets/link/taglet.vala index e47f2694f..70f20c387 100644 --- a/src/doclets/html/taglets/link/taglet.vala +++ b/src/doclets/html/taglets/link/taglet.vala @@ -46,8 +46,8 @@ public class LinkHtmlTaglet : InlineTaglet, LinkHelper { } this.settings = settings; - this.path = this.get_link ( element, me ); - this.content = str; + this.path = this.get_html_link ( settings, element, me ); + this.content = element.full_name (); return true; } diff --git a/src/doclets/html/taglets/parameter/Makefile.am b/src/doclets/html/taglets/parameter/Makefile.am index 751e3bd7b..e2eaf9a77 100644 --- a/src/doclets/html/taglets/parameter/Makefile.am +++ b/src/doclets/html/taglets/parameter/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletparameter.vala.stamp libtagletparameter.vala.stamp: $(libtagletparameter_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletparameter_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletparameter_la_LDFLAGS = -module -avoid-version libtagletparameter_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/html/taglets/return/Makefile.am b/src/doclets/html/taglets/return/Makefile.am index b71782b30..84ac01ade 100644 --- a/src/doclets/html/taglets/return/Makefile.am +++ b/src/doclets/html/taglets/return/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletXXXX.vala.stamp libtagletXXXX.vala.stamp: $(libtagletXXXX_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletXXXX_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletXXXX_la_LDFLAGS = -module -avoid-version libtagletXXXX_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/html/taglets/see/Makefile.am b/src/doclets/html/taglets/see/Makefile.am index ea3990c03..3fdbf0487 100644 --- a/src/doclets/html/taglets/see/Makefile.am +++ b/src/doclets/html/taglets/see/Makefile.am @@ -11,11 +11,11 @@ BUILT_SOURCES = libtagletsee.vala.stamp libtagletsee.vala.stamp: $(libtagletsee_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ - + tagletseedir = $(libdir)/valadoc/plugins/template/taglets/ @@ -30,12 +30,13 @@ libtagletsee_la_SOURCES = \ -AM_CFLAGS = -g \ +AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ - $(GLIB_CFLAGS) \ - $(LIBVALA_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(LIBVALA_CFLAGS) \ $(NULL) @@ -44,6 +45,7 @@ libtagletsee_la_LDFLAGS = -module -avoid-version libtagletsee_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/html/taglets/see/taglet.vala b/src/doclets/html/taglets/see/taglet.vala index dc6f1e92f..896a2394e 100644 --- a/src/doclets/html/taglets/see/taglet.vala +++ b/src/doclets/html/taglets/see/taglet.vala @@ -23,7 +23,7 @@ using Vala; using Gee; -public class SeeHtmlTaglet : MainTaglet, LinkHelper { +public class SeeHtmlTaglet : MainTaglet, Valadoc.LinkHelper { private string name; private string path; @@ -76,8 +76,8 @@ public class SeeHtmlTaglet : MainTaglet, LinkHelper { } this.settings = settings; - this.path = this.get_link ( element, me ); - this.name = str; + this.path = this.get_html_link ( settings, element, me ); + this.name = element.full_name (); return true; } diff --git a/src/doclets/html/taglets/throws/Makefile.am b/src/doclets/html/taglets/throws/Makefile.am index e37d2983c..972faf082 100644 --- a/src/doclets/html/taglets/throws/Makefile.am +++ b/src/doclets/html/taglets/throws/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libexceptionparameter.vala.stamp libexceptionparameter.vala.stamp: $(libexceptionparameter_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libexceptionparameter_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libexceptionparameter_la_LDFLAGS = -module -avoid-version libexceptionparameter_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/html/taglets/version/Makefile.am b/src/doclets/html/taglets/version/Makefile.am index f26055f6c..199e13e92 100644 --- a/src/doclets/html/taglets/version/Makefile.am +++ b/src/doclets/html/taglets/version/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletversion.vala.stamp libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletversion_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ @@ -44,6 +45,7 @@ libtagletversion_la_LDFLAGS = -module -avoid-version libtagletversion_la_LIBADD = \ ../../../../libvaladoc/libvaladoc.la \ + ../../../htmlhelpers/libhtmlhelpers.la \ ../../linkhelper/libhtmlhelper.la \ $(GLIB_LIBS) \ $(LIBVALA_LIBS) \ diff --git a/src/doclets/htmlhelpers/Makefile.am b/src/doclets/htmlhelpers/Makefile.am new file mode 100644 index 000000000..0258e3aab --- /dev/null +++ b/src/doclets/htmlhelpers/Makefile.am @@ -0,0 +1,44 @@ +# src/Makefile.am + + + +libhtmlhelpers_VALASOURCES = \ + htmlhelpers.vala \ + $(NULL) + + +BUILT_SOURCES = libhtmlhelpers.vala.stamp + + +libhtmlhelpers.vala.stamp: $(libhtmlhelpers_VALASOURCES) + $(VALAC) -C --library libhtmlhelpers-1.0 --basedir . --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^ + touch $@ + + + +htmlhelpersdir = $(libdir)/valadoc/plugins/ +htmlhelpers_LTLIBRARIES = libhtmlhelpers.la + + +libhtmlhelpers_la_SOURCES = \ + libhtmlhelpers.vala.stamp \ + $(libhtmlhelpers_VALASOURCES:.vala=.c) \ + $(libhtmlhelpers_VALASOURCES:.vala=.h) \ + $(NULL) + + +AM_CFLAGS = \ + -I ../../libvaladoc/ \ + $(LIBVALA_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(NULL) + + +libhtmlhelper_la_LIBADD = \ + ../../libvaladoc/libvaladoc.la \ + $(LIBVALA_LIBS) \ + $(GLIB_LIBS) \ + $(NULL) + + +EXTRA_DIST = $(libhtmlhelpers_VALASOURCES) libhtmlhelpers.vala.stamp diff --git a/src/doclets/htmlhelpers/htmlhelpers.vala b/src/doclets/htmlhelpers/htmlhelpers.vala new file mode 100644 index 000000000..f14995171 --- /dev/null +++ b/src/doclets/htmlhelpers/htmlhelpers.vala @@ -0,0 +1,1567 @@ + + + +using GLib; + + +public const string css_inline_navigation = "main_inline_navigation"; +public const string css_inline_navigation_property = "main_inline_navigation_property"; +public const string css_inline_navigation_method = "main_inline_navigation_method"; +public const string css_inline_navigation_signal = "main_inline_navigation_signal"; +public const string css_inline_navigation_fields = "main_inline_navigation_fields"; +public const string css_inline_navigation_class = "main_inline_navigation_class"; +public const string css_inline_navigation_enum = "main_inline_navigation_enum"; +public const string css_inline_navigation_struct = "main_inline_navigation_struct"; +public const string css_inline_navigation_delegate = "main_inline_navigation_delegate"; +public const string css_inline_navigation_constant = "main_inline_navigation_constant"; +public const string css_inline_navigation_namespace = "main_inline_navigation_namespace"; +public const string css_inline_navigation_package = "main_inline_navigation_package"; + + +public const string css_site_header = "site_header"; + +public const string css_navi_package_index = "navi_package_index"; +public const string css_navi_package = "navi_package"; +public const string css_navi_construction_method = "navi_construction_method"; +public const string css_navi_error_domain = "navi_error_domain"; +public const string css_navi_namespace = "navi_namespace"; +public const string css_navi_method = "navi_method"; +public const string css_navi_struct = "navi_struct"; +public const string css_navi_iface = "navi_iface"; +public const string css_navi_field = "navi_field"; +public const string css_navi_class = "navi_class"; +public const string css_navi_enum = "navi_enum"; +public const string css_navi_link = "navi_link"; +public const string css_navi_constant = "navi_constant"; +public const string css_navi_prop = "navi_prop"; +public const string css_navi_del = "navi_del"; +public const string css_navi_sig = "navi_sig"; +public const string css_navi = "navi_main"; +public const string css_navi_enval = "main_navi_enval"; +public const string css_navi_errdomcode = "main_navi_errdomcode"; +public const string css_navi_hr = "navi_hr"; + +public const string css_errordomain_table_name = "main_errordomain_table_name"; +public const string css_errordomain_table_text = "main_errordomain_table_text"; +public const string css_errordomain_table = "main_errordomain_table"; + + +public const string css_enum_table_name = "main_enum_table_name"; +public const string css_enum_table_text = "main_enum_table_text"; +public const string css_enum_table = "main_enum_table"; + +public const string css_diagram = "main_diagram"; +public const string css_see_list = "main_see_list"; +public const string css_exception_table = "main_parameter_table"; +public const string css_parameter_table_text = "main_parameter_table_text"; +public const string css_parameter_table_name = "main_parameter_table_name"; +public const string css_parameter_table = "main_parameter_table"; +public const string css_title = "main_title"; +public const string css_other_type = "main_other_type"; +public const string css_basic_type = "main_basic_type"; +public const string css_keyword = "main_keyword"; +public const string css_optional_parameter = "main_optional_parameter"; +public const string css_code_definition = "main_code_definition"; +public const string css_headline_hr = "main_hr"; +public const string css_hr = "main_hr"; +public const string css_list_errdom = "main_list_errdom"; +public const string css_list_en = "main_list_en"; +public const string css_list_ns = "main_list_ns"; +public const string css_list_cl = "main_list_cl"; +public const string css_list_iface = "main_list_iface"; +public const string css_list_stru = "main_list_stru"; +public const string css_list_field = "main_list_field"; +public const string css_list_prop = "main_list_prop"; +public const string css_list_del = "main_list_del"; +public const string css_list_sig = "main_list_sig"; +public const string css_list_m = "main_list_m"; + +public const string css_style_navigation = "site_navigation"; +public const string css_style_content = "site_content"; +public const string css_style_body = "site_body"; + + + + + + + + +public abstract class Valadoc.BasicHtmlLanglet : Valadoc.Langlet { + public Valadoc.Settings settings { + construct set; + protected get; + } + + public BasicHtmlLanglet ( Settings settings ) { + this.settings = settings; + } + + private Basic position = null; + + protected abstract string get_link ( Basic type, Basic position ); + + private inline bool is_basic_type ( string name ) { + string[] basic_types = new string[] { "bool", "char", "uchar", "int", "uint", "short", "ushort", + "long", "ulong", "size_t", "ssize_t", "int8", "uint8", "int16", "uint16", "int32", + "uint32", "int64", "uint64", "float", "double", "time_t", "unichar", "string" + }; + + foreach ( string str in basic_types ) { + if ( str == name ) + return true; + } + + return false; + } + + private void write_type_name ( DataType? datatype, GLib.FileStream file ) { + if ( datatype == null ) { + file.printf ( "void", css_keyword ); + return ; + } + + string typename = datatype.full_name (); + if ( datatype.parent.name == null && (datatype is Class || datatype is Struct) ) { + if ( this.is_basic_type ( typename ) ) { + string link = this.get_link(datatype, this.position ); + if ( link == null ) + file.printf ( "%s", css_basic_type, typename ); + else + file.printf ( "%s", css_basic_type, link, typename ); + return ; + } + } + + string link = this.get_link(datatype, this.position); + if ( link == null ) + file.printf ( "%s", css_other_type, typename ); + else + file.printf ( "%s", css_other_type, link, typename ); + } + + private void write_type_reference_name ( TypeReference type_reference, GLib.FileStream file ) { + if ( type_reference.type_name == "void" ) { + file.printf ( "void", css_keyword ); + } + else { + if ( type_reference.data_type == null ) { + file.printf ( "%s", css_other_type, type_reference.type_name ); + } + else { + this.write_type_name ( type_reference.data_type, file ); + } + } + } + + private void write_type_reference_template_arguments ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { + Gee.Collection arglst = type_reference.get_type_arguments ( ); + int size = arglst.size; + if ( size == 0 ) + return ; + + file.puts ( "<" ); + int i = 0; + + foreach ( TypeReference arg in arglst ) { + i++; + + this.write_nested_type_referene ( arg, file ); + if ( i != size ) + file.puts ( ", " ); + } + + file.puts ( ">" ); + } + + private void write_nested_type_referene ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { + if ( type_reference.type_name == null ) + return ; + + if ( type_reference.is_weak ) + file.printf ( "weak ", css_keyword ); + + this.write_type_reference_name ( type_reference, file ); + this.write_type_reference_template_arguments ( type_reference, file ); + + if ( type_reference.is_array ) { + string str = string.nfill ( type_reference.array_rank-1, ','); + file.printf ( "[%s]", str ); + } + + if ( type_reference.pass_ownership ) { + file.putc ( '#' ); + } + + if ( type_reference.is_nullable ) { + file.putc ( '?' ); + } + + string str = string.nfill ( type_reference.pointer_rank, '*' ); + file.puts ( str ); + + } + + public override void write_type_reference ( Valadoc.TypeReference type_reference, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + + if ( type_reference == null ) + return ; + + this.write_nested_type_referene ( type_reference, file ); + file.putc ( ' ' ); + + /* + if ( type_reference.is_weak ) { + file.printf ( "weak ", css_keyword ); + } + + this.write_type_name ( type_reference.data_type, file ); + + if ( type_reference.is_array ) { + string str = string.nfill ( type_reference.array_rank-1, ','); + file.printf ( "[%s]", str ); + } + + if ( type_reference.pass_ownership ) { + file.putc ( '#' ); + } + + if ( type_reference.is_nullable ) { + file.putc ( '?' ); + } + + string str = string.nfill ( type_reference.pointer_rank, '*' ); + file.puts ( str ); + */ + } + + private void write_formal_parameter ( FormalParameter param, GLib.FileStream file ) { + if ( param.ellipsis ) { + file.puts ( " ..." ); + } + else { + if ( param.is_out ) + file.printf ( "out ", css_keyword ); + else if ( param.is_ref ) + file.printf ( "ref ", css_keyword ); + + this.write_type_reference ( param.type_reference, file ); + file.printf ( " %s", param.name ); + } + } + + public override void write_parameter_list ( ParameterListHandler thandler, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + bool open_bracket = false; + + Gee.ArrayList params = thandler.param_list; + int size = params.size; + int i = 0; + + file.putc ( '(' ); + + foreach ( FormalParameter param in params ) { + i++; + + if ( param.default_value != null && open_bracket == false ) { + file.printf ( "[", css_optional_parameter ); + open_bracket = true; + } + + this.write_formal_parameter ( param, file ); + if ( i != size ) { + file.puts ( ", " ); + } + else if ( open_bracket == true ) { + file.puts ( "]" ); + } + } + + file.putc ( ')' ); + } + + private void write_exception_list ( ExceptionHandler exception_handler, GLib.FileStream file ) { + Gee.ReadOnlyCollection error_domains = exception_handler.get_error_domains (); + int size = error_domains.size; + int i = 1; + + if ( size == 0 ) + return ; + + file.printf ( " throws ", css_keyword ); + + foreach ( TypeReference type_reference in error_domains ) { + if ( type_reference == null ) { + file.printf ( "GLib.Error", css_other_type ); + } + else { + this.write_type_reference ( type_reference, file ); + } + + if ( error_domains.size > i ) { + file.puts ( ", " ); + } + i++; + } + } + + public override void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler parent ) { + this.position = m; + + GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); + weak GLib.FileStream file = (GLib.FileStream)ptr; + + this.write_accessor ( m, file ); + + if ( m.is_abstract ) + modifiers.append ( " abstract" ); + if ( m.is_virtual ) + modifiers.append ( " virtual" ); + if ( m.is_override ) + modifiers.append ( " override" ); + if ( m.is_static ) + modifiers.append ( " static" ); + if ( m.is_inline ) + modifiers.append ( " inline" ); + + file.printf ( " %s ", css_keyword, modifiers.str ); + this.write_type_reference ( m.return_type, file ); + file.puts ( m.name ); + file.puts ( " " ); + this.write_parameter_list ( m, file ); + this.write_exception_list ( m, file ); + } + + public override void write_type_parameter ( TypeParameter param, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + file.puts ( param.datatype_name ); + } + + public override void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + int i = 1; + + var lst = thandler.get_template_param_list( ); + if ( lst.size == 0 ) + return ; + + file.puts ( "<" ); // < + + foreach ( TypeParameter param in lst ) { + param.write ( this, file ); + if ( lst.size > i ) + file.puts ( ", " ); + + i++; + } + file.puts ( ">" ); // > + } + + public override void write_field ( Valadoc.Field field, Valadoc.FieldHandler parent, void* ptr ) { + this.position = field; + weak GLib.FileStream file = (GLib.FileStream)ptr; + + this.write_accessor ( field, file ); + + if ( field.is_volatile ) + file.printf ( " volatile", css_keyword ); + + this.write_type_reference ( field.type_reference, file ); + + file.printf ( " %s", field.name ); + } + + public override void write_constant ( Constant constant, ConstantHandler parent, void* ptr ) { + this.position = constant; + weak GLib.FileStream file = (GLib.FileStream)ptr; + + this.write_accessor ( constant, file ); + file.printf ( " const ", css_keyword ); + this.write_type_reference ( constant.type_reference, file ); + file.printf ( " %s", constant.name ); + } + + public override void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + + Property prop = (Property)propac.parent; + + if ( !(prop.is_public == propac.is_public && prop.is_private == propac.is_private && prop.is_protected == propac.is_protected) ) { + // FIXME: PropertyAccessor isn't a SymbolAccessibility. (Valac-Bug.) + if ( propac.is_public ) + file.printf ( "public ", css_keyword ); + else if ( propac.is_protected ) + file.printf ( "protected ", css_keyword ); + else if ( propac.is_private ) + file.printf ( "private ", css_keyword ); + } + + + if ( propac.is_get ) { + file.printf ( " get;", css_keyword ); + } + else if ( propac.is_set ) { + if ( propac.is_construct ) { + file.printf ( " construct ", css_keyword ); + } + + file.printf ( " set;", css_keyword ); + } + } + + public override void write_property ( Valadoc.Property prop, void* ptr ) { + this.position = prop; + GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); + weak GLib.FileStream file = (GLib.FileStream)ptr; + + this.write_accessor ( prop, file ); + + if ( prop.is_virtual ) + modifiers.append ( " virtual " ); + if ( prop.is_abstract ) + modifiers.append ( " abstract " ); + if ( prop.is_override ) + modifiers.append ( " override " ); + + + this.write_type_reference ( prop.return_type, file ); + file.printf ( " %s%s { ", css_keyword, modifiers.str, prop.name ); + + if ( prop.setter != null ) + this.write_property_accessor ( prop.setter, file ); + + + file.printf ( " " ); + + if ( prop.getter != null ) + this.write_property_accessor ( prop.getter, file ); + + file.printf ( " }" ); + } + + public override void write_signal ( Valadoc.Signal sig, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + this.position = sig; + + this.write_accessor ( sig, file ); + + file.printf ( " signal ", css_keyword ); + this.write_type_reference ( sig.return_type, file ); + file.printf ( " %s ", sig.name ); + this.write_parameter_list ( sig, file ); + } + + public override void write_enum_value ( Valadoc.EnumValue enval, void* ptr ) { + } + + public override void write_error_code ( Valadoc.ErrorCode errcode, void* ptr ) { + } + + public override void write_delegate ( Valadoc.Delegate del, void* ptr ) { + GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); + weak GLib.FileStream file = (GLib.FileStream)ptr; + this.position = del; + + this.write_accessor ( del, file ); + + file.printf ( " delegate ", css_keyword ); + this.write_type_reference ( del.return_type, file ); + file.printf ( " %s ", del.name ); + this.write_parameter_list ( del, file ); + this.write_exception_list ( del, file ); + } + + public override void write_enum ( Valadoc.Enum en, void* ptr ) { + } + + public override void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr ) { + } + + private void write_accessor ( Valadoc.SymbolAccessibility element, GLib.FileStream file ) { + if ( element.is_public ) + file.printf ( "public ", css_keyword ); + else if ( element.is_protected ) + file.printf ( "protected ", css_keyword ); + else if ( element.is_private ) + file.printf ( "private ", css_keyword ); + } + + + public override void write_struct ( Valadoc.Struct stru, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + this.position = stru; + + this.write_accessor ( stru, file ); + file.printf ( "struct %s", css_keyword, stru.name ); + this.write_template_parameters ( stru, ptr ); + this.write_inheritance_list ( stru, file ); + } + + private void write_inheritance_list ( Valadoc.ContainerDataType dtype, GLib.FileStream file ) { + Gee.Collection lst = dtype.get_parent_types ( ); + int size = lst.size; + int i = 1; + + if ( size == 0 ) + return ; + + file.puts ( " : " ); + + foreach ( DataType cntype in lst ) { + this.write_type_name ( cntype, file ); + if ( size > i ) + file.puts ( ", " ); + + i++; + } + + file.putc ( ' ' ); + } + + public override void write_class ( Valadoc.Class cl, void* ptr ) { + GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); + weak GLib.FileStream file = (GLib.FileStream)ptr; + this.position = cl; + + this.write_accessor ( cl, file ); + + if ( cl.is_abstract ) + modifiers.append ( "abstract " ); + else if ( cl.is_static ) + modifiers.append ( "static " ); + + file.printf ( "%s class %s", css_keyword, modifiers.str, cl.name ); + + this.write_template_parameters ( cl, file ); + this.write_inheritance_list ( cl, file ); + } + + public override void write_interface ( Valadoc.Interface iface, void* ptr ) { + weak GLib.FileStream file = (GLib.FileStream)ptr; + this.position = iface; + + this.write_accessor ( iface, file ); + + if ( iface.is_static ) + file.printf ( "static interface %s", css_keyword, iface.name ); + else + file.printf ( "interface %s", css_keyword, iface.name ); + + this.write_template_parameters ( iface, ptr ); + this.write_inheritance_list ( iface, file ); + } + + public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) { + } + + public override void write_file ( Valadoc.Package file, void* ptr ) { + } +} + + + + + + + + + + + + +public abstract class Valadoc.BasicHtmlDoclet : Valadoc.Doclet { + protected Valadoc.Langlet langlet; + + protected abstract string get_link ( Valadoc.Basic p1, Valadoc.Basic p2 ); + + + // Navi: + protected void write_navi_entry_html_template ( GLib.FileStream file, string style, string content ) { + file.printf ( "\t
  • %s
  • \n", style, content ); + } + + protected void write_navi_entry_html_template_with_link ( GLib.FileStream file, string style, string link, string content ) { + file.printf ( "\t
  • %s
  • \n", style, css_navi_link, link, content ); + } + + protected void write_navi_entry ( GLib.FileStream file, Basic element, Basic pos, string style, bool link, bool full_name = false ) { + string name; + + if ( element is Class ) { + if ( ((Class)element).is_abstract ) + name = "" + element.name + ""; + else + name = element.name; + } + else if ( element is Package ) { + name = element.file.name; + } + else if ( full_name == true && element is Namespace ) { + string tmp = element.full_name(); + name = (tmp == null)? "Global Namespace" : tmp; + } + else { + string tmp = element.name; + name = (tmp == null)? "Global Namespace" : tmp; + } + + if ( link == true ) + this.write_navi_entry_html_template_with_link ( file, style, this.get_link (element, pos), name ); + else + this.write_navi_entry_html_template ( file, style, name ); + } + + protected void write_navi_top_entry ( GLib.FileStream file, Basic element, Basic mself ) { + string name = (element.name == null)? "Global Namespace" : element.name; + string style = null; + + if ( element is Namespace ) + style = css_navi_namespace; + else if ( element is Enum ) + style = css_navi_enum; + else if ( element is ErrorDomain ) + style = css_navi_error_domain; + else if ( element is Struct ) + style = css_navi_struct; + else if ( element is Class ) + style = css_navi_class; + else if ( element is Interface ) + style = css_navi_iface; + else if ( element is Package ) { + name = element.file.name; + style = css_navi_package; + } + + file.printf ( "
      \n", css_navi ); + + if ( element == mself ) + this.write_navi_entry ( file, element, mself, style, false ); + else + this.write_navi_entry ( file, element, mself, style, true ); + + file.puts ( "
    \n" ); + file.printf ( "\n
    \n", css_navi_hr ); + } + + protected void write_top_element_template ( GLib.FileStream file, string link ) { + file.printf ( "\n
    \n", css_navi, css_navi_package_index, css_navi_link, link, css_navi_hr ); + } + + protected abstract void write_top_element ( GLib.FileStream file, Basic pos ); + + protected void write_top_elements ( GLib.FileStream file, Basic element, Basic? mself ) { + Gee.ArrayList lst = new Gee.ArrayList (); + Basic pos = element; + + if ( mself == null ) + mself = element; + + string package_name = element.file.name; + + this.write_top_element ( file, mself ); + + while ( pos != null ) { + lst.add ( pos ); + pos = pos.parent; + } + + for ( int i = lst.size-1; i >= 0 ; i-- ) { + Basic el = lst.get ( i ); + this.write_navi_top_entry ( file, el, mself ); + } + } + + protected void fetch_subnamespace_names ( NamespaceHandler pos, Gee.ArrayList lst ) { + Gee.ReadOnlyCollection nspaces = pos.get_namespace_list (); + + foreach ( Namespace ns in nspaces ) { + lst.add ( ns ); + this.fetch_subnamespace_names ( ns, lst ); + } + } + + protected void write_navi_file ( GLib.FileStream file, Package efile ) { + Gee.ArrayList ns_list = new Gee.ArrayList (); + this.fetch_subnamespace_names (efile, ns_list ); + + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_element_template ( file, "../index.html" ); + file.printf ( "\t\t\t\t
      \n", css_navi ); + + foreach ( Namespace ns in ns_list ) { + this.write_navi_entry ( file, ns, efile, css_navi_namespace, true, true ); + } + + file.puts ( "\t\t\t\t
    \n" ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself ) { + file.printf ( "
      \n", css_navi ); + this.write_navi_child_namespaces_without_childs ( file, ns, mself ); + this.write_navi_child_classes_without_childs ( file, ns, mself ); + this.write_navi_child_interfaces_without_childs ( file, ns, mself ); + this.write_navi_child_structs_without_childs ( file, ns, mself ); + this.write_navi_child_enums_without_childs ( file, ns, mself ); + this.write_navi_child_error_domains_without_childs ( file, ns, mself ); + this.write_navi_child_delegates ( file, ns, mself ); + this.write_navi_child_methods ( file, ns, mself ); + this.write_navi_child_fields ( file, ns, mself ); + this.write_navi_child_constants ( file, ns, mself ); + file.puts ( "
    \n" ); + } + + protected void write_navi_child_namespaces ( GLib.FileStream file, Namespace ns, Basic mself ) { + this.write_top_elements ( file, ns, mself ); + this.write_navi_child_namespaces_inline ( file, ns, mself ); + } + + protected void write_navi_struct_inline ( GLib.FileStream file, Struct stru, Basic mself ) { + file.printf ( "
      \n", css_navi ); + this.write_navi_child_construction_methods ( file, stru, mself ); + this.write_navi_child_methods ( file, stru, mself ); + this.write_navi_child_fields ( file, stru, mself ); + this.write_navi_child_constants ( file, stru, mself ); + file.puts ( "
    \n" ); + } + + protected void write_navi_struct ( GLib.FileStream file, Struct stru, Basic mself ) { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, stru, mself ); + this.write_navi_struct_inline ( file, stru, mself ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_interface_inline ( GLib.FileStream file, Interface iface, Basic mself ) { + file.printf ( "
      \n", css_navi ); + this.write_navi_child_delegates ( file, iface, mself ); + this.write_navi_child_methods ( file, iface, mself ); + this.write_navi_child_signals ( file, iface, mself ); + this.write_navi_child_properties ( file, iface, mself ); + this.write_navi_child_fields ( file, iface, mself ); + file.puts ( "
    \n" ); + } + + protected void write_navi_interface ( GLib.FileStream file, Interface iface, Basic mself ) { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, iface, mself ); + this.write_navi_interface_inline ( file, iface, mself ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_enum_inline ( GLib.FileStream file, Enum en, Basic mself ) { + Gee.ReadOnlyCollection enum_values = en.get_enum_values ( ); + file.printf ( "
      \n", css_navi ); + + foreach ( EnumValue env in enum_values ) { + this.write_navi_entry ( file, env, en, css_navi_enval, true ); // en => mself + } + + this.write_navi_child_methods ( file, en, mself ); + file.puts ( "
    \n" ); + } + + protected void write_navi_enum ( GLib.FileStream file, Enum en, Basic mself ) { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, en, mself ); + this.write_navi_enum_inline ( file, en, mself ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_error_domain_inline ( GLib.FileStream file, ErrorDomain errdom, Basic mself = null ) { + Gee.ReadOnlyCollection error_codes = errdom.get_error_code_list ( ); + file.printf ( "
      \n", css_navi ); + + foreach ( ErrorCode ec in error_codes ) { + this.write_navi_entry ( file, ec, errdom, css_navi_errdomcode, true ); // errdom => mself + } + + this.write_navi_child_methods ( file, errdom, mself ); + file.puts ( "
    \n" ); + } + + protected void write_navi_namespace ( GLib.FileStream file, Namespace ns ) { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, ns, ns ); + this.write_navi_child_namespaces_inline ( file, ns, ns ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_error_domain ( GLib.FileStream file, ErrorDomain errdom, Basic mself ) { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, errdom, mself ); + this.write_navi_error_domain_inline ( file, errdom, mself ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_class_inline ( GLib.FileStream file, Class cl, Basic mself ) { + file.printf ( "
      \n", css_navi ); + this.write_navi_child_construction_methods ( file, cl, mself ); + this.write_navi_child_classes_without_childs ( file, cl, mself ); + this.write_navi_child_structs_without_childs ( file, cl, mself ); + this.write_navi_child_enums_without_childs ( file, cl, mself ); + this.write_navi_child_delegates ( file, cl, mself ); + this.write_navi_child_methods ( file, cl, mself ); + this.write_navi_child_signals ( file, cl, mself ); + this.write_navi_child_properties ( file, cl, mself ); + this.write_navi_child_fields ( file, cl, mself ); + this.write_navi_child_constants ( file, cl, mself ); + file.puts ( "
    \n" ); + } + + protected void write_navi_class ( GLib.FileStream file, Class cl, Basic mself ) { + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, cl, mself ); + this.write_navi_class_inline ( file, cl, mself ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_method ( GLib.FileStream file, Method m ) { + Basic parent = m.parent; + + file.printf ( "\t\t\t
    \n", css_style_navigation ); + + this.write_top_elements ( file, parent, m ); + + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, m ); + else if ( m.parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, m ); + else if ( m.parent is Struct ) + this.write_navi_struct_inline ( file, (Struct)parent, m ); + else if ( m.parent is Enum ) + this.write_navi_enum_inline ( file, (Enum)parent, m ); + else if ( m.parent is ErrorDomain ) + this.write_navi_error_domain_inline ( file, (ErrorDomain)parent, m ); + else if ( m.parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, m ); + + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_property ( GLib.FileStream file, Property prop ) { + Basic parent = prop.parent; + + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, prop.parent, prop ); + + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, prop ); + else if ( parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, prop ); + + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_signal ( GLib.FileStream file, Signal sig ) { + Basic parent = sig.parent; + + file.printf ( "\t\t\t
    \n", css_style_navigation ); + + this.write_top_elements ( file, sig.parent, sig ); + + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, sig ); + else if ( parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, sig ); + + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_constant ( GLib.FileStream file, Constant c ) { + Basic parent = c.parent; + + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, parent, c ); + + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, c ); + else if ( parent is Struct ) + this.write_navi_struct_inline ( file, (Struct)parent, c ); + else if ( parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, c ); + //else if ( parent is Interface ) + // this.write_navi_interface_inline ( file, (Interface)parent, c ); + + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_field ( GLib.FileStream file, Field f ) { + Basic parent = f.parent; + + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, parent, f ); + + if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, f ); + else if ( parent is Struct ) + this.write_navi_struct_inline ( file, (Struct)parent, f ); + else if ( parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, f ); + else if ( parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, f ); + + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_delegate ( GLib.FileStream file, Delegate del ) { + Basic parent = del.parent; + + file.printf ( "\t\t\t
    \n", css_style_navigation ); + this.write_top_elements ( file, parent, del ); + + if ( parent is Namespace ) + this.write_navi_child_namespaces_inline ( file, (Namespace)parent, del ); + else if ( parent is Class ) + this.write_navi_class_inline ( file, (Class)parent, del ); + else if ( parent is Interface ) + this.write_navi_interface_inline ( file, (Interface)parent, del ); + + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_navi_child_methods_collection ( GLib.FileStream file, Gee.Collection methods, Basic mself ) { + foreach ( Method m in methods ) { + if ( m == mself ) + this.write_navi_entry ( file, m, mself, css_navi_construction_method, false ); + else + this.write_navi_entry ( file, m, mself, css_navi_construction_method, true ); + } + } + + protected void write_navi_child_methods ( GLib.FileStream file, MethodHandler mh, Basic mself ) { + Gee.ReadOnlyCollection methods = mh.get_method_list ( ); + this.write_navi_child_methods_collection ( file, methods, mself ); + } + + protected void write_navi_child_classes_without_childs_collection ( GLib.FileStream file, Gee.Collection classes, Basic mself ) { + foreach ( Class cl in classes ) { + if ( cl == mself ) + this.write_navi_entry ( file, cl, mself, css_navi_class, false ); + else + this.write_navi_entry ( file, cl, mself, css_navi_class, true ); + } + } + + protected void write_navi_child_classes_without_childs ( GLib.FileStream file, ClassHandler clh, Basic mself ) { + Gee.ReadOnlyCollection classes = clh.get_class_list ( ); + this.write_navi_child_classes_without_childs_collection ( file, classes, mself ); + } + + protected void write_navi_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh, Basic mself ) { + Gee.ReadOnlyCollection methods = cmh.get_construction_method_list ( ); + this.write_navi_child_methods_collection ( file, methods, mself ); + } + + protected void write_navi_child_signals ( GLib.FileStream file, SignalHandler sh, Basic mself ) { + Gee.ReadOnlyCollection signals = sh.get_signal_list ( ); + + foreach ( Signal sig in signals ) { + if ( sig == mself ) + this.write_navi_entry ( file, sig, mself, css_navi_sig, false ); + else + this.write_navi_entry ( file, sig, mself, css_navi_sig, true ); + } + } + + protected void write_navi_child_properties ( GLib.FileStream file, PropertyHandler ph, Basic mself ) { + Gee.ReadOnlyCollection properties = ph.get_property_list ( ); + + foreach ( Property p in properties ) { + if ( p == mself ) + this.write_navi_entry ( file, p, mself, css_navi_prop, false ); + else + this.write_navi_entry ( file, p, mself, css_navi_prop, true ); + } + } + + protected void write_navi_child_fields_collection ( GLib.FileStream file, Gee.Collection fields, Basic mself ) { + foreach ( Field f in fields ) { + if ( f == mself ) + this.write_navi_entry ( file, f, mself, css_navi_field, false ); + else + this.write_navi_entry ( file, f, mself, css_navi_field, true ); + } + } + + protected void write_navi_child_fields ( GLib.FileStream file, FieldHandler fh, Basic mself ) { + Gee.ReadOnlyCollection fields = fh.get_field_list ( ); + this.write_navi_child_fields_collection ( file, fields, mself ); + } + + protected void write_navi_child_constants_collection ( GLib.FileStream file, Gee.Collection constants, Basic mself ) { + foreach ( Constant c in constants ) { + if ( c == mself ) + this.write_navi_entry ( file, c, mself, css_navi_constant, false ); + else + this.write_navi_entry ( file, c, mself, css_navi_constant, true ); + } + } + + protected void write_navi_child_constants ( GLib.FileStream file, ConstantHandler ch, Basic mself ) { + Gee.ReadOnlyCollection constants = ch.get_constant_list ( ); + this.write_navi_child_constants_collection ( file, constants, mself ); + } + + protected void write_navi_child_structs_without_childs_collection ( GLib.FileStream file, Gee.Collection structs, Basic mself ) { + foreach ( Struct stru in structs ) { + if ( stru == mself ) + this.write_navi_entry ( file, stru, mself, css_navi_struct, false ); + else + this.write_navi_entry ( file, stru, mself, css_navi_struct, true ); + } + } + + protected void write_navi_child_structs_without_childs ( GLib.FileStream file, StructHandler strh, Basic mself ) { + Gee.Collection structs = strh.get_struct_list ( ); + this.write_navi_child_structs_without_childs_collection ( file, structs, mself ); + } + + protected void write_navi_child_delegates_collection ( GLib.FileStream file, Gee.Collection delegates, Basic mself ) { + foreach ( Delegate del in delegates ) { + if ( del == mself ) + this.write_navi_entry ( file, del, mself, css_navi_del, false ); + else + this.write_navi_entry ( file, del, mself, css_navi_del, true ); + } + } + + protected void write_navi_child_delegates ( GLib.FileStream file, DelegateHandler delh, Basic mself ) { + Gee.Collection delegates = delh.get_delegate_list ( ); + this.write_navi_child_delegates_collection ( file, delegates, mself ); + } + + protected void write_navi_child_interfaces_without_childs_collection ( GLib.FileStream file, Gee.Collection interfaces, Basic mself ) { + foreach ( Interface iface in interfaces ) { + if ( iface == mself ) + this.write_navi_entry ( file, iface, mself, css_navi_iface, false ); + else + this.write_navi_entry ( file, iface, mself, css_navi_iface, true ); + } + } + + protected void write_navi_child_interfaces_without_childs ( GLib.FileStream file, Namespace ifh, Basic mself ) { + Gee.Collection interfaces = ifh.get_interface_list ( ); + this.write_navi_child_interfaces_without_childs_collection ( file, interfaces, mself ); + } + + protected void write_navi_child_enums_without_childs_collection ( GLib.FileStream file, Gee.Collection enums, Basic mself ) { + foreach ( Enum en in enums ) { + if ( en == mself ) + this.write_navi_entry ( file, en, mself, css_navi_enum, false ); + else + this.write_navi_entry ( file, en, mself, css_navi_enum, true ); + } + } + + protected void write_navi_child_enums_without_childs ( GLib.FileStream file, EnumHandler eh, Basic mself ) { + Gee.Collection enums = eh.get_enum_list ( ); + this.write_navi_child_enums_without_childs_collection ( file, enums, mself ); + } + + protected void write_navi_child_error_domains_without_childs_collection ( GLib.FileStream file, Gee.Collection errordomains, Basic mself ) { + foreach ( ErrorDomain errdom in errordomains ) { + if ( errdom == mself ) + this.write_navi_entry ( file, errdom, mself, css_navi_error_domain, false ); + else + this.write_navi_entry ( file, errdom, mself, css_navi_error_domain, true ); + } + } + + protected void write_navi_child_error_domains_without_childs ( GLib.FileStream file, Namespace errdomh, Basic mself ) { + Gee.Collection errordomains = errdomh.get_error_domain_list ( ); + this.write_navi_child_error_domains_without_childs_collection ( file, errordomains, mself ); + } + + protected void write_navi_child_namespaces_without_childs ( GLib.FileStream file, NamespaceHandler nsh, Basic mself ) { + Gee.ReadOnlyCollection namespaces = nsh.get_namespace_list ( ); + foreach ( Namespace ns in namespaces ) { + if ( ns == mself ) + this.write_navi_entry ( file, ns, mself, css_navi_namespace, false ); + else + this.write_navi_entry ( file, ns, mself, css_navi_namespace, true ); + } + } + + +//////////////// + + + protected void write_package_note ( GLib.FileStream file, Basic element ) { + string package = element.package; + if ( package == null ) + return ; + + file.printf ( "\n\n
    \nPackage: %s\n\n", package ); + } + + protected void write_namespace_note ( GLib.FileStream file, Basic element ) { + for ( ; element is Namespace == false; element = element.parent ) + ; + + if ( element.parent == null ) + return ; + + if ( element.name == null ) + return ; + + file.printf ( "\n\n
    \nNamespace: %s\n\n", element.full_name() ); + } + + + public void write_method_content ( GLib.FileStream file, Method m , Valadoc.MethodHandler parent ) { + string full_name = m.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + + this.langlet.write_method ( file, m, parent ); + + file.printf ( "\n\t\t\t\t
    \n" ); + m.write_comment ( file ); + + if ( m.parent is Namespace ) { + this.write_namespace_note ( file, m ); + this.write_package_note ( file, m ); + } + + file.puts ( "\t\t\t
    \n" ); + } + + public void write_child_error_values ( GLib.FileStream file, ErrorDomain errdom ) { + Gee.ReadOnlyCollection error_codes = errdom.get_error_code_list (); + if ( error_codes.size > 0 ) { + file.printf ( "

    Error Codes:

    \n", css_title ); + file.printf ( "\n", css_errordomain_table ); + foreach ( ErrorCode errcode in error_codes ) { + file.puts ( "\n" ); + file.printf ( "\t\n", css_errordomain_table_name, errcode.name, errcode.name ); + file.printf ( "\t\n" ); + file.puts ( "\n" ); + } + file.puts ( "
    %s\n", css_errordomain_table_text ); + + errcode.write_comment ( file ); + + file.puts ( "\t
    \n" ); + } + } + + public void write_signal_content ( GLib.FileStream file, Signal sig ) { + string full_name = sig.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_signal ( sig, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + sig.write_comment ( file ); + file.puts ( "\t\t\t
    \n" ); + } + + public void write_delegate_content ( GLib.FileStream file, Delegate del ) { + string full_name = del.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_delegate ( del, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + del.write_comment ( file ); + + if ( del.parent is Namespace ) { + this.write_namespace_note ( file, del ); + this.write_package_note ( file, del ); + } + + file.puts ( "\t\t\t
    \n" ); + } + + public void write_field_content ( GLib.FileStream file, Field field, FieldHandler parent ) { + string full_name = field.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_field ( field, parent, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + field.write_comment ( file ); + + if ( field.parent is Namespace ) { + this.write_namespace_note ( file, field ); + this.write_package_note ( file, field ); + } + + file.puts ( "\t\t\t
    \n" ); + } + + public void write_constant_content ( GLib.FileStream file, Constant constant, ConstantHandler parent ) { + string full_name = constant.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_constant ( constant, parent, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + constant.write_comment ( file ); + + if ( constant.parent is Namespace ) { + this.write_namespace_note ( file, constant ); + this.write_package_note ( file, constant ); + } + + file.puts ( "\t\t\t
    \n" ); + } + + public void write_property_content ( GLib.FileStream file, Property prop ) { + string full_name = prop.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_property ( prop, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + prop.write_comment ( file ); + file.puts ( "\t\t\t
    \n" ); + } + + public void write_enum_content ( GLib.FileStream file, Enum en ) { + string full_name = en.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + en.write_comment ( file ); + + if ( en.parent is Namespace ) { + this.write_namespace_note ( file, en ); + this.write_package_note ( file, en ); + } + + file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); + this.write_child_enum_values ( file, en ); + this.write_child_methods ( file, en ); + file.puts ( "\t\t\t
    \n" ); + } + + private void write_child_enum_values ( GLib.FileStream file, Enum en ) { + Gee.ReadOnlyCollection enum_values = en.get_enum_values (); + if ( enum_values.size > 0 ) { + file.printf ( "

    Enum Values:

    \n", css_title ); + file.printf ( "\n", css_enum_table ); + foreach ( EnumValue enval in enum_values ) { + file.puts ( "\n" ); + file.printf ( "\t\n", css_enum_table_name, enval.name, enval.name ); + file.printf ( "\t\n" ); + file.puts ( "\n" ); + } + file.puts ( "
    %s\n", css_enum_table_text ); + + enval.write_comment ( file ); + + file.puts ( "\t
    \n" ); + } + } + + protected void write_child_methods ( GLib.FileStream file, MethodHandler mh ) { + Gee.ReadOnlyCollection methods = mh.get_method_list (); + if ( methods.size > 0 ) { + file.printf ( "

    Methods:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Method m in methods ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m, mh), m.name ); + } + file.puts ( "
    \n" ); + } + } + + public void write_class_content ( GLib.FileStream file, Class cl ) { + string full_name = cl.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + this.write_image_block ( file, cl ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_class ( cl, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + cl.write_comment ( file ); + if ( cl.parent is Namespace ) { + this.write_namespace_note ( file, cl ); + this.write_package_note ( file, cl ); + } + file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); + this.write_child_construction_methods ( file, cl ); + this.write_child_classes ( file, cl ); + this.write_child_structs ( file, cl ); + this.write_child_enums ( file, cl ); + this.write_child_delegates ( file, cl ); + this.write_child_methods ( file, cl ); + this.write_child_signals ( file, cl ); + this.write_child_properties ( file, cl ); + this.write_child_fields ( file, cl ); + this.write_child_constants ( file, cl ); + file.puts ( "\t\t\t
    \n" ); + } + + public void write_interface_content ( GLib.FileStream file, Interface iface ) { + string full_name = iface.full_name (); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + this.write_image_block ( file, iface ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_interface ( iface, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + iface.write_comment ( file ); + if ( iface.parent is Namespace ) { + this.write_namespace_note ( file, iface ); + this.write_package_note ( file, iface ); + } + file.printf ( "\t\t\t\t

    Content:

    \n", css_title ); + this.write_child_classes ( file, iface ); + this.write_child_structs ( file, iface ); + this.write_child_delegates ( file, iface ); + this.write_child_methods ( file, iface ); + this.write_child_signals ( file, iface ); + this.write_child_properties ( file, iface ); + this.write_child_fields ( file, iface ); + file.puts ( "\t\t\t
    \n" ); + } + + public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom ) { + string full_name = errdom.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + errdom.write_comment ( file ); + if ( errdom.parent is Namespace ) { + this.write_namespace_note ( file, errdom ); + this.write_package_note ( file, errdom ); + } + file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); + this.write_child_error_values ( file, errdom ); + this.write_child_methods ( file, errdom ); + file.puts ( "\t\t\t
    \n" ); + } + + public void write_struct_content ( GLib.FileStream file, Struct stru ) { + string full_name = stru.full_name ( ); + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, full_name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + this.write_image_block ( file, stru ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + stru.write_comment ( file ); + if ( stru.parent is Namespace ) { + this.write_namespace_note ( file, stru ); + this.write_package_note ( file, stru ); + } + file.printf ( "\n\t\t\t\t

    Content:

    \n", css_title ); + file.printf ( "\t\t\t\t
    \n\t", css_code_definition ); + this.langlet.write_struct ( stru, file ); + file.printf ( "\n\t\t\t\t
    \n" ); + this.write_child_construction_methods ( file, stru ); + this.write_child_methods ( file, stru ); + this.write_child_fields ( file, stru ); + this.write_child_constants ( file, stru ); + file.puts ( "\t\t\t
    \n" ); + } + + + protected abstract string get_img_real_path ( Basic element ); + + protected abstract string get_img_path ( Basic element ); + + + protected void write_child_constants ( GLib.FileStream file, ConstantHandler ch ) { + Gee.ReadOnlyCollection constants = ch.get_constant_list (); + if ( constants.size > 0 ) { + file.printf ( "

    Constants:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Constant c in constants ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_constant, css_navi_link, this.get_link(c, ch), c.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_enums ( GLib.FileStream file, EnumHandler eh ) { + Gee.Collection enums = eh.get_enum_list (); + if ( enums.size > 0 ) { + file.printf ( "

    Enums:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Enum en in enums ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_enum, css_navi_link, this.get_link(en, eh), en.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh ) { + Gee.ReadOnlyCollection methods = cmh.get_construction_method_list (); + if ( methods.size > 0 ) { + file.printf ( "

    Construction Methods:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Method m in methods ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m, cmh), m.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_image_block ( GLib.FileStream file, DataType element ) { + string realimgpath = this.get_img_real_path ( element ); + string imgpath = this.get_img_path ( element ); + + if ( element is Class ) { + Diagrams.write_class_diagram ( (Class)element, realimgpath ); + } + else if ( element is Interface ) { + Diagrams.write_interface_diagram ( (Interface)element, realimgpath ); + } + else if ( element is Struct ) { + Diagrams.write_struct_diagram ( (Struct)element, realimgpath ); + } + + file.printf ( "

    Object Hierarchy:

    \n", css_title ); + file.printf ( "\n", css_diagram, imgpath ); + } + + protected void write_child_fields ( GLib.FileStream file, FieldHandler fh ) { + Gee.ReadOnlyCollection fields = fh.get_field_list (); + if ( fields.size > 0 ) { + file.printf ( "

    Fields:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Field f in fields ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_fields, css_navi_link, this.get_link(f, fh), f.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_properties ( GLib.FileStream file, PropertyHandler ph ) { + Gee.ReadOnlyCollection properties = ph.get_property_list (); + if ( properties.size > 0 ) { + file.printf ( "

    Properties:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Property prop in properties ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_property, css_navi_link, this.get_link(prop, ph), prop.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_signals ( GLib.FileStream file, SignalHandler sh ) { + Gee.ReadOnlyCollection signals = sh.get_signal_list (); + if ( signals.size > 0 ) { + file.printf ( "

    Signals:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Signal sig in signals ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_signal, css_navi_link, this.get_link(sig, sh), sig.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_classes ( GLib.FileStream file, ClassHandler clh ) { + Gee.ReadOnlyCollection classes = clh.get_class_list (); + if ( classes.size > 0 ) { + file.printf ( "

    Classes:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Class subcl in classes ) { + string name; + if ( subcl.is_abstract ) { + name = "" + subcl.name + ""; + } + else { + name = subcl.name; + } + + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_class, css_navi_link, this.get_link(subcl, clh), name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_delegates ( GLib.FileStream file, DelegateHandler dh ) { + Gee.Collection delegates = dh.get_delegate_list (); + if ( delegates.size > 0 ) { + file.printf ( "

    Delegates:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Delegate d in delegates ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_delegate, css_navi_link, this.get_link(d, dh), d.name ); + } + file.puts ( "
    \n" ); + } + } + + protected void write_child_structs ( GLib.FileStream file, StructHandler struh ) { + Gee.Collection structs = struh.get_struct_list (); + if ( structs.size > 0 ) { + file.printf ( "

    Structs:

    \n", css_title ); + file.printf ( "
      \n", css_inline_navigation ); + foreach ( Struct stru in structs ) { + file.printf ( "\t
    • %s
    • \n", css_inline_navigation_struct, css_navi_link, this.get_link(stru, struh), stru.name ); + } + file.puts ( "
    \n" ); + } + } + + public void write_namespace_content ( GLib.FileStream file, Namespace ns ) { + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name () ); + file.printf ( "\t\t\t\t
    \n", css_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + ns.write_comment ( file ); + file.puts ( "\t\t\t
    \n" ); + } + + protected void write_file_content ( GLib.FileStream file, Package f ) { + file.printf ( "\t\t\t
    \n", css_style_content ); + file.printf ( "\t\t\t\t

    %s:

    \n", css_title, f.name ); + file.printf ( "\t\t\t\t
    \n", css_headline_hr ); + file.printf ( "\t\t\t\t

    Description:

    \n", css_title ); + file.puts ( "\t\t\t
    \n" ); + } + + + protected void write_file_header ( GLib.FileStream file, string css, string title ) { + file.puts ( "\n" ); + file.puts ( "\t\n" ); + file.puts ( "\t\tVala Binding Reference\n" ); + file.printf ( "\t\t\n", css ); + file.puts ( "\t\n" ); + file.puts ( "\t\n\n" ); + + file.printf ( "\t
    \n", css_site_header ); + file.printf ( "\t\t%s Reference Manual\n", title ); + file.puts ( "\t
    \n\n" ); + + file.printf ( "\t\t
    \n", css_style_body ); + } + + protected void write_file_footer ( GLib.FileStream file ) { + file.puts ( "\t
    \n" ); + + file.puts ( "\t
    \n" ); + file.puts ( "\t\t
    \n" ); + file.puts ( "\t\t
    \n" ); + file.puts ( "\t\t\tcreated by valadoc\n" ); + file.puts ( "\t\t
    \n" ); + file.puts ( "\t
    \n" ); + file.puts ( "\t\n" ); + file.puts ( "" ); + } +} + diff --git a/src/doclets/valadoc.org/doclet/Makefile.am b/src/doclets/valadoc.org/doclet/Makefile.am index a46cbc9e0..b0758797b 100644 --- a/src/doclets/valadoc.org/doclet/Makefile.am +++ b/src/doclets/valadoc.org/doclet/Makefile.am @@ -12,7 +12,7 @@ BUILT_SOURCES = libdoclet.vala.stamp libdoclet.vala.stamp: $(libdoclet_VALASOURCES) - $(VALAC) -C --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../vapi --pkg valadoc-1.0 --vapidir ../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -33,6 +33,7 @@ libdoclet_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../libvaladoc/ \ + -I ../../htmlhelpers/ \ -I ../linkhelper/ \ -I ../ \ $(GLIB_CFLAGS) \ @@ -43,11 +44,12 @@ AM_CFLAGS = -g \ libdoclet_la_LDFLAGS = -module -avoid-version -libdoclet_la_LIBADD = \ - ../../../libvaladoc/libvaladoc.la \ - ../linkhelper/libhtmlhelper.la \ - $(GLIB_LIBS) \ - $(LIBVALA_LIBS) \ +libdoclet_la_LIBADD = \ + ../../htmlhelpers/libhtmlhelpers.la \ + ../../../libvaladoc/libvaladoc.la \ + ../linkhelper/libhtmlhelper.la \ + $(GLIB_LIBS) \ + $(LIBVALA_LIBS) \ $(NULL) diff --git a/src/doclets/valadoc.org/doclet/template.vala b/src/doclets/valadoc.org/doclet/template.vala index e2de2f034..277eaae36 100644 --- a/src/doclets/valadoc.org/doclet/template.vala +++ b/src/doclets/valadoc.org/doclet/template.vala @@ -24,469 +24,13 @@ using Gee; - - -public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper { - public Valadoc.Settings settings { - construct set; - protected get; +public class Valadoc.LangletIndex : Valadoc.BasicHtmlLanglet, Valadoc.LinkHelper { + protected override string get_link ( Basic element, Basic pos ) { + return this.get_html_link ( this.settings, element ); } public LangletIndex ( Settings settings ) { - this.settings = settings; - } - - private Basic position = null; - - private inline bool is_basic_type ( string name ) { - string[] basic_types = new string[] { "bool", "char", "uchar", "int", "uint", "short", "ushort", - "long", "ulong", "size_t", "ssize_t", "int8", "uint8", "int16", "uint16", "int32", - "uint32", "int64", "uint64", "float", "double", "time_t", "unichar", "string" - }; - - foreach ( string str in basic_types ) { - if ( str == name ) - return true; - } - - return false; - } - - private void write_type_name ( DataType? datatype, GLib.FileStream file ) { - if ( datatype == null ) { - file.printf ( "void", css_keyword ); - return ; - } - - string typename = datatype.full_name (); - if ( datatype.parent.name == null && (datatype is Class || datatype is Struct) ) { - if ( this.is_basic_type ( typename ) ) { - string link = this.get_link( datatype ); - if ( link == null ) - file.printf ( "%s", css_basic_type, typename ); - else - file.printf ( "%s", css_basic_type, link, typename ); - return ; - } - } - - string link = this.get_link( datatype ); - if ( link == null ) - file.printf ( "%s", css_other_type, typename ); - else - file.printf ( "%s", css_other_type, link, typename ); - } - - private void write_type_reference_name ( TypeReference type_reference, GLib.FileStream file ) { - if ( type_reference.type_name == "void" ) { - file.printf ( "void", css_keyword ); - } - else { - if ( type_reference.data_type == null ) { - file.printf ( "%s", css_other_type, type_reference.type_name ); - } - else { - this.write_type_name ( type_reference.data_type, file ); - } - } - } - - private void write_type_reference_template_arguments ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { - Gee.Collection arglst = type_reference.get_type_arguments ( ); - int size = arglst.size; - if ( size == 0 ) - return ; - - file.puts ( "<" ); - int i = 0; - - foreach ( TypeReference arg in arglst ) { - i++; - - this.write_nested_type_referene ( arg, file ); - if ( i != size ) - file.puts ( ", " ); - } - - file.puts ( ">" ); - } - - private void write_nested_type_referene ( Valadoc.TypeReference type_reference, GLib.FileStream file ) { - if ( type_reference.type_name == null ) - return ; - - if ( type_reference.is_weak ) - file.printf ( "weak ", css_keyword ); - - this.write_type_reference_name ( type_reference, file ); - this.write_type_reference_template_arguments ( type_reference, file ); - - if ( type_reference.is_array ) { - string str = string.nfill ( type_reference.array_rank-1, ','); - file.printf ( "[%s]", str ); - } - - if ( type_reference.pass_ownership ) { - file.putc ( '#' ); - } - - if ( type_reference.is_nullable ) { - file.putc ( '?' ); - } - - string str = string.nfill ( type_reference.pointer_rank, '*' ); - file.puts ( str ); - - } - - public override void write_type_reference ( Valadoc.TypeReference type_reference, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - - if ( type_reference == null ) - return ; - - this.write_nested_type_referene ( type_reference, file ); - file.putc ( ' ' ); - - /* - if ( type_reference.is_weak ) { - file.printf ( "weak ", css_keyword ); - } - - this.write_type_name ( type_reference.data_type, file ); - - if ( type_reference.is_array ) { - string str = string.nfill ( type_reference.array_rank-1, ','); - file.printf ( "[%s]", str ); - } - - if ( type_reference.pass_ownership ) { - file.putc ( '#' ); - } - - if ( type_reference.is_nullable ) { - file.putc ( '?' ); - } - - string str = string.nfill ( type_reference.pointer_rank, '*' ); - file.puts ( str ); - */ - } - - private void write_formal_parameter ( FormalParameter param, GLib.FileStream file ) { - if ( param.ellipsis ) { - file.puts ( " ..." ); - } - else { - if ( param.is_out ) - file.printf ( "out ", css_keyword ); - else if ( param.is_ref ) - file.printf ( "ref ", css_keyword ); - - this.write_type_reference ( param.type_reference, file ); - file.printf ( " %s", param.name ); - } - } - - public override void write_parameter_list ( ParameterListHandler thandler, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - bool open_bracket = false; - - Gee.ArrayList params = thandler.param_list; - int size = params.size; - int i = 0; - - file.putc ( '(' ); - - foreach ( FormalParameter param in params ) { - i++; - - if ( param.default_value != null && open_bracket == false ) { - file.printf ( "[", css_optional_parameter ); - open_bracket = true; - } - - this.write_formal_parameter ( param, file ); - if ( i != size ) { - file.puts ( ", " ); - } - else if ( open_bracket == true ) { - file.puts ( "]" ); - } - } - - file.putc ( ')' ); - } - - private void write_exception_list ( ExceptionHandler exception_handler, GLib.FileStream file ) { - Gee.ReadOnlyCollection error_domains = exception_handler.get_error_domains (); - int size = error_domains.size; - int i = 1; - - if ( size == 0 ) - return ; - - file.printf ( " throws ", css_keyword ); - - foreach ( TypeReference type_reference in error_domains ) { - this.write_type_reference ( type_reference, file ); - if ( error_domains.size > i ) { - file.puts ( ", " ); - } - i++; - } - } - - public override void write_method ( void* ptr, Valadoc.Method m, Valadoc.MethodHandler parent ) { - this.position = m; - - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( m, file ); - - if ( m.is_abstract ) - modifiers.append ( " abstract" ); - if ( m.is_virtual ) - modifiers.append ( " virtual" ); - if ( m.is_override ) - modifiers.append ( " override" ); - if ( m.is_static ) - modifiers.append ( " static" ); - if ( m.is_inline ) - modifiers.append ( " inline" ); - - file.printf ( " %s ", css_keyword, modifiers.str ); - this.write_type_reference ( m.return_type, file ); - file.puts ( m.name ); - this.write_parameter_list ( m, file ); - this.write_exception_list ( m, file ); - } - - public override void write_type_parameter ( TypeParameter param, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - file.puts ( param.datatype_name ); - } - - public override void write_template_parameters ( TemplateParameterListHandler thandler, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - int i = 1; - - var lst = thandler.get_template_param_list( ); - if ( lst.size == 0 ) - return ; - - file.puts ( "<" ); // < - - - foreach ( TypeParameter param in lst ) { - param.write ( this, file ); - if ( lst.size > i ) - file.puts ( ", " ); - - i++; - } - file.puts ( ">" ); // > - } - - public override void write_field ( Valadoc.Field field, Valadoc.FieldHandler parent, void* ptr ) { - this.position = field; - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( field, file ); - - if ( field.is_volatile ) - file.printf ( " volatile", css_keyword ); - - this.write_type_reference ( field.type_reference, file ); - - file.printf ( " %s", field.name ); - } - - public override void write_constant ( Constant constant, ConstantHandler parent, void* ptr ) { - this.position = constant; - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( constant, file ); - file.printf ( " const ", css_keyword ); - this.write_type_reference ( constant.type_reference, file ); - file.printf ( " %s", constant.name ); - } - - public override void write_property_accessor ( Valadoc.PropertyAccessor propac, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - - Property prop = (Property)propac.parent; - - if ( !(prop.is_public == propac.is_public && prop.is_private == propac.is_private && prop.is_protected == propac.is_protected) ) { - // FIXME: PropertyAccessor isn't a SymbolAccessibility. (Valac-Bug.) - if ( propac.is_public ) - file.printf ( "public ", css_keyword ); - else if ( propac.is_protected ) - file.printf ( "protected ", css_keyword ); - else if ( propac.is_private ) - file.printf ( "private ", css_keyword ); - } - - - if ( propac.is_get ) { - file.printf ( " get;", css_keyword ); - } - else if ( propac.is_set ) { - if ( propac.is_construct ) { - file.printf ( " construct ", css_keyword ); - } - - file.printf ( " set;", css_keyword ); - } - } - - public override void write_property ( Valadoc.Property prop, void* ptr ) { - this.position = prop; - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - - this.write_accessor ( prop, file ); - - if ( prop.is_virtual ) - modifiers.append ( " virtual " ); - if ( prop.is_abstract ) - modifiers.append ( " abstract " ); - if ( prop.is_override ) - modifiers.append ( " override " ); - - - this.write_type_reference ( prop.return_type, file ); - file.printf ( " %s%s { ", css_keyword, modifiers.str, prop.name ); - - if ( prop.setter != null ) - this.write_property_accessor ( prop.setter, file ); - - - file.printf ( " " ); - - if ( prop.getter != null ) - this.write_property_accessor ( prop.getter, file ); - - file.printf ( " }" ); - } - - public override void write_signal ( Valadoc.Signal sig, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = sig; - - this.write_accessor ( sig, file ); - - file.printf ( " signal ", css_keyword ); - this.write_type_reference ( sig.return_type, file ); - file.printf ( " %s ", sig.name ); - this.write_parameter_list ( sig, file ); - } - - public override void write_enum_value ( Valadoc.EnumValue enval, void* ptr ) { - } - - public override void write_error_code ( Valadoc.ErrorCode errcode, void* ptr ) { - } - - public override void write_delegate ( Valadoc.Delegate del, void* ptr ) { - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = del; - - this.write_accessor ( del, file ); - - file.printf ( " delegate ", css_keyword ); - this.write_type_reference ( del.return_type, file ); - file.printf ( " %s ", del.name ); - this.write_parameter_list ( del, file ); - this.write_exception_list ( del, file ); - } - - public override void write_enum ( Valadoc.Enum en, void* ptr ) { - } - - public override void write_error_domain ( Valadoc.ErrorDomain errdom, void* ptr ) { - } - - private void write_accessor ( Valadoc.SymbolAccessibility element, GLib.FileStream file ) { - if ( element.is_public ) - file.printf ( "public ", css_keyword ); - else if ( element.is_protected ) - file.printf ( "protected ", css_keyword ); - else if ( element.is_private ) - file.printf ( "private ", css_keyword ); - } - - - public override void write_struct ( Valadoc.Struct stru, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = stru; - - this.write_accessor ( stru, file ); - file.printf ( "struct %s", css_keyword, stru.name ); - this.write_template_parameters ( stru, ptr ); - this.write_inheritance_list ( stru, file ); - } - - private void write_inheritance_list ( Valadoc.ContainerDataType dtype, GLib.FileStream file ) { - Gee.Collection lst = dtype.get_parent_types ( ); - int size = lst.size; - int i = 1; - - if ( size == 0 ) - return ; - - file.puts ( " : " ); - - foreach ( DataType cntype in lst ) { - this.write_type_name ( cntype, file ); - if ( size > i ) - file.puts ( ", " ); - - i++; - } - - file.putc ( ' ' ); - } - - public override void write_class ( Valadoc.Class cl, void* ptr ) { - GLib.StringBuilder modifiers = new GLib.StringBuilder ( "" ); - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = cl; - - this.write_accessor ( cl, file ); - - if ( cl.is_abstract ) - modifiers.append ( "abstract " ); - else if ( cl.is_static ) - modifiers.append ( "static " ); - - file.printf ( "%s class %s", css_keyword, modifiers.str, cl.name ); - - this.write_template_parameters ( cl, file ); - this.write_inheritance_list ( cl, file ); - } - - public override void write_interface ( Valadoc.Interface iface, void* ptr ) { - weak GLib.FileStream file = (GLib.FileStream)ptr; - this.position = iface; - - this.write_accessor ( iface, file ); - - if ( iface.is_static ) - file.printf ( "static interface %s", css_keyword, iface.name ); - else - file.printf ( "interface %s", css_keyword, iface.name ); - - this.write_template_parameters ( iface, ptr ); - this.write_inheritance_list ( iface, file ); - } - - public override void write_namespace ( Valadoc.Namespace ns, void* ptr ) { - } - - public override void write_file ( Valadoc.Package file, void* ptr ) { + base ( settings ); } } @@ -498,482 +42,21 @@ public class Valadoc.LangletIndex : Valadoc.Langlet, Valadoc.LinkHelper { -public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { - private Valadoc.LangletIndex langlet; - +public class Valadoc.HtmlDoclet : Valadoc.BasicHtmlDoclet, Valadoc.LinkHelper { private string current_path = null; private bool is_vapi = false; - - private void write_navi_entry_html_template ( GLib.FileStream file, string style, string content ) { - file.printf ( "\t
  • %s
  • \n", style, content ); - } - - private void write_navi_entry_html_template_with_link ( GLib.FileStream file, string style, string link, string content ) { - file.printf ( "\t
  • %s
  • \n", style, css_navi_link, link, content ); - } - - private void write_navi_entry ( GLib.FileStream file, Basic element, string style, bool link, bool full_name = false ) { - string name; - - if ( element is Class ) { - if ( ((Class)element).is_abstract ) - name = "" + element.name + ""; - else - name = element.name; - } - else if ( element is Package ) { - string path = this.get_file_name ( element ); - name = this.get_package_name ( path ); - } - else if ( full_name == true && element is Namespace ) { - string tmp = element.full_name(); - name = (tmp == null)? "Global Namespace" : tmp; - } - else { - string tmp = element.name; - name = (tmp == null)? "Global Namespace" : tmp; - } - - if ( link == true ) - this.write_navi_entry_html_template_with_link ( file, style, this.get_link (element), name ); - else - this.write_navi_entry_html_template ( file, style, name ); - } - - private void write_navi_top_entry ( GLib.FileStream file, Basic element, Basic mself ) { - string name = (element.name == null)? "Global Namespace" : element.name; - string style = null; - - if ( element is Namespace ) - style = css_navi_namespace; - else if ( element is Enum ) - style = css_navi_enum; - else if ( element is ErrorDomain ) - style = css_navi_error_domain; - else if ( element is Struct ) - style = css_navi_struct; - else if ( element is Class ) - style = css_navi_class; - else if ( element is Interface ) - style = css_navi_iface; - else if ( element is Package ) { - name = this.get_package_name ( element.name ); - style = css_navi_package; - } - - file.printf ( "
      \n", css_navi ); - - if ( element == mself ) - this.write_navi_entry ( file, element, style, false ); - else - this.write_navi_entry ( file, element, style, true ); - - file.puts ( "
    \n" ); - file.printf ( "\n
    \n", css_navi_hr ); - } - - private void write_top_element ( GLib.FileStream file ) { - file.printf ( "\n
    \n", css_navi, css_navi_package_index, css_navi_link, css_navi_hr ); - } - - private void write_top_elements ( GLib.FileStream file, Basic element, Basic? mself = null ) { - Gee.ArrayList lst = new Gee.ArrayList (); - Basic pos = element; - - if ( mself == null ) - mself = element; - - string file_name = this.get_file_name ( element ); - string package_name = this.get_package_name ( file_name ); - - this.write_top_element ( file ); - - while ( pos != null ) { - lst.add ( pos ); - pos = pos.parent; - } - - for ( int i = lst.size-1; i >= 0 ; i-- ) { - Basic el = lst.get ( i ); - this.write_navi_top_entry ( file, el, mself ); - } - } - - - private void fetch_subnamespace_names ( NamespaceHandler pos, Gee.ArrayList lst ) { - Gee.ReadOnlyCollection nspaces = pos.get_namespace_list (); - - foreach ( Namespace ns in nspaces ) { - lst.add ( ns ); - this.fetch_subnamespace_names ( ns, lst ); - } - } - - private void write_navi_file ( GLib.FileStream file, Package efile ) { - Gee.ArrayList ns_list = new Gee.ArrayList (); - this.fetch_subnamespace_names (efile, ns_list ); - - this.write_top_elements ( file, efile ); - - file.printf ( "
      \n", css_navi ); - - foreach ( Namespace ns in ns_list ) { - this.write_navi_entry ( file, ns, css_navi_namespace, true, true ); - } - - file.puts ( "
    \n" ); - } - - private void write_navi_child_namespaces_inline ( GLib.FileStream file, Namespace ns, Basic mself = null ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_namespaces_without_childs ( file, ns, mself ); - this.write_navi_child_classes_without_childs ( file, ns, mself ); - this.write_navi_child_interfaces_without_childs ( file, ns, mself ); - this.write_navi_child_structs_without_childs ( file, ns, mself ); - this.write_navi_child_enums_without_childs ( file, ns, mself ); - this.write_navi_child_error_domains_without_childs ( file, ns, mself ); - this.write_navi_child_delegates ( file, ns, mself ); - this.write_navi_child_methods ( file, ns, mself ); - this.write_navi_child_fields ( file, ns, mself ); - this.write_navi_child_constants ( file, ns, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_child_namespaces ( GLib.FileStream file, Namespace ns, Basic mself = null ) { - this.write_top_elements ( file, ns ); - this.write_navi_child_namespaces_inline ( file, ns, mself ); - } - - private void write_navi_struct_inline ( GLib.FileStream file, Struct stru, Basic mself = null ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_construction_methods ( file, stru, mself ); - this.write_navi_child_methods ( file, stru, mself ); - this.write_navi_child_fields ( file, stru, mself ); - this.write_navi_child_constants ( file, stru, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_struct ( GLib.FileStream file, Struct stru, Basic mself = null ) { - this.write_top_elements ( file, stru ); - this.write_navi_struct_inline ( file, stru, mself ); - } - - private void write_navi_interface_inline ( GLib.FileStream file, Interface iface, Basic mself = null ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_delegates ( file, iface, mself ); - this.write_navi_child_methods ( file, iface, mself ); - this.write_navi_child_signals ( file, iface, mself ); - this.write_navi_child_properties ( file, iface, mself ); - this.write_navi_child_fields ( file, iface, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_interface ( GLib.FileStream file, Interface iface, Basic mself = null ) { - this.write_top_elements ( file, iface ); - this.write_navi_interface_inline ( file, iface, mself ); - } - - private void write_navi_enum_inline ( GLib.FileStream file, Enum en, Basic mself = null ) { - Gee.ReadOnlyCollection enum_values = en.get_enum_values ( ); - file.printf ( "
      \n", css_navi ); - - foreach ( EnumValue env in enum_values ) { - this.write_navi_entry ( file, env, css_navi_enval, true ); - } - - this.write_navi_child_methods ( file, en, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_enum ( GLib.FileStream file, Enum en, Basic mself = null ) { - this.write_top_elements ( file, en ); - this.write_navi_enum_inline ( file, en, mself ); - } - - private void write_navi_error_domain_inline ( GLib.FileStream file, ErrorDomain errdom, Basic mself = null ) { - Gee.ReadOnlyCollection error_codes = errdom.get_error_code_list ( ); - file.printf ( "
      \n", css_navi ); - - foreach ( ErrorCode ec in error_codes ) { - this.write_navi_entry ( file, ec, css_navi_errdomcode, true ); - } - - this.write_navi_child_methods ( file, errdom, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_error_domain ( GLib.FileStream file, ErrorDomain errdom, Basic mself = null ) { - this.write_top_elements ( file, errdom ); - this.write_navi_error_domain_inline ( file, errdom, mself ); - } - - private void write_navi_class_inline ( GLib.FileStream file, Class cl, Basic mself = null ) { - file.printf ( "
      \n", css_navi ); - this.write_navi_child_construction_methods ( file, cl, mself ); - this.write_navi_child_classes_without_childs ( file, cl, mself ); - this.write_navi_child_structs_without_childs ( file, cl, mself ); - this.write_navi_child_enums_without_childs ( file, cl, mself ); - this.write_navi_child_delegates ( file, cl, mself ); - this.write_navi_child_methods ( file, cl, mself ); - this.write_navi_child_signals ( file, cl, mself ); - this.write_navi_child_properties ( file, cl, mself ); - this.write_navi_child_fields ( file, cl, mself ); - this.write_navi_child_constants ( file, cl, mself ); - file.puts ( "
    \n" ); - } - - private void write_navi_class ( GLib.FileStream file, Class cl, Basic mself = null ) { - this.write_top_elements ( file, cl ); - this.write_navi_class_inline ( file, cl, mself ); - } - - private void write_navi_method ( GLib.FileStream file, Method m ) { - Basic parent = m.parent; - - this.write_top_elements ( file, parent, m ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, m ); - else if ( m.parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, m ); - else if ( m.parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, m ); - else if ( m.parent is Enum ) - this.write_navi_enum_inline ( file, (Enum)parent, m ); - else if ( m.parent is ErrorDomain ) - this.write_navi_error_domain_inline ( file, (ErrorDomain)parent, m ); - else if ( m.parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, m ); - } - - private void write_navi_property ( GLib.FileStream file, Property prop ) { - Basic parent = prop.parent; - - this.write_top_elements ( file, prop.parent, prop ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, prop ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, prop ); - } - - private void write_navi_signal ( GLib.FileStream file, Signal sig ) { - Basic parent = sig.parent; - - this.write_top_elements ( file, sig.parent, sig ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, sig ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, sig ); - } - - private void write_navi_constant ( GLib.FileStream file, Constant c ) { - Basic parent = c.parent; - - this.write_top_elements ( file, parent, c ); - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, c ); - else if ( parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, c ); - else if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, c ); - //else if ( parent is Interface ) - // this.write_navi_interface_inline ( file, (Interface)parent, c ); - } - - private void write_navi_field ( GLib.FileStream file, Field f ) { - Basic parent = f.parent; - - this.write_top_elements ( file, parent, f ); - - if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, f ); - else if ( parent is Struct ) - this.write_navi_struct_inline ( file, (Struct)parent, f ); - else if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, f ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, f ); - } - - private void write_navi_delegate ( GLib.FileStream file, Delegate del ) { - Basic parent = del.parent; - - this.write_top_elements ( file, parent, del ); - - if ( parent is Namespace ) - this.write_navi_child_namespaces_inline ( file, (Namespace)parent, del ); - else if ( parent is Class ) - this.write_navi_class_inline ( file, (Class)parent, del ); - else if ( parent is Interface ) - this.write_navi_interface_inline ( file, (Interface)parent, del ); - } - - - private void write_navi_child_methods_collection ( GLib.FileStream file, Gee.Collection methods, Basic mself = null ) { - foreach ( Method m in methods ) { - if ( m == mself ) - this.write_navi_entry ( file, m, css_navi_construction_method, false ); - else - this.write_navi_entry ( file, m, css_navi_construction_method, true ); - } - } - - private void write_navi_child_methods ( GLib.FileStream file, MethodHandler mh, Basic mself = null ) { - Gee.ReadOnlyCollection methods = mh.get_method_list ( ); - this.write_navi_child_methods_collection ( file, methods, mself ); - } - - private void write_navi_child_classes_without_childs_collection ( GLib.FileStream file, Gee.Collection classes, Basic mself = null ) { - foreach ( Class cl in classes ) { - if ( cl == mself ) - this.write_navi_entry ( file, cl, css_navi_class, false ); - else - this.write_navi_entry ( file, cl, css_navi_class, true ); - } + protected override string get_link ( Valadoc.Basic p1, Valadoc.Basic p2 ) { + return this.get_html_link ( this.settings, p1 ); } - private void write_navi_child_classes_without_childs ( GLib.FileStream file, ClassHandler clh, Basic mself = null ) { - Gee.ReadOnlyCollection classes = clh.get_class_list ( ); - this.write_navi_child_classes_without_childs_collection ( file, classes, mself ); + private override void write_top_element ( GLib.FileStream file, Basic pos ) { + this.write_top_element_template ( file, "?" ); } - private void write_navi_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh, Basic mself = null ) { - Gee.ReadOnlyCollection methods = cmh.get_construction_method_list ( ); - this.write_navi_child_methods_collection ( file, methods, mself ); - } - private void write_navi_child_signals ( GLib.FileStream file, SignalHandler sh, Basic mself = null ) { - Gee.ReadOnlyCollection signals = sh.get_signal_list ( ); - foreach ( Signal sig in signals ) { - if ( sig == mself ) - this.write_navi_entry ( file, sig, css_navi_sig, false ); - else - this.write_navi_entry ( file, sig, css_navi_sig, true ); - } - } - - private void write_navi_child_properties ( GLib.FileStream file, PropertyHandler ph, Basic mself = null ) { - Gee.ReadOnlyCollection properties = ph.get_property_list ( ); - foreach ( Property p in properties ) { - if ( p == mself ) - this.write_navi_entry ( file, p, css_navi_prop, false ); - else - this.write_navi_entry ( file, p, css_navi_prop, true ); - } - } - - private void write_navi_child_fields_collection ( GLib.FileStream file, Gee.Collection fields, Basic mself = null ) { - foreach ( Field f in fields ) { - if ( f == mself ) - this.write_navi_entry ( file, f, css_navi_field, false ); - else - this.write_navi_entry ( file, f, css_navi_field, true ); - } - } - - private void write_navi_child_fields ( GLib.FileStream file, FieldHandler fh, Basic mself = null ) { - Gee.ReadOnlyCollection fields = fh.get_field_list ( ); - this.write_navi_child_fields_collection ( file, fields, mself ); - } - - private void write_navi_child_constants_collection ( GLib.FileStream file, Gee.Collection constants, Basic mself = null ) { - foreach ( Constant c in constants ) { - if ( c == mself ) - this.write_navi_entry ( file, c, css_navi_constant, false ); - else - this.write_navi_entry ( file, c, css_navi_constant, true ); - } - } - - private void write_navi_child_constants ( GLib.FileStream file, ConstantHandler ch, Basic mself = null ) { - Gee.ReadOnlyCollection constants = ch.get_constant_list ( ); - this.write_navi_child_constants_collection ( file, constants, mself ); - } - - private void write_navi_child_structs_without_childs_collection ( GLib.FileStream file, Gee.Collection structs, Basic mself = null ) { - foreach ( Struct stru in structs ) { - if ( stru == mself ) - this.write_navi_entry ( file, stru, css_navi_struct, false ); - else - this.write_navi_entry ( file, stru, css_navi_struct, true ); - } - } - - private void write_navi_child_structs_without_childs ( GLib.FileStream file, StructHandler strh, Basic mself = null ) { - Gee.Collection structs = strh.get_struct_list ( ); - this.write_navi_child_structs_without_childs_collection ( file, structs, mself ); - } - - private void write_navi_child_delegates_collection ( GLib.FileStream file, Gee.Collection delegates, Basic mself = null ) { - foreach ( Delegate del in delegates ) { - if ( del == mself ) - this.write_navi_entry ( file, del, css_navi_del, false ); - else - this.write_navi_entry ( file, del, css_navi_del, true ); - } - } - - private void write_navi_child_delegates ( GLib.FileStream file, DelegateHandler delh, Basic mself = null ) { - Gee.Collection delegates = delh.get_delegate_list ( ); - this.write_navi_child_delegates_collection ( file, delegates, mself ); - } - - private void write_navi_child_interfaces_without_childs_collection ( GLib.FileStream file, Gee.Collection interfaces, Basic mself = null ) { - foreach ( Interface iface in interfaces ) { - if ( iface == mself ) - this.write_navi_entry ( file, iface, css_navi_iface, false ); - else - this.write_navi_entry ( file, iface, css_navi_iface, true ); - } - } - - private void write_navi_child_interfaces_without_childs ( GLib.FileStream file, Namespace ifh, Basic mself = null ) { - Gee.Collection interfaces = ifh.get_interface_list ( ); - this.write_navi_child_interfaces_without_childs_collection ( file, interfaces, mself ); - } - - private void write_navi_child_enums_without_childs_collection ( GLib.FileStream file, Gee.Collection enums, Basic mself = null ) { - foreach ( Enum en in enums ) { - if ( en == mself ) - this.write_navi_entry ( file, en, css_navi_enum, false ); - else - this.write_navi_entry ( file, en, css_navi_enum, true ); - } - } - - private void write_navi_child_enums_without_childs ( GLib.FileStream file, EnumHandler eh, Basic mself = null ) { - Gee.Collection enums = eh.get_enum_list ( ); - this.write_navi_child_enums_without_childs_collection ( file, enums, mself ); - } - - private void write_navi_child_error_domains_without_childs_collection ( GLib.FileStream file, Gee.Collection errordomains, Basic mself = null ) { - foreach ( ErrorDomain errdom in errordomains ) { - if ( errdom == mself ) - this.write_navi_entry ( file, errdom, css_navi_error_domain, false ); - else - this.write_navi_entry ( file, errdom, css_navi_error_domain, true ); - } - } - - private void write_navi_child_error_domains_without_childs ( GLib.FileStream file, Namespace errdomh, Basic mself = null ) { - Gee.Collection errordomains = errdomh.get_error_domain_list ( ); - this.write_navi_child_error_domains_without_childs_collection ( file, errordomains, mself ); - } - - private void write_navi_child_namespaces_without_childs ( GLib.FileStream file, NamespaceHandler nsh, Basic mself = null ) { - Gee.ReadOnlyCollection namespaces = nsh.get_namespace_list ( ); - foreach ( Namespace ns in namespaces ) { - if ( ns == mself ) - this.write_navi_entry ( file, ns, css_navi_namespace, false ); - else - this.write_navi_entry ( file, ns, css_navi_namespace, true ); - } - } private string get_full_path ( Basic element ) { if ( element.name == null ) @@ -993,8 +76,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { str.prepend ( pos.name ); } - string file_path = get_file_name ( element ); - string package_name = get_package_name ( file_path ) + "/"; + string package_name = element.file.name + "/"; str.prepend ( package_name ); str.append_unichar ( '/' ); @@ -1013,26 +95,16 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.langlet = new Valadoc.LangletIndex ( settings ); } - private void write_image_block ( GLib.FileStream file, DataType element ) { - string realimgpath = this.current_path + "tree.png"; - string imgpath = "docs/" + get_full_path ( element ) + "tree.png"; - - if ( element is Class ) { - Diagrams.write_class_diagram ( (Class)element, realimgpath ); - } - else if ( element is Interface ) { - Diagrams.write_interface_diagram ( (Interface)element, realimgpath ); - } - else if ( element is Struct ) { - Diagrams.write_struct_diagram ( (Struct)element, realimgpath ); - } + protected override string get_img_real_path ( Basic element ) { + return this.current_path + "tree.png"; + } - file.printf ( "

    Object Hierarchy:

    \n", css_title ); - file.printf ( "\n", css_diagram, imgpath ); + protected override string get_img_path ( Basic element ) { + return "docs/" + get_full_path ( element ) + "tree.png"; } public override void visit_package ( Package file ) { - string package_name = this.get_package_name ( file.name ); + string package_name = file.name; this.is_vapi = file.is_external_package; string new_path = this.settings.path + package_name + "/"; @@ -1047,13 +119,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.current_path = null; } - public void write_namespace_content ( GLib.FileStream file, Namespace ns ) { - file.printf ( "

    %s:

    \n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name() ); - file.printf ( "
    \n", css_hr ); - file.printf ( "

    Description:

    \n", css_title ); - ns.write_comment ( file ); - } - public override void visit_namespace ( Namespace ns ) { string old_path = this.current_path; @@ -1069,7 +134,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { var rt = DirUtils.create ( this.current_path, 0777 ); GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" ); - this.write_navi_child_namespaces ( navi, ns ); + this.write_navi_child_namespaces ( navi, ns, ns ); navi = null; GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w" ); @@ -1091,197 +156,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.current_path = old_path; } - private void write_child_classes ( GLib.FileStream file, ClassHandler clh ) { - Gee.ReadOnlyCollection classes = clh.get_class_list (); - if ( classes.size > 0 ) { - file.printf ( "

    Classes:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Class subcl in classes ) { - string name; - if ( subcl.is_abstract ) - name = "" + subcl.name + ""; - else - name = subcl.name; - - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_class, css_navi_link, this.get_link(subcl), name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_enums ( GLib.FileStream file, EnumHandler eh ) { - Gee.Collection enums = eh.get_enum_list (); - if ( enums.size > 0 ) { - file.printf ( "

    Enums:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Enum en in enums ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_enum, css_navi_link, this.get_link(en), en.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_structs ( GLib.FileStream file, StructHandler struh ) { - Gee.Collection structs = struh.get_struct_list (); - if ( structs.size > 0 ) { - file.printf ( "

    Structs:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Struct stru in structs ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_struct, css_navi_link, this.get_link(stru), stru.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_methods ( GLib.FileStream file, MethodHandler mh ) { - Gee.ReadOnlyCollection methods = mh.get_method_list (); - if ( methods.size > 0 ) { - file.printf ( "

    Methods:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Method m in methods ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m), m.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_delegates ( GLib.FileStream file, DelegateHandler dh ) { - Gee.Collection delegates = dh.get_delegate_list (); - if ( delegates.size > 0 ) { - file.printf ( "

    Delegates:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Delegate d in delegates ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_delegate, css_navi_link, this.get_link(d), d.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_construction_methods ( GLib.FileStream file, ConstructionMethodHandler cmh ) { - Gee.ReadOnlyCollection methods = cmh.get_construction_method_list (); - if ( methods.size > 0 ) { - file.printf ( "

    Construction Methods:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Method m in methods ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_method, css_navi_link, this.get_link(m), m.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_signals ( GLib.FileStream file, SignalHandler sh ) { - Gee.ReadOnlyCollection signals = sh.get_signal_list (); - if ( signals.size > 0 ) { - file.printf ( "

    Signals:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Signal sig in signals ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_signal, css_navi_link, this.get_link(sig), sig.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_properties ( GLib.FileStream file, PropertyHandler ph ) { - Gee.ReadOnlyCollection properties = ph.get_property_list (); - if ( properties.size > 0 ) { - file.printf ( "

    Properties:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Property prop in properties ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_property, css_navi_link, this.get_link(prop), prop.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_fields ( GLib.FileStream file, FieldHandler fh ) { - Gee.ReadOnlyCollection fields = fh.get_field_list (); - if ( fields.size > 0 ) { - file.printf ( "

    Fields:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Field f in fields ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_fields, css_navi_link, this.get_link(f), f.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_constants ( GLib.FileStream file, ConstantHandler ch ) { - Gee.ReadOnlyCollection constants = ch.get_constant_list (); - if ( constants.size > 0 ) { - file.printf ( "

    Constants:

    \n", css_title ); - file.printf ( "
      \n", css_inline_navigation ); - foreach ( Constant c in constants ) { - file.printf ( "\t
    • %s
    • \n", css_inline_navigation_constant, css_navi_link, this.get_link(c), c.name ); - } - file.puts ( "
    \n" ); - } - } - - private void write_child_error_values ( GLib.FileStream file, ErrorDomain errdom ) { - Gee.ReadOnlyCollection error_codes = errdom.get_error_code_list (); - if ( error_codes.size > 0 ) { - file.printf ( "

    Error Codes:

    \n", css_title ); - file.printf ( "\n", css_errordomain_table ); - foreach ( ErrorCode errcode in error_codes ) { - file.puts ( "\n" ); - file.printf ( "\t\n", css_errordomain_table_name, errcode.name, errcode.name ); - file.printf ( "\t\n" ); - file.puts ( "\n" ); - } - file.puts ( "
    %s\n", css_errordomain_table_text ); - - errcode.write_comment ( file ); - - file.puts ( "\t
    \n" ); - } - } - - private void write_child_enum_values ( GLib.FileStream file, Enum en ) { - Gee.ReadOnlyCollection enum_values = en.get_enum_values (); - if ( enum_values.size > 0 ) { - file.printf ( "

    Enum Values:

    \n", css_title ); - file.printf ( "\n", css_enum_table ); - foreach ( EnumValue enval in enum_values ) { - file.puts ( "\n" ); - file.printf ( "\t\n", css_enum_table_name, enval.name, enval.name ); - file.printf ( "\t\n" ); - file.puts ( "\n" ); - } - file.puts ( "
    %s\n", css_enum_table_text ); - - enval.write_comment ( file ); - - file.puts ( "\t
    \n" ); - } - } - - public void write_interface_content ( GLib.FileStream file, Interface iface ) { - string full_name = iface.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - - this.write_image_block ( file, iface ); - - file.printf ( "

    Description:

    \n", css_title ); - - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_interface ( iface, file ); - file.printf ( "\n
    \n" ); - - iface.write_comment ( file ); - this.write_namespace_note ( file, iface ); - this.write_package_note ( file, iface ); - file.printf ( "\n

    Content:

    \n", css_title ); - - this.write_child_classes ( file, iface ); - this.write_child_structs ( file, iface ); - this.write_child_delegates ( file, iface ); - this.write_child_methods ( file, iface ); - this.write_child_signals ( file, iface ); - this.write_child_properties ( file, iface ); - this.write_child_fields ( file, iface ); - } - public override void visit_interface ( Interface iface ) { string old_path = this.current_path; this.current_path += iface.name + "/"; @@ -1300,7 +174,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { cname = null; GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" ); - this.write_navi_interface ( navi, iface ); + this.write_navi_interface ( navi, iface, iface ); navi = null; GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w"); @@ -1310,35 +184,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.current_path = old_path; } - public void write_class_content ( GLib.FileStream file, Class cl ) { - string full_name = cl.full_name ( ); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - - this.write_image_block ( file, cl ); - - file.printf ( "

    Description:

    \n", css_title ); - - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_class ( cl, file ); - file.printf ( "\n
    \n" ); - cl.write_comment ( file ); - this.write_namespace_note ( file, cl ); - this.write_package_note ( file, cl ); - file.printf ( "\n

    Content:

    \n", css_title ); - - this.write_child_construction_methods ( file, cl ); - this.write_child_classes ( file, cl ); - this.write_child_structs ( file, cl ); - this.write_child_enums ( file, cl ); - this.write_child_delegates ( file, cl ); - this.write_child_methods ( file, cl ); - this.write_child_signals ( file, cl ); - this.write_child_properties ( file, cl ); - this.write_child_fields ( file, cl ); - this.write_child_constants ( file, cl ); - } - public override void visit_class ( Class cl ) { string old_path = this.current_path; this.current_path += cl.name + "/"; @@ -1356,7 +201,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { cl.visit_constants ( this ); GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" ); - this.write_navi_class ( navi, cl ); + this.write_navi_class ( navi, cl, cl ); navi = null; GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" ); @@ -1370,28 +215,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.current_path = old_path; } - public void write_struct_content ( GLib.FileStream file, Struct stru ) { - string full_name = stru.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - - this.write_image_block ( file, stru ); - - file.printf ( "

    Description:

    \n", css_title ); - stru.write_comment ( file ); - this.write_namespace_note ( file, stru ); - this.write_package_note ( file, stru ); - file.printf ( "\n

    Content:

    \n", css_title ); - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_struct ( stru, file ); - file.printf ( "\n
    \n" ); - - this.write_child_construction_methods ( file, stru ); - this.write_child_methods ( file, stru ); - this.write_child_fields ( file, stru ); - this.write_child_constants ( file, stru ); - } - public override void visit_struct ( Struct stru ) { string old_path = this.current_path; this.current_path += stru.name + "/"; @@ -1403,7 +226,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { stru.visit_constants ( this ); GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" ); - this.write_navi_struct ( navi, stru ); + this.write_navi_struct ( navi, stru, stru ); navi = null; GLib.FileStream cname = GLib.FileStream.open ( this.current_path + "cname", "w" ); @@ -1417,19 +240,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.current_path = old_path; } - public void write_error_domain_content ( GLib.FileStream file, ErrorDomain errdom ) { - string full_name = errdom.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - errdom.write_comment ( file ); - this.write_namespace_note ( file, errdom ); - this.write_package_note ( file, errdom ); - file.printf ( "\n

    Content:

    \n", css_title ); - this.write_child_error_values ( file, errdom ); - this.write_child_methods ( file, errdom ); - } - public override void visit_error_domain ( ErrorDomain errdom ) { string old_path = this.current_path; this.current_path += errdom.name + "/"; @@ -1442,7 +252,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { cname = null; GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" ); - this.write_navi_error_domain ( navi, errdom ); + this.write_navi_error_domain ( navi, errdom, errdom ); navi = null; GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w"); @@ -1452,19 +262,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.current_path = old_path; } - public void write_enum_content ( GLib.FileStream file, Enum en ) { - string full_name = en.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - en.write_comment ( file ); - this.write_namespace_note ( file, en ); - this.write_package_note ( file, en ); - file.printf ( "\n

    Content:

    \n", css_title ); - this.write_child_enum_values ( file, en ); - this.write_child_methods ( file, en ); - } - public override void visit_enum ( Enum en ) { string old_path = this.current_path; this.current_path += en.name + "/"; @@ -1478,7 +275,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { cname = null; GLib.FileStream navi = GLib.FileStream.open ( this.current_path + "navi.html", "w" ); - this.write_navi_enum ( navi, en ); + this.write_navi_enum ( navi, en, en ); navi = null; GLib.FileStream file = GLib.FileStream.open ( this.current_path + "index.html", "w"); @@ -1488,38 +285,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { this.current_path = old_path; } - public void write_property_content ( GLib.FileStream file, Property prop ) { - string full_name = prop.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_property ( prop, file ); - file.printf ( "\n
    \n" ); - prop.write_comment ( file ); - } - - private void write_package_note ( GLib.FileStream file, Basic element ) { - string package = element.package; - if ( package == null ) - return ; - - file.printf ( "\n\n
    \nPackage: %s\n\n", package ); - } - - private void write_namespace_note ( GLib.FileStream file, Basic element ) { - for ( ; element is Namespace == false; element = element.parent ) - ; - - if ( element.parent == null ) - return ; - - if ( element.name == null ) - return ; - - file.printf ( "\n\n
    \nNamespace: %s\n\n", element.full_name() ); - } - public override void visit_property ( Property prop ) { string path = this.current_path + prop.name + "/"; var rt = DirUtils.create ( path, 0777 ); @@ -1542,21 +307,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { file = null; } - public void write_constant_content ( GLib.FileStream file, Constant constant, ConstantHandler parent ) { - string full_name = constant.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_constant ( constant, parent, file ); - file.printf ( "\n
    \n" ); - constant.write_comment ( file ); - if ( constant.parent is Namespace ) { - this.write_namespace_note ( file, constant ); - this.write_package_note ( file, constant ); - } - } - public override void visit_constant ( Constant constant, ConstantHandler parent ) { string path = this.current_path + constant.name + "/"; var rt = DirUtils.create ( path, 0777 ); @@ -1570,21 +320,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { file = null; } - public void write_field_content ( GLib.FileStream file, Field field, FieldHandler parent ) { - string full_name = field.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_field ( field, parent, file ); - file.printf ( "\n
    \n" ); - field.write_comment ( file ); - if ( field.parent is Namespace ) { - this.write_namespace_note ( file, field ); - this.write_package_note ( file, field ); - } - } - public override void visit_field ( Field field, FieldHandler parent ) { string path = this.current_path + field.name + "/"; var rt = DirUtils.create ( path, 0777 ); @@ -1619,21 +354,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { public override void visit_enum_value ( EnumValue enval ) { } - public void write_delegate_content ( GLib.FileStream file, Delegate del ) { - string full_name = del.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_delegate ( del, file ); - file.printf ( "\n
    \n" ); - del.write_comment ( file ); - if ( del.parent is Namespace ) { - this.write_namespace_note ( file, del ); - this.write_package_note ( file, del ); - } - } - public override void visit_delegate ( Delegate del ) { string path = this.current_path + del.name + "/"; var rt = DirUtils.create ( path, 0777 ); @@ -1651,17 +371,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { file = null; } - public void write_signal_content ( GLib.FileStream file, Signal sig ) { - string full_name = sig.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_signal ( sig, file ); - file.printf ( "\n
    \n" ); - sig.write_comment ( file ); - } - public override void visit_signal ( Signal sig ) { string path = this.current_path + sig.name + "/"; var rt = DirUtils.create ( path, 0777 ); @@ -1684,21 +393,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Doclet, Valadoc.LinkHelper { file = null; } - public void write_method_content ( GLib.FileStream file, Method m , Valadoc.MethodHandler parent ) { - string full_name = m.full_name (); - file.printf ( "

    %s:

    \n", css_title, full_name ); - file.printf ( "
    \n", css_headline_hr ); - file.printf ( "

    Description:

    \n", css_title ); - file.printf ( "
    \n\t", css_code_definition ); - this.langlet.write_method ( file, m, parent ); - file.printf ( "\n
    \n" ); - m.write_comment ( file ); - if ( m.parent is Namespace ) { - this.write_namespace_note ( file, m ); - this.write_package_note ( file, m ); - } - } - public override void visit_method ( Method m, Valadoc.MethodHandler parent ) { string path = this.current_path + m.name + "/"; string full_name = m.full_name (); diff --git a/src/doclets/valadoc.org/linkhelper/Makefile.am b/src/doclets/valadoc.org/linkhelper/Makefile.am index 519ec1be8..273bc4c11 100644 --- a/src/doclets/valadoc.org/linkhelper/Makefile.am +++ b/src/doclets/valadoc.org/linkhelper/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libhtmlhelper.vala.stamp libhtmlhelper.vala.stamp: $(libhtmlhelper_VALASOURCES) - $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^ + $(VALAC) -C --library libhtmlhelper-1.0 --basedir . --vapidir ../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../vapi --pkg valadoc-1.0 --disable-non-null $^ touch $@ @@ -29,6 +29,7 @@ libhtmlhelper_la_SOURCES = \ AM_CFLAGS = \ -I ../../../libvaladoc/ \ + -I ../../htmlhelpers/ \ $(LIBVALA_CFLAGS) \ $(GLIB_CFLAGS) \ $(NULL) @@ -36,6 +37,7 @@ AM_CFLAGS = \ libhtmlhelper_la_LIBADD = \ ../../../libvaladoc/libvaladoc.la \ + ../../htmlhelpers/libhtmlhelpers.la \ $(LIBVALA_LIBS) \ $(GLIB_LIBS) \ $(NULL) diff --git a/src/doclets/valadoc.org/linkhelper/helper.vala b/src/doclets/valadoc.org/linkhelper/helper.vala index 5ea636a23..b7b7a0e77 100755 --- a/src/doclets/valadoc.org/linkhelper/helper.vala +++ b/src/doclets/valadoc.org/linkhelper/helper.vala @@ -20,123 +20,16 @@ using GLib; - -/* css-class-names: */ -public const string css_inline_navigation = "main_inline_navigation"; -public const string css_inline_navigation_property = "main_inline_navigation_property"; -public const string css_inline_navigation_method = "main_inline_navigation_method"; -public const string css_inline_navigation_signal = "main_inline_navigation_signal"; -public const string css_inline_navigation_fields = "main_inline_navigation_fields"; -public const string css_inline_navigation_class = "main_inline_navigation_class"; -public const string css_inline_navigation_enum = "main_inline_navigation_enum"; -public const string css_inline_navigation_struct = "main_inline_navigation_struct"; -public const string css_inline_navigation_delegate = "main_inline_navigation_delegate"; -public const string css_inline_navigation_constant = "main_inline_navigation_constant"; - -public const string css_navi_package_index = "navi_package_index"; -public const string css_navi_package = "navi_package"; -public const string css_navi_construction_method = "navi_construction_method"; -public const string css_navi_error_domain = "navi_error_domain"; -public const string css_navi_namespace = "navi_namespace"; -public const string css_navi_method = "navi_method"; -public const string css_navi_struct = "navi_struct"; -public const string css_navi_iface = "navi_iface"; -public const string css_navi_field = "navi_field"; -public const string css_navi_class = "navi_class"; -public const string css_navi_enum = "navi_enum"; -public const string css_navi_link = "navi_link"; -public const string css_navi_constant = "navi_constant"; -public const string css_navi_prop = "navi_prop"; -public const string css_navi_del = "navi_del"; -public const string css_navi_sig = "navi_sig"; -public const string css_navi = "navi_main"; -public const string css_navi_enval = "main_navi_enval"; -public const string css_navi_errdomcode = "main_navi_errdomcode"; -public const string css_navi_hr = "navi_hr"; - -public const string css_errordomain_table_name = "main_errordomain_table_name"; -public const string css_errordomain_table_text = "main_errordomain_table_text"; -public const string css_errordomain_table = "main_errordomain_table"; - - -public const string css_enum_table_name = "main_enum_table_name"; -public const string css_enum_table_text = "main_enum_table_text"; -public const string css_enum_table = "main_enum_table"; - -public const string css_diagram = "main_diagram"; -public const string css_see_list = "main_see_list"; -public const string css_exception_table = "main_parameter_table"; -public const string css_parameter_table_text = "main_parameter_table_text"; -public const string css_parameter_table_name = "main_parameter_table_name"; -public const string css_parameter_table = "main_parameter_table"; -public const string css_title = "main_title"; -public const string css_other_type = "main_other_type"; -public const string css_basic_type = "main_basic_type"; -public const string css_keyword = "main_keyword"; -public const string css_optional_parameter = "main_optional_parameter"; -public const string css_code_definition = "main_code_definition"; -public const string css_headline_hr = "main_hr"; -public const string css_hr = "main_hr"; -public const string css_list_errdom = "main_list_errdom"; -public const string css_list_en = "main_list_en"; -public const string css_list_ns = "main_list_ns"; -public const string css_list_cl = "main_list_cl"; -public const string css_list_iface = "main_list_iface"; -public const string css_list_stru = "main_list_stru"; -public const string css_list_field = "main_list_field"; -public const string css_list_prop = "main_list_prop"; -public const string css_list_del = "main_list_del"; -public const string css_list_sig = "main_list_sig"; -public const string css_list_m = "main_list_m"; - -public interface Valadoc.LinkHelper : Object { - private static string package_name = null; - - public abstract Settings settings { - construct set; - get; - } - - private string get_dirname ( string file_name ) { - if ( file_name[file_name.len()-1] == '/' ) - return GLib.Path.get_dirname ( file_name ); - else - return GLib.Path.get_basename ( file_name ); - } - - protected string get_package_name ( string file_path ) { - if ( file_path.has_suffix (".vapi") ) { - string file_name = GLib.Path.get_basename (file_path); - return file_name.ndup ( file_name.size() - ".vapi".size() ); - } - - return this.settings.pkg_name; - } - - public string get_file_name ( Valadoc.Basic tag ) { - Valadoc.Basic pos = tag; - - while ( pos != null ) { - if ( pos is Valadoc.Package ) - return pos.name; - - pos = pos.parent; - } - return null; - } - - protected string? get_link ( Valadoc.Basic tag ) { -// if ( !this.settings.to_doc( tag.file_name ) ) -// return null; - +public interface Valadoc.LinkHelper { + public string? get_html_link ( Valadoc.Settings? settings, Valadoc.Basic element ) { GLib.StringBuilder str = new GLib.StringBuilder ( "" ); - Valadoc.Basic pos = tag; + Valadoc.Basic pos = element; - if ( tag is Valadoc.Package == false ) { - if ( tag is Valadoc.EnumValue || tag is Valadoc.ErrorCode ) { + if ( element is Valadoc.Package == false ) { + if ( element is Valadoc.EnumValue || element is Valadoc.ErrorCode ) { str.append_unichar ( '#' ); - str.append ( tag.name ); - pos = pos.parent; + str.append ( element.name ); + pos = element.parent; } while ( pos != null ) { @@ -153,12 +46,9 @@ public interface Valadoc.LinkHelper : Object { pos = pos.parent; } } - string filename = this.get_file_name ( tag ); - string package_name = this.get_package_name ( filename ); - str.prepend ( package_name ); + + str.prepend ( element.file.name ); str.prepend ( "?path=" ); return str.str; } } - - diff --git a/src/doclets/valadoc.org/taglets/author/Makefile.am b/src/doclets/valadoc.org/taglets/author/Makefile.am index a16a4a707..b80d1ae02 100644 --- a/src/doclets/valadoc.org/taglets/author/Makefile.am +++ b/src/doclets/valadoc.org/taglets/author/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletversion.vala.stamp libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletversion_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/doclets/valadoc.org/taglets/link/Makefile.am b/src/doclets/valadoc.org/taglets/link/Makefile.am index 7d105468b..3cac61494 100644 --- a/src/doclets/valadoc.org/taglets/link/Makefile.am +++ b/src/doclets/valadoc.org/taglets/link/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletlink.vala.stamp libtagletlink.vala.stamp: $(libtagletlink_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletlink_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/doclets/valadoc.org/taglets/link/taglet.vala b/src/doclets/valadoc.org/taglets/link/taglet.vala index cf8e06c89..8d417c7da 100644 --- a/src/doclets/valadoc.org/taglets/link/taglet.vala +++ b/src/doclets/valadoc.org/taglets/link/taglet.vala @@ -45,8 +45,8 @@ public class LinkHtmlTaglet : InlineTaglet, LinkHelper { } this.settings = settings; - this.path = this.get_link ( element ); - this.content = str; + this.path = this.get_html_link ( settings, element ); + this.content = element.full_name (); return true; } diff --git a/src/doclets/valadoc.org/taglets/parameter/Makefile.am b/src/doclets/valadoc.org/taglets/parameter/Makefile.am index 3211b3b83..f66987bcf 100644 --- a/src/doclets/valadoc.org/taglets/parameter/Makefile.am +++ b/src/doclets/valadoc.org/taglets/parameter/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletparameter.vala.stamp libtagletparameter.vala.stamp: $(libtagletparameter_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletparameter_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/doclets/valadoc.org/taglets/return/Makefile.am b/src/doclets/valadoc.org/taglets/return/Makefile.am index fb7ecc9f1..4e03753c6 100644 --- a/src/doclets/valadoc.org/taglets/return/Makefile.am +++ b/src/doclets/valadoc.org/taglets/return/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletXXXX.vala.stamp libtagletXXXX.vala.stamp: $(libtagletXXXX_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletXXXX_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/doclets/valadoc.org/taglets/see/Makefile.am b/src/doclets/valadoc.org/taglets/see/Makefile.am index 60d5b9093..8dd3b5f82 100644 --- a/src/doclets/valadoc.org/taglets/see/Makefile.am +++ b/src/doclets/valadoc.org/taglets/see/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletsee.vala.stamp libtagletsee.vala.stamp: $(libtagletsee_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletsee_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/doclets/valadoc.org/taglets/see/taglet.vala b/src/doclets/valadoc.org/taglets/see/taglet.vala index 17fe5b0ef..7cecf1e26 100644 --- a/src/doclets/valadoc.org/taglets/see/taglet.vala +++ b/src/doclets/valadoc.org/taglets/see/taglet.vala @@ -76,8 +76,8 @@ public class SeeHtmlTaglet : MainTaglet, LinkHelper { } this.settings = settings; - this.path = this.get_link ( element ); - this.name = str; + this.path = this.get_html_link ( settings, element ); + this.name = element.full_name (); return true; } diff --git a/src/doclets/valadoc.org/taglets/string/Makefile.am b/src/doclets/valadoc.org/taglets/string/Makefile.am index 44676c49f..d1e30e463 100644 --- a/src/doclets/valadoc.org/taglets/string/Makefile.am +++ b/src/doclets/valadoc.org/taglets/string/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletstring.vala.stamp libtagletstring.vala.stamp: $(libtagletstring_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletstring_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/doclets/valadoc.org/taglets/throws/Makefile.am b/src/doclets/valadoc.org/taglets/throws/Makefile.am index 2ec375a83..0e029d3e8 100644 --- a/src/doclets/valadoc.org/taglets/throws/Makefile.am +++ b/src/doclets/valadoc.org/taglets/throws/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libexceptionparameter.vala.stamp libexceptionparameter.vala.stamp: $(libexceptionparameter_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libexceptionparameter_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/doclets/valadoc.org/taglets/version/Makefile.am b/src/doclets/valadoc.org/taglets/version/Makefile.am index a16a4a707..b80d1ae02 100644 --- a/src/doclets/valadoc.org/taglets/version/Makefile.am +++ b/src/doclets/valadoc.org/taglets/version/Makefile.am @@ -11,7 +11,7 @@ BUILT_SOURCES = libtagletversion.vala.stamp libtagletversion.vala.stamp: $(libtagletversion_VALASOURCES) - $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ + $(VALAC) -C --vapidir ../../../htmlhelpers --pkg libhtmlhelpers-1.0 --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^ touch $@ @@ -32,6 +32,7 @@ libtagletversion_la_SOURCES = \ AM_CFLAGS = -g \ -I ../../../../libvaladoc/ \ + -I ../../../htmlhelpers/ \ -I ../../linkhelper/ \ -I ../../ \ $(GLIB_CFLAGS) \ diff --git a/src/libvaladoc/doctree.vala b/src/libvaladoc/doctree.vala index 66115c5b3..d72bf55f1 100755 --- a/src/libvaladoc/doctree.vala +++ b/src/libvaladoc/doctree.vala @@ -4199,12 +4199,26 @@ public class Valadoc.Package : Basic, NamespaceHandler { get; } + private string extract_package_name ( Vala.SourceFile vfile ) { + if ( vfile.filename.has_suffix (".vapi") ) { + string file_name = GLib.Path.get_basename (vfile.filename); + return file_name.ndup ( file_name.size() - ".vapi".size() ); + } + else if ( vfile.filename.has_suffix (".gidl") ) { + string file_name = GLib.Path.get_basename (vfile.filename); + return file_name.ndup ( file_name.size() - ".gidl".size() ); + } + else { + return settings.pkg_name; + } + } + public Package ( Valadoc.Settings settings, Vala.SourceFile vfile, Tree head ) { this.settings = settings; this.head = head; - this.package_name = vfile.filename; - this.is_external_package = !( this.package_name.has_suffix ( ".vala" ) || this.package_name.has_suffix ( ".gs" ) ); + this.is_external_package = !( vfile.filename.has_suffix ( ".vala" ) || vfile.filename.has_suffix ( ".gs" ) ); + this.package_name = this.extract_package_name ( vfile ); } private string package_name; @@ -4244,15 +4258,7 @@ public class Valadoc.Package : Basic, NamespaceHandler { // internal public bool is_package ( Vala.SourceFile vfile ) { - bool vheader = !( vfile.filename.has_suffix ( ".vala" ) || vfile.filename.has_suffix ( ".gs" ) ); - if ( vheader == false && this.is_external_package == false ) { - return true; - } - else if ( vheader == true && this.is_external_package == true ) { - if ( vfile.filename == this.package_name ) - return true; - } - return false; + return ( this.extract_package_name ( vfile ) == this.package_name ); } public void visit ( Doclet doclet ) { diff --git a/src/libvaladoc/drawer.vala b/src/libvaladoc/drawer.vala index e6d71d09b..135ff5d28 100755 --- a/src/libvaladoc/drawer.vala +++ b/src/libvaladoc/drawer.vala @@ -41,6 +41,9 @@ namespace Valadoc.Diagrams { Gee.Collection parentlst = stru.get_parent_types ( ); foreach ( DataType type in parentlst ) { + if ( type is Struct == false ) + break; + weak Graphviz.Node stru = draw_struct ( g, (Struct)type, me ); draw_struct_parents ( (Struct)type, g, stru ); }