[valadoc] drop libxml2 dependency
- From: Florian Brosch <flobrosch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [valadoc] drop libxml2 dependency
- Date: Wed, 28 Oct 2009 13:05:24 +0000 (UTC)
commit a93f461cbfff1697f2911f4b03439730fbc51433
Author: Florian Brosch <flo brosch gmail com>
Date: Sun Oct 25 22:14:00 2009 +0100
drop libxml2 dependency
configure.in | 4 -
src/doclets/devhelp/Makefile.am | 4 +-
src/doclets/devhelp/doclet.vala | 185 ++++++++++--------------------
src/libvaladoc/Makefile.am | 5 +-
src/libvaladoc/devhelp-markupwriter.vala | 87 ++++++++++++++
5 files changed, 150 insertions(+), 135 deletions(-)
---
diff --git a/configure.in b/configure.in
index 8f37d37..54c8884 100644
--- a/configure.in
+++ b/configure.in
@@ -27,13 +27,9 @@ LIBGEE_REQUIRED=0.5
LIBGVC_REQUIRED=2.16
GLIB_REQUIRED=2.12.0
GTK_REQUIRED=2.10.0
-LIBXML2_REQUIRED=2.0
LIBGDKPIXBUF_REQUIRED=2.0
-PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED )
-AC_SUBST(LIBXML2_CFLAGS)
-AC_SUBST(LIBXML2_LIBS)
PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED )
AC_SUBST(LIBGVC_CFLAGS)
diff --git a/src/doclets/devhelp/Makefile.am b/src/doclets/devhelp/Makefile.am
index 9f3a90e..aacd5bf 100644
--- a/src/doclets/devhelp/Makefile.am
+++ b/src/doclets/devhelp/Makefile.am
@@ -6,7 +6,6 @@ AM_CFLAGS = -g \
-I ../../libvaladoc/ \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
- $(LIBXML2_CFLAGS) \
$(LIBVALA_CFLAGS) \
$(NULL)
@@ -35,14 +34,13 @@ libdoclet_la_SOURCES = \
libdoclet.vala.stamp: $(libdoclet_la_VALASOURCES)
- $(VALAC) -C --vapidir ../../vapi --vapidir ../../libvaladoc --pkg valadoc-1.0 --pkg libxml-2.0 --pkg gee-1.0 --basedir . $^
+ $(VALAC) -C --vapidir ../../vapi --vapidir ../../libvaladoc --pkg valadoc-1.0 --pkg gee-1.0 --basedir . $^
touch $@
libdoclet_la_LIBADD = \
../../libvaladoc/libvaladoc.la \
$(GLIB_LIBS) \
- $(LIBXML2_LIBS) \
$(LIBVALA_LIBS) \
$(LIBGEE_LIBS) \
$(NULL)
diff --git a/src/doclets/devhelp/doclet.vala b/src/doclets/devhelp/doclet.vala
index 03919e1..66227da 100755
--- a/src/doclets/devhelp/doclet.vala
+++ b/src/doclets/devhelp/doclet.vala
@@ -21,7 +21,6 @@
using Valadoc;
using Valadoc.Api;
using Valadoc.Html;
-using Xml;
using Gee;
@@ -103,108 +102,16 @@ namespace Valadoc.Devhelp {
-public enum Valadoc.Devhelp.KeywordType {
- NAMESPACE = 0,
- CLASS = 1,
- DELEGATE = 2,
- INTERFACE = 3,
- ERRORDOMAIN = 4,
-
- CONSTANT = 5,
- ENUM = 6,
- FUNCTION = 7,
- MACRO = 8,
- PROPERTY = 9,
- SIGNAL = 10,
- STRUCT = 11,
- TYPEDEF = 12,
- UNION = 13,
- VARIABLE = 14,
- UNSET = 15
-}
-
-public class Valadoc.Devhelp.DevhelpFormat : Object {
- private Xml.Doc* devhelp = null;
- private Xml.Node* functions = null;
- private Xml.Node* chapters = null;
- private Xml.Node* current = null;
-/*
- ~DevhelpFormat ( ) {
- delete this.devhelp;
- }
-*/
- public void save_file ( string path ) {
- Xml.Doc.save_format_file ( path, this.devhelp, 1 );
- }
-
- public DevhelpFormat ( string name, string version ) {
- this.devhelp = new Xml.Doc ( "1.0" );
- Xml.Node* root = new Xml.Node ( null, "book" );
- this.devhelp->set_root_element( root );
- root->new_prop ( "xmlns", "http://www.devhelp.net/book" );
- root->new_prop ( "title", name + " Reference Manual" );
- root->new_prop ( "language", "vala" );
- root->new_prop ( "link", "index.htm" );
- root->new_prop ( "name", version );
- root->new_prop ( "version", "2" );
- root->new_prop ( "author", "" );
-
- this.current = root->new_child ( null, "chapters" );
- this.functions = root->new_child ( null, "functions" );
- this.chapters = this.current;
- }
-
- private const string[] keyword_type_strings = {
- "", // namespace
- "", // class
- "", // delegate
- "", // interface
- "", // errordomain
- "constant",
- "enum",
- "function",
- "macro",
- "property",
- "signal",
- "struct",
- "typedef",
- "union",
- "variable",
- ""
- };
-
- public void add_chapter_start ( string name, string link ) {
- this.current = this.current->new_child ( null, "sub" );
- this.current->new_prop ( "name", name );
- this.current->new_prop ( "link", link );
- }
-
- public void add_chapter_end () {
- this.current = this.current->parent;
- }
-
- public void add_chapter ( string name, string link ) {
- this.add_chapter_start ( name, link );
- this.add_chapter_end ();
- }
-
- public void add_keyword ( KeywordType type, string name, string link ) {
- Xml.Node* keyword = this.functions->new_child ( null, "keyword" );
- keyword->new_prop ( "type", keyword_type_strings[(int)type] );
- keyword->new_prop ( "name", name );
- keyword->new_prop ( "link", link );
- }
-}
-
-
-
public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
private const string css_path_wiki = "../wikistyle.css";
private const string css_path = "wikistyle.css";
+
+ private ArrayList<Api.Node> nodes = new ArrayList<Api.Node> ();
private string package_dir_name = ""; // remove
- private DevhelpFormat devhelp;
private Api.Tree tree;
+ private Devhelp.MarkupWriter _devhelpwriter;
+
construct {
_renderer = new HtmlRenderer (this);
}
@@ -223,10 +130,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
DirUtils.create (this.settings.path, 0777);
- this.devhelp = new DevhelpFormat (settings.pkg_name, "");
-
write_wiki_pages (tree, css_path_wiki, Path.build_filename (this.settings.path, this.settings.pkg_name, "content"));
-
tree.accept (this);
}
@@ -242,6 +146,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
string imgpath = GLib.Path.build_filename (path, "img");
string devpath = GLib.Path.build_filename (path, pkg_name + ".devhelp2");
+
WikiPage wikipage = null;
if (this.settings.pkg_name == package.name && this.tree.wikitree != null) {
wikipage = this.tree.wikitree.search ("index.valadoc");
@@ -253,7 +158,11 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
rt = DirUtils.create (imgpath, 0777);
copy_directory (icons_dir, path);
- this.devhelp = new DevhelpFormat (pkg_name, "");
+ var devfile = FileStream.open (devpath, "w");
+ _devhelpwriter = new Devhelp.MarkupWriter (devfile);
+ _devhelpwriter.xml_declaration ();
+
+ _devhelpwriter.start_book (pkg_name+" Reference Manual", "vala", "index.htm", "", "", "");
GLib.FileStream file = GLib.FileStream.open (filepath, "w");
writer = new Html.MarkupWriter (file);
@@ -264,18 +173,43 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
write_file_footer ();
file = null;
+
+ _devhelpwriter.start_chapters ();
package.accept_all_children (this);
+ _devhelpwriter.end_chapters ();
+
+
+ _devhelpwriter.start_functions ();
+ foreach (Api.Node node in this.nodes) {
+ string typekeyword = "";
+ if (node is Enum) {
+ typekeyword = "enum";
+ } else if (node is Constant) {
+ typekeyword = "constant";
+ } else if (node is Method) {
+ typekeyword = "function";
+ } else if (node is Field) {
+ typekeyword = "variable";
+ } else if (node is Property) {
+ typekeyword = "property";
+ } else if (node is Api.Signal) {
+ typekeyword = "signal";
+ } else if (node is Struct) {
+ typekeyword = "struct";
+ }
+
+ _devhelpwriter.simple_tag ("keyword", {"type", typekeyword, "name", node.name, "link", get_html_link_imp (settings, node, null)});
+ }
+ _devhelpwriter.end_functions ();
- this.devhelp.save_file (devpath);
+ _devhelpwriter.end_book ();
}
- private void process_compound_node (Api.Node node, KeywordType type) {
+ private void process_compound_node (Api.Node node) {
string rpath = this.get_real_path (node);
string path = this.get_path (node);
if (node.name != null) {
- this.devhelp.add_chapter_start (node.name, path);
-
GLib.FileStream file = GLib.FileStream.open (rpath, "w");
writer = new Html.MarkupWriter (file);
writer.xml_declaration ();
@@ -286,15 +220,17 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
file = null;
}
- node.accept_all_children (this);
-
if (node.name != null) {
- this.devhelp.add_chapter_end ();
- this.devhelp.add_keyword (type, node.name, path);
+ _devhelpwriter.start_sub (node.name, path);
+ node.accept_all_children (this);
+ _devhelpwriter.end_sub ();
+ this.nodes.add (node);
+ } else {
+ node.accept_all_children (this);
}
}
- private void process_node (Api.Node node, KeywordType type) {
+ private void process_node (Api.Node node) {
string rpath = this.get_real_path (node);
string path = this.get_path (node);
@@ -307,46 +243,45 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
write_file_footer ();
file = null;
+ _devhelpwriter.start_sub (node.name, path);
node.accept_all_children (this);
-
- this.devhelp.add_keyword (type, node.name, path);
- this.devhelp.add_chapter (node.name, path);
+ _devhelpwriter.end_sub ();
}
public override void visit_namespace (Namespace item) {
- process_compound_node (item, KeywordType.NAMESPACE);
+ process_compound_node (item);
}
public override void visit_interface (Interface item) {
- process_compound_node (item, KeywordType.INTERFACE);
+ process_compound_node (item);
}
public override void visit_class (Class item) {
- process_compound_node (item, KeywordType.CLASS);
+ process_compound_node (item);
}
public override void visit_struct (Struct item) {
- process_compound_node (item, KeywordType.STRUCT);
+ process_compound_node (item);
}
public override void visit_error_domain (ErrorDomain item) {
- process_node (item, KeywordType.ERRORDOMAIN);
+ process_node (item);
}
public override void visit_enum ( Enum item) {
- process_node (item, KeywordType.ENUM);
+ process_node (item);
}
public override void visit_property (Property item) {
- process_node (item, KeywordType.PROPERTY);
+ process_node (item);
}
public override void visit_constant (Constant item) {
- process_node (item, KeywordType.VARIABLE);
+ process_node (item);
}
public override void visit_field (Field item) {
- process_node (item, KeywordType.VARIABLE);
+ process_node (item);
}
public override void visit_error_code (ErrorCode item) {
@@ -356,15 +291,15 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
}
public override void visit_delegate (Delegate item) {
- process_node (item, KeywordType.DELEGATE);
+ process_node (item);
}
public override void visit_signal (Api.Signal item) {
- process_node (item, KeywordType.SIGNAL);
+ process_node (item);
}
public override void visit_method (Method item) {
- process_node (item, KeywordType.FUNCTION);
+ process_node (item);
}
}
diff --git a/src/libvaladoc/Makefile.am b/src/libvaladoc/Makefile.am
index f05470d..78b5580 100644
--- a/src/libvaladoc/Makefile.am
+++ b/src/libvaladoc/Makefile.am
@@ -4,7 +4,6 @@ NULL =
AM_CFLAGS = \
-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
$(LIBGVC_CFLAGS) \
- $(LIBXML2_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
$(LIBVALA_CFLAGS) \
@@ -30,6 +29,7 @@ libvaladoc_la_VALASOURCES = \
moduleloader.vala \
settings.vala \
markupwriter.vala \
+ devhelp-markupwriter.vala \
documentation/commentscanner.vala \
documentation/documentation.vala \
documentation/documentationparser.vala \
@@ -137,13 +137,12 @@ libvaladocincludedir = $(includedir)/
libvaladoc.vala.stamp: $(libvaladoc_la_VALASOURCES)
- $(VALAC) $(VALAFLAGS) -C -H valadoc-1.0.h --pkg gee-1.0 --pkg vala-1.0 --pkg gmodule-2.0 --vapidir ../vapi --pkg libxml-2.0 --pkg libgvc --library valadoc-1.0 --basedir $(top_srcdir)/src/libvaladoc/ --save-temps $^
+ $(VALAC) $(VALAFLAGS) -C -H valadoc-1.0.h --pkg gee-1.0 --pkg vala-1.0 --pkg gmodule-2.0 --vapidir ../vapi --pkg libgvc --library valadoc-1.0 --basedir $(top_srcdir)/src/libvaladoc/ --save-temps $^
touch $@
libvaladoc_la_LIBADD = \
$(LIBGVC_LIBS) \
- $(LIBXML2_LIBS) \
$(LIBGEE_LIBS) \
$(GLIB_LIBS) \
$(LIBVALA_LIBS) \
diff --git a/src/libvaladoc/devhelp-markupwriter.vala b/src/libvaladoc/devhelp-markupwriter.vala
new file mode 100644
index 0000000..76ef87c
--- /dev/null
+++ b/src/libvaladoc/devhelp-markupwriter.vala
@@ -0,0 +1,87 @@
+/* markupwriter.vala
+ *
+ * Valadoc - a documentation tool for vala.
+ * Copyright (C) 2008-2009 Florian Brosch, Didier Villevalois
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Didier 'Brosch Florian <flo brosch gmail com>
+ */
+
+
+
+
+public class Valadoc.Devhelp.MarkupWriter : Valadoc.MarkupWriter {
+ public MarkupWriter (FileStream stream) {
+ base (stream);
+ }
+
+ protected override bool inline_element (string name) {
+ return name != "book";
+ }
+
+ protected override bool content_inline_element (string name) {
+ return name == "keyword"
+ || name == "sub";
+ }
+
+ public MarkupWriter start_book (string title, string lang, string link, string name, string version, string author) {
+ this.start_tag ("book", {"xmlns", "http://www.devhelp.net/book", "title", title, "language", lang, "name", name, "version", version, "author", author, "link", link});
+ return this;
+ }
+
+ public MarkupWriter end_book () {
+ this.end_tag ("book");
+ return this;
+ }
+
+ public MarkupWriter start_functions () {
+ this.start_tag ("functions");
+ return this;
+ }
+
+ public MarkupWriter end_functions () {
+ this.end_tag ("functions");
+ return this;
+ }
+
+ public MarkupWriter start_chapters () {
+ this.start_tag ("chapters");
+ return this;
+ }
+
+ public MarkupWriter end_chapters () {
+ this.end_tag ("chapters");
+ return this;
+ }
+
+ public MarkupWriter start_sub (string name, string link) {
+ this.start_tag ("sub", {"name", name, "link", link});
+ return this;
+ }
+
+ public MarkupWriter end_sub () {
+ this.end_tag ("sub");
+ return this;
+ }
+
+ public MarkupWriter keyword (string name, string type, string link) {
+ this.start_tag ("keyword", {"type", type, "name", name, "link", link});
+ this.end_tag ("keyword");
+ return this;
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]