From: Florian Brosch Date: Thu, 17 Sep 2009 18:08:22 +0000 (+0200) Subject: - paragraph plugins X-Git-Tag: 0.37.1~3^2~584 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=189083c265a24705f1eaac2e75121e2485a7bd89;p=thirdparty%2Fvala.git - paragraph plugins --- diff --git a/configure.in b/configure.in index fd7cccd1a..0117dad5a 100644 --- a/configure.in +++ b/configure.in @@ -75,6 +75,7 @@ AC_CONFIG_FILES([Makefile src/doclets/htmlhelpers/taglets/table/Makefile src/doclets/htmlhelpers/taglets/right/Makefile src/doclets/htmlhelpers/taglets/image/Makefile + src/doclets/htmlhelpers/taglets/paragraph/Makefile src/doclets/htmlhelpers/taglets/throws/Makefile src/doclets/htmlhelpers/taglets/string/Makefile src/doclets/htmlhelpers/taglets/center/Makefile @@ -94,6 +95,7 @@ AC_CONFIG_FILES([Makefile src/doclets/valadoc.org/doclet/Makefile src/doclets/valadoc.org/taglets/Makefile src/doclets/valadoc.org/taglets/see/Makefile + src/doclets/valadoc.org/taglets/paragraph/Makefile src/doclets/valadoc.org/taglets/link/Makefile src/doclets/valadoc.org/taglets/constants/Makefile src/doclets/valadoc.org/taglets/list/Makefile diff --git a/src/doclets/htmlhelpers/taglets/Makefile.am b/src/doclets/htmlhelpers/taglets/Makefile.am index b97a83696..8181abd64 100644 --- a/src/doclets/htmlhelpers/taglets/Makefile.am +++ b/src/doclets/htmlhelpers/taglets/Makefile.am @@ -12,6 +12,7 @@ SUBDIRS = \ list \ listelement \ notification \ + paragraph \ parameter \ return \ right \ diff --git a/src/doclets/htmlhelpers/taglets/headline/taglet.vala b/src/doclets/htmlhelpers/taglets/headline/taglet.vala index c5c1a0541..6bcc16a69 100755 --- a/src/doclets/htmlhelpers/taglets/headline/taglet.vala +++ b/src/doclets/htmlhelpers/taglets/headline/taglet.vala @@ -27,15 +27,15 @@ namespace Valadoc.Html { private string title; private int lvl; - public override bool parse ( owned string title, int lvl ) { + public override bool parse (string title, int lvl) { this.title = title; this.lvl = lvl; return true; } - public override bool write ( void* res, int max, int index ) { + public override bool write (void* res, int max, int index) { weak GLib.FileStream file = (GLib.FileStream)res; - file.printf ("\n\n%s\n", this.lvl, this.title, this.lvl ); + file.printf ("\n\n%s\n", this.lvl, this.title, this.lvl); return true; } } @@ -43,7 +43,7 @@ namespace Valadoc.Html { [ModuleInit] -public GLib.Type register_plugin ( Gee.HashMap taglets ) { - return typeof ( Valadoc.Html.HeadlineDocElement ); +public GLib.Type register_plugin (Gee.HashMap taglets) { + return typeof (Valadoc.Html.HeadlineDocElement); } diff --git a/src/doclets/htmlhelpers/taglets/paragraph/Makefile.am b/src/doclets/htmlhelpers/taglets/paragraph/Makefile.am new file mode 100755 index 000000000..94ede0780 --- /dev/null +++ b/src/doclets/htmlhelpers/taglets/paragraph/Makefile.am @@ -0,0 +1,56 @@ +NULL = + + +AM_CFLAGS = -g \ + -I ../../../../libvaladoc/ \ + -I ../../doclet/ \ + $(GLIB_CFLAGS) \ + $(LIBVALA_CFLAGS) \ + $(NULL) + + +BUILT_SOURCES = libtagletparagraph.vala.stamp + + +tagletparagraphdir = $(libdir)/valadoc/plugins/htmlhelpers/taglets/ + + +tagletparagraph_LTLIBRARIES = \ + libtagletparagraph.la \ + $(NULL) + + +libtagletparagraph_la_VALASOURCES = \ + taglet.vala \ + $(NULL) + + +libtagletparagraph_la_SOURCES = \ + libtagletparagraph.vala.stamp \ + $(libtagletparagraph_la_VALASOURCES:.vala=.c) \ + $(NULL) + + +libtagletparagraph.vala.stamp: $(libtagletparagraph_la_VALASOURCES) + $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../doclet/ --pkg libhtmlhelpers-1.0 --basedir . $^ + touch $@ + + +libtagletparagraph_la_LDFLAGS = -module -avoid-version + + +libtagletparagraph_la_LIBADD = \ + ../../../../libvaladoc/libvaladoc.la \ + $(LIBGVC_LIBS) \ + $(LIBVALA_LIBS) \ + $(GLIB_LIBS) \ + $(NULL) + + +EXTRA_DIST = $(libtagletparagraph_la_VALASOURCES) libtagletparagraph.vala.stamp + + +MAINTAINERCLEANFILES = \ + $(libtagletparagraph_la_VALASOURCES:.vala=.c) \ + $(NULL) + diff --git a/src/doclets/htmlhelpers/taglets/paragraph/taglet.vala b/src/doclets/htmlhelpers/taglets/paragraph/taglet.vala new file mode 100755 index 000000000..387186dd6 --- /dev/null +++ b/src/doclets/htmlhelpers/taglets/paragraph/taglet.vala @@ -0,0 +1,57 @@ +/* + * Valadoc - a documentation tool for vala. + * Copyright (C) 2008 Florian Brosch + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +using GLib; +using Gee; + + +namespace Valadoc.Html { + public class ParagraphDocElement : Valadoc.ParagraphDocElement { + private ArrayList content; + + public override bool parse (ArrayList content) { + this.content = content; + return true; + } + + public override bool write (void* res, int max, int index) { + weak GLib.FileStream file = (GLib.FileStream)res; + int _max = this.content.size; + int _index = 0; + + file.printf ("

"); + + foreach (DocElement element in this.content) { + element.write (res, _max, _index); + _index++; + } + + file.printf ("

"); + return true; + } + } +} + + +[ModuleInit] +public GLib.Type register_plugin (Gee.HashMap taglets) { + return typeof (Valadoc.Html.ParagraphDocElement); +} + diff --git a/src/doclets/htmlhelpers/taglets/source/taglet.vala b/src/doclets/htmlhelpers/taglets/source/taglet.vala index 594811438..13eea768a 100755 --- a/src/doclets/htmlhelpers/taglets/source/taglet.vala +++ b/src/doclets/htmlhelpers/taglets/source/taglet.vala @@ -28,24 +28,24 @@ namespace Valadoc.Html { private int srclines; private string src; - public override bool parse ( owned string src, Language lang ) { - this.src = (owned)src; + public override bool parse (string src, Language lang) { + this.src = src; this.lang = lang; this.srclines=0; for (weak string str=this.src; str.get_char()!='\0'; str=str.next_char()) { - if ( str.get_char () == '\n' ) { + if (str.get_char () == '\n') { this.srclines++; } } return true; } - public override bool write ( void* res, int max, int index ) { + public override bool write (void* res, int max, int index) { weak GLib.FileStream file = (GLib.FileStream)res; - file.printf ( "\n\n\t
", css_source_sample );
-			file.puts ( src );
-			file.puts ( "
\n\n" ); + file.printf ("\n\n\t
", css_source_sample);
+			file.puts (src);
+			file.puts ("
\n\n"); return true; } } @@ -53,8 +53,8 @@ namespace Valadoc.Html { [ModuleInit] -public GLib.Type register_plugin ( Gee.HashMap taglets ) { - return typeof ( Valadoc.Html.SourceCodeDocElement ); +public GLib.Type register_plugin (Gee.HashMap taglets) { + return typeof (Valadoc.Html.SourceCodeDocElement); } diff --git a/src/doclets/valadoc.org/taglets/Makefile.am b/src/doclets/valadoc.org/taglets/Makefile.am index 743eca235..f7b55dde0 100755 --- a/src/doclets/valadoc.org/taglets/Makefile.am +++ b/src/doclets/valadoc.org/taglets/Makefile.am @@ -17,6 +17,7 @@ SUBDIRS = \ list \ return \ source \ + paragraph \ parameter \ listelement \ notification \ diff --git a/src/doclets/valadoc.org/taglets/headline/taglet.vala b/src/doclets/valadoc.org/taglets/headline/taglet.vala index db653a32b..d646a5435 100755 --- a/src/doclets/valadoc.org/taglets/headline/taglet.vala +++ b/src/doclets/valadoc.org/taglets/headline/taglet.vala @@ -26,7 +26,7 @@ public class Valadoc.ValdocOrg.HeadlineDocElement : Valadoc.HeadlineDocElement { private string title; private int lvl; - public override bool parse (owned string title, int lvl) { + public override bool parse (string title, int lvl) { this.title = title; this.lvl = lvl; return true; diff --git a/src/doclets/valadoc.org/taglets/paragraph/Makefile.am b/src/doclets/valadoc.org/taglets/paragraph/Makefile.am new file mode 100755 index 000000000..969a30ad7 --- /dev/null +++ b/src/doclets/valadoc.org/taglets/paragraph/Makefile.am @@ -0,0 +1,56 @@ +NULL = + + +AM_CFLAGS = -g \ + -I ../../../../libvaladoc/ \ + -I ../../doclet/ \ + $(GLIB_CFLAGS) \ + $(LIBVALA_CFLAGS) \ + $(NULL) + + +BUILT_SOURCES = libtagletparagraph.vala.stamp + + +tagletparagraphdir = $(libdir)/valadoc/plugins/valadoc.org/taglets/ + + +tagletparagraph_LTLIBRARIES = \ + libtagletparagraph.la \ + $(NULL) + + +libtagletparagraph_la_VALASOURCES = \ + taglet.vala \ + $(NULL) + + +libtagletparagraph_la_SOURCES = \ + libtagletparagraph.vala.stamp \ + $(libtagletparagraph_la_VALASOURCES:.vala=.c) \ + $(NULL) + + +libtagletparagraph.vala.stamp: $(libtagletparagraph_la_VALASOURCES) + $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --basedir . $^ + touch $@ + + +libtagletparagraph_la_LDFLAGS = -module -avoid-version + + +libtagletparagraph_la_LIBADD = \ + ../../../../libvaladoc/libvaladoc.la \ + $(LIBGVC_LIBS) \ + $(LIBVALA_LIBS) \ + $(GLIB_LIBS) \ + $(NULL) + + +EXTRA_DIST = $(libtagletparagraph_la_VALASOURCES) libtagletparagraph.vala.stamp + + +MAINTAINERCLEANFILES = \ + $(libtagletparagraph_la_VALASOURCES:.vala=.c) \ + $(NULL) + diff --git a/src/doclets/valadoc.org/taglets/paragraph/taglet.vala b/src/doclets/valadoc.org/taglets/paragraph/taglet.vala new file mode 100755 index 000000000..db398117e --- /dev/null +++ b/src/doclets/valadoc.org/taglets/paragraph/taglet.vala @@ -0,0 +1,55 @@ +/* + * Valadoc - a documentation tool for vala. + * Copyright (C) 2008 Florian Brosch + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +using GLib; +using Gee; + + +namespace Valadoc.ValdocOrg { + public class ParagraphDocElement : Valadoc.ParagraphDocElement { + private ArrayList content; + + public override bool parse (ArrayList content) { + this.content = content; + return true; + } + + public override bool write (void* res, int max, int index) { + weak GLib.FileStream file = (GLib.FileStream)res; + int _max = this.content.size; + int _index = 0; + + foreach (DocElement element in this.content) { + element.write (res, _max, _index); + _index++; + } + + file.printf ("\n\n"); + return true; + } + } +} + + +[ModuleInit] +public GLib.Type register_plugin (Gee.HashMap taglets) { + return typeof (Valadoc.ValdocOrg.ParagraphDocElement); +} + diff --git a/src/doclets/valadoc.org/taglets/source/taglet.vala b/src/doclets/valadoc.org/taglets/source/taglet.vala index dd76050e9..facbdb908 100755 --- a/src/doclets/valadoc.org/taglets/source/taglet.vala +++ b/src/doclets/valadoc.org/taglets/source/taglet.vala @@ -27,8 +27,8 @@ public class Valadoc.ValdocOrg.SourceCodeDocElement : Valadoc.SourceCodeDocEleme private int srclines; private string src; - public override bool parse (owned string src, Language lang) { - this.src = (owned)src; + public override bool parse (string src, Language lang) { + this.src = src; this.lang = lang; this.srclines=0; diff --git a/src/libvaladoc/documentation/doctree.vala b/src/libvaladoc/documentation/doctree.vala index e4258bc61..fca49d3d0 100755 --- a/src/libvaladoc/documentation/doctree.vala +++ b/src/libvaladoc/documentation/doctree.vala @@ -53,12 +53,10 @@ public enum Valadoc.ListType { } -/* deprecated */ public interface Valadoc.Documentation : Object { public abstract string? get_filename (); } - public abstract class Valadoc.DocElement : Object { public abstract bool write (void* res, int max, int index); } @@ -76,7 +74,7 @@ public abstract class Valadoc.CodeConstantDocElement : Valadoc.DocElement { } public abstract class Valadoc.MainTaglet : Taglet { - // remove + // deprecated protected string? get_data_type (DocumentedElement me) { if (me is Valadoc.Class) return "class"; @@ -117,6 +115,7 @@ public abstract class Valadoc.MainTaglet : Taglet { public abstract class Valadoc.StringTaglet : Taglet { + // deprecated public string content { protected set; get; } @@ -124,8 +123,12 @@ public abstract class Valadoc.StringTaglet : Taglet { public abstract bool parse (string content); } +public abstract class Valadoc.ParagraphDocElement : DocElement { + public abstract bool parse (ArrayList paragraph); +} + public abstract class Valadoc.HeadlineDocElement : DocElement { - public abstract bool parse (owned string title, int lvl); + public abstract bool parse (string title, int lvl); } public abstract class Valadoc.ImageDocElement : DocElement { @@ -137,7 +140,7 @@ public abstract class Valadoc.LinkDocElement : DocElement { } public abstract class Valadoc.SourceCodeDocElement : DocElement { - public abstract bool parse (owned string src, Language lang); + public abstract bool parse (string src, Language lang); } public abstract class Valadoc.ListEntryDocElement : DocElement { diff --git a/src/libvaladoc/documentation/moduleloader.vala b/src/libvaladoc/documentation/moduleloader.vala index 8fce8e38b..d26354936 100755 --- a/src/libvaladoc/documentation/moduleloader.vala +++ b/src/libvaladoc/documentation/moduleloader.vala @@ -27,7 +27,7 @@ public static delegate GLib.Type Valadoc.TagletRegisterFunction ( Gee.HashMap taglets; public GLib.Type bold; @@ -42,11 +42,11 @@ public class Valadoc.ModuleLoader : Object { public GLib.Type right; public GLib.Type source; public GLib.Type source_inline; - public GLib.Type @string; // + public GLib.Type @string; public GLib.Type table; public GLib.Type table_cell; public GLib.Type underline; - + public GLib.Type paragraph; private Module docletmodule; private Type doclettype; @@ -159,6 +159,9 @@ public class Valadoc.ModuleLoader : Object { case "libtagletcodeconstant": this.source_inline = type; break; + case "libtagletparagraph": + this.source_inline = type; + break; } modules.add ( module ); }