[valadoc] Add initial reading-support for <doc>
- From: Florian Brosch <flobrosch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [valadoc] Add initial reading-support for <doc>
- Date: Fri, 27 Jan 2012 16:44:22 +0000 (UTC)
commit b4a6e4a98e5ca16889391a5db989b151f03ed208
Author: Florian Brosch <flo brosch gmail com>
Date: Thu Jan 5 03:31:39 2012 +0100
Add initial reading-support for <doc>
icons/devhelpstyle.css | 25 +-
icons/style.css | 24 +
icons/wikistyle.css | 25 +
src/driver/0.10.x/driver.vala | 16 +-
src/driver/0.12.x/driver.vala | 16 +-
src/driver/0.14.x/driver.vala | 16 +-
src/driver/0.16.x/Makefile.am | 1 +
src/driver/0.16.x/driver.vala | 18 +-
src/driver/0.16.x/girwriter.vala | 203 +++++++++
src/driver/0.16.x/symbolresolver.vala | 2 +-
src/driver/0.16.x/treebuilder.vala | 3 +-
src/libvaladoc/api/driver.vala | 1 +
src/libvaladoc/api/tree.vala | 8 +-
src/libvaladoc/devhelp-markupwriter.vala | 8 +-
.../documentation/gtkdoccommentparser.vala | 59 +--
src/libvaladoc/gtkdocmarkupwriter.vala | 73 +++
src/libvaladoc/gtkdocrenderer.vala | 470 ++++++++++++++++++++
src/libvaladoc/html/htmlrenderer.vala | 4 +-
src/libvaladoc/markupwriter.vala | 68 +++-
src/libvaladoc/settings.vala | 13 +
src/valadoc/valadoc.vala | 54 +++
21 files changed, 1044 insertions(+), 63 deletions(-)
---
diff --git a/icons/devhelpstyle.css b/icons/devhelpstyle.css
index bc37d5c..c52052a 100644
--- a/icons/devhelpstyle.css
+++ b/icons/devhelpstyle.css
@@ -125,7 +125,6 @@ div.site_body {
color: #a52a2a;
}
-
div.main_code_definition {
padding-right: 10px;
padding-left: 10px;
@@ -140,6 +139,30 @@ div.main_code_definition {
margin: 10px;
}
+div.main_notification_block {
+ padding-right: 10px;
+ padding-left: 10px;
+ padding-bottom: 5px;
+ padding-top: 5px;
+
+ border-color: #d08717;
+ background-color: #fbf2c3;
+ border-style: solid;
+ border-width: 1px;
+ margin: 10px;
+}
+
+span.main_block_headline {
+ background-image:url(tip.png);
+ background-repeat:no-repeat;
+ background-position:center right;
+ font-weight:bold;
+ display:block;
+}
+
+div.main_block_content {
+ margin-left:15px;
+}
span.leaf_code_definition {
font: monospace;
diff --git a/icons/style.css b/icons/style.css
index ef96972..c4b0c79 100644
--- a/icons/style.css
+++ b/icons/style.css
@@ -154,6 +154,30 @@ div.main_code_definition {
margin: 10px;
}
+div.main_notification_block {
+ padding-right: 10px;
+ padding-left: 10px;
+ padding-bottom: 5px;
+ padding-top: 5px;
+
+ border-color: #d08717;
+ background-color: #fbf2c3;
+ border-style: solid;
+ border-width: 1px;
+ margin: 10px;
+}
+
+span.main_block_headline {
+ background-image:url(tip.png);
+ background-repeat:no-repeat;
+ background-position:center right;
+ font-weight:bold;
+ display:block;
+}
+
+div.main_block_content {
+ margin-left:15px;
+}
span.leaf_code_definition {
font: monospace;
diff --git a/icons/wikistyle.css b/icons/wikistyle.css
index 56ca6bc..a3d8e4b 100644
--- a/icons/wikistyle.css
+++ b/icons/wikistyle.css
@@ -32,6 +32,31 @@ ul.external_link {
background-image: url(warning.png);
}
+div.main_notification_block {
+ padding-right: 10px;
+ padding-left: 10px;
+ padding-bottom: 5px;
+ padding-top: 5px;
+
+ border-color: #d08717;
+ background-color: #fbf2c3;
+ border-style: solid;
+ border-width: 1px;
+ margin: 10px;
+}
+
+span.main_block_headline {
+ background-image:url(tip.png);
+ background-repeat:no-repeat;
+ background-position:center right;
+ font-weight:bold;
+ display:block;
+}
+
+div.main_block_content {
+ margin-left:15px;
+}
+
.main_sourcesample {
padding-right: 10px;
padding-left: 5px;
diff --git a/src/driver/0.10.x/driver.vala b/src/driver/0.10.x/driver.vala
index 6fc87d9..253bc7b 100755
--- a/src/driver/0.10.x/driver.vala
+++ b/src/driver/0.10.x/driver.vala
@@ -29,11 +29,25 @@ using Gee;
* Creates an simpler, minimized, more abstract AST for valacs AST.
*/
public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
+ private Api.Tree? tree;
+
+ public void write_gir (Settings settings, ErrorReporter reporter) {
+ var gir_writer = new Vala.GIRWriter ();
+
+ // put .gir file in current directory unless -d has been explicitly specified
+ string gir_directory = ".";
+ if (settings.gir_directory != null) {
+ gir_directory = settings.gir_directory;
+ }
+
+ gir_writer.write_file ((Vala.CodeContext) tree.data, gir_directory, settings.gir_namespace, settings.gir_version, settings.pkg_name);
+ }
public Api.Tree? build (Settings settings, ErrorReporter reporter) {
TreeBuilder builder = new TreeBuilder ();
- Api.Tree? tree = builder.build (settings, reporter);
+ tree = builder.build (settings, reporter);
if (reporter.errors > 0) {
+ tree = null;
return null;
}
diff --git a/src/driver/0.12.x/driver.vala b/src/driver/0.12.x/driver.vala
index 6fc87d9..253bc7b 100755
--- a/src/driver/0.12.x/driver.vala
+++ b/src/driver/0.12.x/driver.vala
@@ -29,11 +29,25 @@ using Gee;
* Creates an simpler, minimized, more abstract AST for valacs AST.
*/
public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
+ private Api.Tree? tree;
+
+ public void write_gir (Settings settings, ErrorReporter reporter) {
+ var gir_writer = new Vala.GIRWriter ();
+
+ // put .gir file in current directory unless -d has been explicitly specified
+ string gir_directory = ".";
+ if (settings.gir_directory != null) {
+ gir_directory = settings.gir_directory;
+ }
+
+ gir_writer.write_file ((Vala.CodeContext) tree.data, gir_directory, settings.gir_namespace, settings.gir_version, settings.pkg_name);
+ }
public Api.Tree? build (Settings settings, ErrorReporter reporter) {
TreeBuilder builder = new TreeBuilder ();
- Api.Tree? tree = builder.build (settings, reporter);
+ tree = builder.build (settings, reporter);
if (reporter.errors > 0) {
+ tree = null;
return null;
}
diff --git a/src/driver/0.14.x/driver.vala b/src/driver/0.14.x/driver.vala
index 6fc87d9..253bc7b 100755
--- a/src/driver/0.14.x/driver.vala
+++ b/src/driver/0.14.x/driver.vala
@@ -29,11 +29,25 @@ using Gee;
* Creates an simpler, minimized, more abstract AST for valacs AST.
*/
public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
+ private Api.Tree? tree;
+
+ public void write_gir (Settings settings, ErrorReporter reporter) {
+ var gir_writer = new Vala.GIRWriter ();
+
+ // put .gir file in current directory unless -d has been explicitly specified
+ string gir_directory = ".";
+ if (settings.gir_directory != null) {
+ gir_directory = settings.gir_directory;
+ }
+
+ gir_writer.write_file ((Vala.CodeContext) tree.data, gir_directory, settings.gir_namespace, settings.gir_version, settings.pkg_name);
+ }
public Api.Tree? build (Settings settings, ErrorReporter reporter) {
TreeBuilder builder = new TreeBuilder ();
- Api.Tree? tree = builder.build (settings, reporter);
+ tree = builder.build (settings, reporter);
if (reporter.errors > 0) {
+ tree = null;
return null;
}
diff --git a/src/driver/0.16.x/Makefile.am b/src/driver/0.16.x/Makefile.am
index 7d5b366..a48f821 100755
--- a/src/driver/0.16.x/Makefile.am
+++ b/src/driver/0.16.x/Makefile.am
@@ -33,6 +33,7 @@ libdriver_la_VALASOURCES = \
initializerbuilder.vala \
symbolresolver.vala \
treebuilder.vala \
+ girwriter.vala \
driver.vala \
$(NULL)
diff --git a/src/driver/0.16.x/driver.vala b/src/driver/0.16.x/driver.vala
index 6fc87d9..35d43d1 100755
--- a/src/driver/0.16.x/driver.vala
+++ b/src/driver/0.16.x/driver.vala
@@ -29,15 +29,29 @@ using Gee;
* Creates an simpler, minimized, more abstract AST for valacs AST.
*/
public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
+ private SymbolResolver resolver;
+ private Api.Tree? tree;
+
+ public void write_gir (Settings settings, ErrorReporter reporter) {
+ var gir_writer = new Drivers.GirWriter (resolver);
+
+ // put .gir file in current directory unless -d has been explicitly specified
+ string gir_directory = ".";
+ if (settings.gir_directory != null) {
+ gir_directory = settings.gir_directory;
+ }
+
+ gir_writer.write_file ((Vala.CodeContext) tree.data, gir_directory, settings.gir_namespace, settings.gir_version, settings.pkg_name);
+ }
public Api.Tree? build (Settings settings, ErrorReporter reporter) {
TreeBuilder builder = new TreeBuilder ();
- Api.Tree? tree = builder.build (settings, reporter);
+ tree = builder.build (settings, reporter);
if (reporter.errors > 0) {
return null;
}
- SymbolResolver resolver = new SymbolResolver (builder);
+ resolver = new SymbolResolver (builder);
tree.accept (resolver);
return tree;
diff --git a/src/driver/0.16.x/girwriter.vala b/src/driver/0.16.x/girwriter.vala
new file mode 100644
index 0000000..12762d1
--- /dev/null
+++ b/src/driver/0.16.x/girwriter.vala
@@ -0,0 +1,203 @@
+/* girwriter.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo brosch gmail com>
+ */
+
+
+using Valadoc.Api;
+
+
+/**
+ * Code visitor generating .gir file for the public interface.
+ */
+public class Valadoc.Drivers.GirWriter : Vala.GIRWriter {
+ private GtkdocRenderer renderer;
+ private SymbolResolver resolver;
+
+ public GirWriter (SymbolResolver resolver) {
+ this.renderer = new GtkdocRenderer ();
+ this.resolver = resolver;
+ }
+
+ private string? translate (Content.Comment? documentation) {
+ if (documentation == null) {
+ return null;
+ }
+
+ renderer.render_symbol (documentation);
+
+ return MarkupWriter.escape (renderer.content);
+ }
+
+ private string? translate_taglet (Content.Taglet? taglet) {
+ if (taglet == null) {
+ return null;
+ }
+
+ renderer.render_children (taglet);
+
+ return MarkupWriter.escape (renderer.content);
+ }
+
+ protected override string? get_interface_comment (Vala.Interface viface) {
+ Interface iface = resolver.resolve (viface) as Interface;
+ return translate (iface.documentation);
+ }
+
+ protected override string? get_struct_comment (Vala.Struct vst) {
+ Struct st = resolver.resolve (vst) as Struct;
+ return translate (st.documentation);
+ }
+
+ protected override string? get_enum_comment (Vala.Enum ven) {
+ Enum en = resolver.resolve (ven) as Enum;
+ return translate (en.documentation);
+ }
+
+ protected override string? get_class_comment (Vala.Class vc) {
+ Class c = resolver.resolve (vc) as Class;
+ return translate (c.documentation);
+ }
+
+ protected override string? get_error_code_comment (Vala.ErrorCode vecode) {
+ ErrorCode ecode = resolver.resolve (vecode) as ErrorCode;
+ return translate (ecode.documentation);
+ }
+
+ protected override string? get_enum_value_comment (Vala.EnumValue vev) {
+ Api.EnumValue ev = resolver.resolve (vev) as Api.EnumValue;
+ return translate (ev.documentation);
+ }
+
+ protected override string? get_constant_comment (Vala.Constant vc) {
+ Constant c = resolver.resolve (vc) as Constant;
+ return translate (c.documentation);
+ }
+
+ protected override string? get_error_domain_comment (Vala.ErrorDomain vedomain) {
+ ErrorDomain edomain = resolver.resolve (vedomain) as ErrorDomain;
+ return translate (edomain.documentation);
+ }
+
+ protected override string? get_field_comment (Vala.Field vf) {
+ Field f = resolver.resolve (vf) as Field;
+ return translate (f.documentation);
+ }
+
+ protected override string? get_delegate_comment (Vala.Delegate vcb) {
+ Delegate cb = resolver.resolve (vcb) as Delegate;
+ return translate (cb.documentation);
+ }
+
+ protected override string? get_method_comment (Vala.Method vm) {
+ Method m = resolver.resolve (vm) as Method;
+ return translate (m.documentation);
+ }
+
+ protected override string? get_property_comment (Vala.Property vprop) {
+ Property prop = resolver.resolve (vprop) as Property;
+ return translate (prop.documentation);
+ }
+
+ protected override string? get_delegate_return_comment (Vala.Delegate vcb) {
+ Delegate cb = resolver.resolve (vcb) as Delegate;
+ if (cb.documentation == null) {
+ return null;
+ }
+
+ Content.Comment? documentation = cb.documentation;
+ if (documentation == null) {
+ return null;
+ }
+
+ Gee.List<Content.Taglet> taglets = documentation.find_taglets (cb, typeof(Taglets.Return));
+ foreach (Content.Taglet taglet in taglets) {
+ return translate_taglet (taglet);
+ }
+
+ return null;
+ }
+
+ protected override string? get_signal_return_comment (Vala.Signal vsig) {
+ Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
+ if (sig.documentation == null) {
+ return null;
+ }
+
+ Content.Comment? documentation = sig.documentation;
+ if (documentation == null) {
+ return null;
+ }
+
+ Gee.List<Content.Taglet> taglets = documentation.find_taglets (sig, typeof(Taglets.Return));
+ foreach (Content.Taglet taglet in taglets) {
+ return translate_taglet (taglet);
+ }
+
+ return null;
+ }
+
+ protected override string? get_method_return_comment (Vala.Method vm) {
+ Method m = resolver.resolve (vm) as Method;
+ if (m.documentation == null) {
+ return null;
+ }
+
+ Content.Comment? documentation = m.documentation;
+ if (documentation == null) {
+ return null;
+ }
+
+ Gee.List<Content.Taglet> taglets = documentation.find_taglets (m, typeof(Taglets.Return));
+ foreach (Content.Taglet taglet in taglets) {
+ return translate_taglet (taglet);
+ }
+
+ return null;
+ }
+
+ protected override string? get_signal_comment (Vala.Signal vsig) {
+ Api.Signal sig = resolver.resolve (vsig) as Api.Signal;
+ return translate (sig.documentation);
+ }
+
+ protected override string? get_parameter_comment (Vala.Parameter param) {
+ Api.Symbol symbol = resolver.resolve (((Vala.Symbol) param.parent_symbol));
+ if (symbol == null) {
+ return null;
+ }
+
+ Content.Comment? documentation = symbol.documentation;
+ if (documentation == null) {
+ return null;
+ }
+
+ Gee.List<Content.Taglet> taglets = documentation.find_taglets (symbol, typeof(Taglets.Param));
+ foreach (Content.Taglet _taglet in taglets) {
+ Taglets.Param taglet = (Taglets.Param) _taglet;
+ if (taglet.parameter_name == param.name) {
+ return translate_taglet (taglet);
+ }
+ }
+
+ return null;
+ }
+}
+
diff --git a/src/driver/0.16.x/symbolresolver.vala b/src/driver/0.16.x/symbolresolver.vala
index bd3163f..f548f73 100644
--- a/src/driver/0.16.x/symbolresolver.vala
+++ b/src/driver/0.16.x/symbolresolver.vala
@@ -34,7 +34,7 @@ public class Valadoc.Drivers.SymbolResolver : Visitor {
this.glib_error = builder.get_glib_error ();
}
- private Symbol? resolve (Vala.Symbol symbol) {
+ public Symbol? resolve (Vala.Symbol symbol) {
return symbol_map.get (symbol);
}
diff --git a/src/driver/0.16.x/treebuilder.vala b/src/driver/0.16.x/treebuilder.vala
index 3687610..353119e 100644
--- a/src/driver/0.16.x/treebuilder.vala
+++ b/src/driver/0.16.x/treebuilder.vala
@@ -1137,11 +1137,12 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
//
public Api.Tree? build (Settings settings, ErrorReporter reporter) {
- this.tree = new Api.Tree (reporter, settings);
this.settings = settings;
this.reporter = reporter;
+ this.tree = new Api.Tree (reporter, settings);
var context = create_valac_tree (settings);
+ this.tree.data = context;
reporter.warnings_offset = context.report.get_warnings ();
reporter.errors_offset = context.report.get_errors ();
diff --git a/src/libvaladoc/api/driver.vala b/src/libvaladoc/api/driver.vala
index 8ad4a5e..a43abcf 100755
--- a/src/libvaladoc/api/driver.vala
+++ b/src/libvaladoc/api/driver.vala
@@ -35,6 +35,7 @@ public delegate Type Valadoc.DriverRegisterFunction (ModuleLoader module_loader)
public interface Valadoc.Driver : Object {
+ public abstract void write_gir (Settings settings, ErrorReporter reporter);
public abstract Api.Tree? build (Settings settings, ErrorReporter reporter);
}
diff --git a/src/libvaladoc/api/tree.vala b/src/libvaladoc/api/tree.vala
index 0133b0b..d4da906 100755
--- a/src/libvaladoc/api/tree.vala
+++ b/src/libvaladoc/api/tree.vala
@@ -44,6 +44,11 @@ public class Valadoc.Api.Tree {
this.packages.add (package);
}
+ public void* data {
+ set;
+ get;
+ }
+
/**
* The root of the wiki tree.
*/
@@ -196,9 +201,10 @@ public class Valadoc.Api.Tree {
return params;
}
- public Tree (ErrorReporter reporter, Settings settings) {
+ public Tree (ErrorReporter reporter, Settings settings, void* data = null) {
this.settings = settings;
this.reporter = reporter;
+ this.data = data;
}
// copied from valacodecontext.vala
diff --git a/src/libvaladoc/devhelp-markupwriter.vala b/src/libvaladoc/devhelp-markupwriter.vala
index 4a0b2b5..2b84651 100755
--- a/src/libvaladoc/devhelp-markupwriter.vala
+++ b/src/libvaladoc/devhelp-markupwriter.vala
@@ -21,8 +21,12 @@
*/
public class Valadoc.Devhelp.MarkupWriter : Valadoc.MarkupWriter {
- public MarkupWriter (FileStream stream, bool xml_declaration = true) {
- base (stream, xml_declaration);
+
+ public MarkupWriter (FileStream stream, bool xml_declaration = true) {
+ // avoid broken implicit copy
+ unowned FileStream _stream = stream;
+
+ base ((str) => { _stream.printf (str); }, xml_declaration);
}
protected override bool inline_element (string name) {
diff --git a/src/libvaladoc/documentation/gtkdoccommentparser.vala b/src/libvaladoc/documentation/gtkdoccommentparser.vala
index e9873e4..a376d40 100644
--- a/src/libvaladoc/documentation/gtkdoccommentparser.vala
+++ b/src/libvaladoc/documentation/gtkdoccommentparser.vala
@@ -418,7 +418,7 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
return item;
}
- private LinkedList<Block>? parse_docbook_information_box_template (string tagname) {
+ private BlockContent? parse_docbook_information_box_template (string tagname, BlockContent container) {
if (!check_xml_open_tag (tagname)) {
this.report_unexpected_token (current, "<%s>".printf (tagname));
return null;
@@ -427,60 +427,39 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
next ();
parse_docbook_spaces ();
- LinkedList<Block> content = new LinkedList<Block> ();
-
- var header_run = factory.create_run (Run.Style.BOLD);
- header_run.content.add (factory.create_text ("Note:"));
-
+ Token tmp = null;
while (current.type != TokenType.XML_CLOSE && current.type != TokenType.EOF) {
- if (current.type == TokenType.XML_OPEN && current.content == "para") {
- var paragraphs = parse_docbook_para ();
- if (header_run != null) {
- content.add_all (paragraphs);
- } else {
- Paragraph fp = paragraphs.first ();
- fp.content.insert (0, factory.create_text (" "));
- fp.content.insert (0, header_run);
- }
- } else {
- Token tmp_t = current;
-
- Run? inline_run = parse_inline_content ();
+ tmp = current;
+ var ic = parse_inline_content ();
+ if (ic != null && ic.content.size > 0) {
Paragraph p = factory.create_paragraph ();
-
- if (content != null) {
- p.content.add (header_run);
- p.content.add (factory.create_text (" "));
- header_run = null;
- }
-
- p.content.add (inline_run);
- content.add (p);
+ p.content.add (ic);
+ container.content.add (p);
+ }
- if (tmp_t == current) {
- break;
- }
+ var bc = parse_block_content ();
+ if (bc != null && bc.size > 0) {
+ container.content.add_all (bc);
}
}
- //parse_block_content ();
parse_docbook_spaces ();
if (!check_xml_close_tag (tagname)) {
this.report_unexpected_token (current, "</%s>".printf (tagname));
- return content;
+ return container;
}
next ();
- return content;
+ return container;
}
- private LinkedList<Block>? parse_docbook_note () {
- return parse_docbook_information_box_template ("note");
+ private Note? parse_docbook_note () {
+ return (Note?) parse_docbook_information_box_template ("note", factory.create_note ());
}
- private LinkedList<Block>? parse_docbook_warning () {
- return parse_docbook_information_box_template ("warning");
+ private Warning? parse_docbook_warning () {
+ return (Warning?) parse_docbook_information_box_template ("warning", factory.create_warning ());
}
private Content.List? parse_docbook_itemizedlist () {
@@ -871,9 +850,9 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
} else if (current.type == TokenType.XML_OPEN && current.content == "example") {
this.append_block_content_not_null_all (content, parse_docbook_example ());
} else if (current.type == TokenType.XML_OPEN && current.content == "warning") {
- this.append_block_content_not_null_all (content, parse_docbook_warning ());
+ this.append_block_content_not_null (content, parse_docbook_warning ());
} else if (current.type == TokenType.XML_OPEN && current.content == "note") {
- this.append_block_content_not_null_all (content, parse_docbook_note ());
+ this.append_block_content_not_null (content, parse_docbook_note ());
} else if (current.type == TokenType.XML_OPEN && current.content == "refsect2") {
this.append_block_content_not_null_all (content, parse_docbook_refsect2 ());
} else if (current.type == TokenType.GTKDOC_PARAGRAPH) {
diff --git a/src/libvaladoc/gtkdocmarkupwriter.vala b/src/libvaladoc/gtkdocmarkupwriter.vala
new file mode 100644
index 0000000..1e72767
--- /dev/null
+++ b/src/libvaladoc/gtkdocmarkupwriter.vala
@@ -0,0 +1,73 @@
+/* gtkdocmarkupwriter.vala
+ *
+ * Copyright (C) 2012 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo brosch gmail com>
+ */
+
+
+
+public class Valadoc.GtkDocMarkupWriter : Valadoc.MarkupWriter {
+ private unowned StringBuilder builder;
+
+ public void reset () {
+ last_was_tag = true;
+ current_column = 0;
+ builder.erase ();
+ indent = -1;
+ }
+
+ public unowned string content {
+ get { return builder.str; }
+ }
+
+ public GtkDocMarkupWriter () {
+ StringBuilder builder = new StringBuilder ();
+ base ((str) => { builder.append (str); }, false);
+ this.builder = builder;
+ }
+
+ protected override bool inline_element (string name) {
+ return name != "para"
+ && name != "programlisting"
+ && name != "table"
+ && name != "example"
+ && name != "figure"
+ && name != "tr"
+ && name != "td"
+ && name != "mediaobject"
+ && name != "imageobject"
+ && name != "textobject"
+ && name != "listitem"
+ && name != "orderedlist"
+ && name != "itemizedlist"
+ && name != "title";
+ }
+
+ protected override bool content_inline_element (string name) {
+ return name == "para"
+ || name == "programlisting"
+ || name == "emphasis"
+ || name == "blockquote"
+ || name == "ulink"
+ || name == "listitem"
+ || name == "title";
+ }
+}
+
+
diff --git a/src/libvaladoc/gtkdocrenderer.vala b/src/libvaladoc/gtkdocrenderer.vala
new file mode 100644
index 0000000..a0c3156
--- /dev/null
+++ b/src/libvaladoc/gtkdocrenderer.vala
@@ -0,0 +1,470 @@
+/* gtkdocrenderer.vala
+ *
+ * Copyright (C) 2011 Florian Brosch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Florian Brosch <flo brosch gmail com>
+ */
+
+using GLib;
+using Valadoc.Content;
+
+public class Valadoc.GtkdocRenderer : ContentRenderer {
+ private GtkDocMarkupWriter writer = new GtkDocMarkupWriter ();
+ protected Settings settings;
+ private bool separated;
+
+ private string? get_cname (Api.Item item) {
+ if (item is Api.Method) {
+ return ((Api.Method)item).get_cname ();
+ } else if (item is Api.FormalParameter) {
+ return ((Api.FormalParameter)item).name;
+ } else if (item is Api.Constant) {
+ return ((Api.Constant)item).get_cname ();
+ } else if (item is Api.Property) {
+ return ((Api.Property)item).get_cname ();
+ } else if (item is Api.Signal) {
+ var name = ((Api.Signal)item).get_cname ();
+ return name.replace ("_", "-");
+ } else if (item is Api.Class) {
+ return ((Api.Class)item).get_cname ();
+ } else if (item is Api.Struct) {
+ return ((Api.Struct)item).get_cname ();
+ } else if (item is Api.Interface) {
+ return ((Api.Interface)item).get_cname ();
+ } else if (item is Api.ErrorDomain) {
+ return ((Api.ErrorDomain)item).get_cname ();
+ } else if (item is Api.ErrorCode) {
+ return ((Api.ErrorCode)item).get_cname ();
+ } else if (item is Api.Delegate) {
+ return ((Api.Delegate)item).get_cname ();
+ } else if (item is Api.Enum) {
+ return ((Api.Enum)item).get_cname ();
+ } else if (item is Api.EnumValue) {
+ return ((Api.EnumValue)item).get_cname ();
+ }
+
+ return null;
+ }
+
+ public void write_docbook_link (Api.Item item) {
+ if (item is Api.Method) {
+ writer.start_tag ("function").text (((Api.Method)item).get_cname ()).end_tag ("function");
+ } else if (item is Api.FormalParameter) {
+ writer.start_tag ("parameter").text (((Api.FormalParameter)item).name ?? "...").end_tag ("parameter");
+ } else if (item is Api.Constant) {
+ writer.start_tag ("constant").text (((Api.Constant)item).get_cname ()).end_tag ("constant");
+ } else if (item is Api.Property) {
+ // TODO: use docbook-tags instead
+ writer.text ("#").text (get_cname(item.parent)).text (":").text (((Api.Property)item).get_cname ().replace ("_", "-"));
+ } else if (item is Api.Signal) {
+ // TODO: use docbook-tags instead
+ writer.text ("#").text (get_cname(item.parent)).text ("::").text (((Api.Signal)item).get_cname ().replace ("_", "-"));
+ } else if (item is Api.Namespace) {
+ writer.text (((Api.Namespace) item).get_full_name ());
+ } else {
+ writer.start_tag ("type").text (get_cname (item)).end_tag ("type");
+ }
+ }
+
+ public GtkdocRenderer () {
+ }
+
+ public override void render (ContentElement element) {
+ reset ();
+ element.accept (this);
+ }
+
+ public void render_symbol (Content.Comment? documentation) {
+ render (documentation);
+
+ append_exceptions (documentation.find_taglets (null, typeof(Taglets.Throws)));
+ append_see (documentation.find_taglets (null, typeof(Taglets.See)));
+ append_since (documentation.find_taglets (null, typeof(Taglets.Since)));
+ append_deprecated (documentation.find_taglets (null, typeof(Taglets.Deprecated)));
+ }
+
+ public override void render_children (ContentElement element) {
+ reset ();
+ element.accept_children (this);
+ }
+
+ private void reset () {
+ separated = false;
+ writer.reset ();
+ }
+
+ public unowned string content {
+ get {
+ if (writer.content.has_prefix ("\n")) {
+ return writer.content.next_char ();
+ }
+
+ return writer.content;
+ }
+ }
+
+ public override void visit_comment (Comment element) {
+ element.accept_children (this);
+ }
+
+ public override void visit_embedded (Embedded element) {
+ writer.start_tag ("figure");
+ if (element.caption != null) {
+ writer.start_tag ("title").text (element.caption).end_tag ("title");
+ }
+
+ writer.start_tag ("mediaobject");
+
+ writer.start_tag ("imageobject").simple_tag ("imagedata", {"fileref", element.url}).end_tag ("imageobject");
+
+ if (element.caption != null) {
+ writer.start_tag ("textobject").start_tag ("phrase").text (element.caption).end_tag ("phrase").end_tag ("textobject");
+ }
+
+ writer.end_tag ("mediaobject");
+ writer.end_tag ("figure");
+ }
+
+ public override void visit_headline (Headline element) {
+ assert_not_reached ();
+ }
+
+ public override void visit_wiki_link (WikiLink element) {
+ // wiki pages are not supported by gir
+ if (element.content.size > 0) {
+ element.accept_children (this);
+ } else {
+ write_string (element.name);
+ }
+ }
+
+ public override void visit_link (Link element) {
+ writer.start_tag ("ulink", {"url", element.url});
+ element.accept_children (this);
+ writer.end_tag ("ulink");
+ }
+
+ public override void visit_symbol_link (SymbolLink element) {
+ if (element.symbol == null) {
+ writer.text (element.label);
+ } else {
+ write_docbook_link (element.symbol);
+ }
+ }
+
+ public override void visit_list (Content.List element) {
+ string tag = "orderedlist";
+ switch (element.bullet) {
+ case Content.List.Bullet.NONE:
+ writer.start_tag ("itemizedlist", {"mark", "none"});
+ tag = "itemizedlist";
+ break;
+
+ case Content.List.Bullet.UNORDERED:
+ writer.start_tag ("itemizedlist");
+ tag = "itemizedlist";
+ break;
+
+ case Content.List.Bullet.ORDERED:
+ writer.start_tag ("orderedlist");
+ break;
+
+ case Content.List.Bullet.ORDERED_NUMBER:
+ writer.start_tag ("orderedlist", {"numeration", "arabic"});
+ break;
+
+ case Content.List.Bullet.ORDERED_LOWER_CASE_ALPHA:
+ writer.start_tag ("orderedlist", {"numeration", "loweralpha"});
+ break;
+
+ case Content.List.Bullet.ORDERED_UPPER_CASE_ALPHA:
+ writer.start_tag ("orderedlist", {"numeration", "upperalpha"});
+ break;
+
+ case Content.List.Bullet.ORDERED_LOWER_CASE_ROMAN:
+ writer.start_tag ("orderedlist", {"numeration", "lowerroman"});
+ break;
+
+ case Content.List.Bullet.ORDERED_UPPER_CASE_ROMAN:
+ writer.start_tag ("orderedlist", {"numeration", "upperroman"});
+ break;
+
+ default:
+ assert_not_reached ();
+ }
+
+ element.accept_children (this);
+
+ writer.end_tag (tag);
+ }
+
+ public override void visit_list_item (ListItem element) {
+ writer.start_tag ("listitem");
+ element.accept_children (this);
+ writer.end_tag ("listitem");
+ }
+
+ public override void visit_page (Page element) {
+ element.accept_children (this);
+ }
+
+ public override void visit_paragraph (Paragraph element) {
+ writer.start_tag ("para");
+ element.accept_children (this);
+ writer.end_tag ("para");
+ }
+
+ public override void visit_warning (Warning element) {
+ writer.start_tag ("warning");
+ element.accept_children (this);
+ writer.end_tag ("warning");
+ }
+
+ public override void visit_note (Note element) {
+ writer.start_tag ("note");
+ element.accept_children (this);
+ writer.end_tag ("note");
+ }
+
+ public override void visit_run (Run element) {
+ string? tag = null;
+
+ switch (element.style) {
+ case Run.Style.BOLD:
+ writer.start_tag ("emphasis", {"role", "bold"});
+ tag = "emphasis";
+ break;
+
+ case Run.Style.ITALIC:
+ writer.start_tag ("emphasis");
+ tag = "emphasis";
+ break;
+
+ case Run.Style.UNDERLINED:
+ writer.start_tag ("emphasis", {"role", "underline"});
+ tag = "emphasis";
+ break;
+
+ case Run.Style.MONOSPACED:
+ writer.start_tag ("blockquote");
+ tag = "blockquote";
+ break;
+ }
+
+ element.accept_children (this);
+
+ if (tag != null) {
+ writer.end_tag (tag);
+ }
+ }
+
+ public override void visit_source_code (SourceCode element) {
+ writer.start_tag ("example").start_tag ("programlisting");
+ writer.text (element.code);
+ writer.end_tag ("programlisting").end_tag ("example");
+ }
+
+ public override void visit_table (Table element) {
+ writer.start_tag ("table", {"align", "center"});
+ element.accept_children (this);
+ writer.end_tag ("table");
+ }
+
+ public override void visit_table_cell (TableCell element) {
+ writer.start_tag ("td", {"colspan", element.colspan.to_string (), "rowspan", element.rowspan.to_string ()});
+ element.accept_children (this);
+ writer.end_tag ("td");
+ }
+
+ public override void visit_table_row (TableRow element) {
+ writer.start_tag ("tr");
+ element.accept_children (this);
+ writer.end_tag ("tr");
+ }
+
+ public override void visit_text (Text element) {
+ write_string (element.content);
+ }
+
+ private void write_string (string content) {
+ unichar chr = content[0];
+ long lpos = 0;
+ int i = 0;
+
+ for (i = 0; chr != '\0' ; i++, chr = content[i]) {
+ switch (chr) {
+ case '#':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.simple_tag ("#");
+ lpos = i+1;
+ break;
+ case '%':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.simple_tag ("%");
+ lpos = i+1;
+ break;
+ case '@':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.simple_tag ("@");
+ lpos = i+1;
+ break;
+ case '(':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.simple_tag ("(");
+ lpos = i+1;
+ break;
+ case ')':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.simple_tag (")");
+ lpos = i+1;
+ break;
+ case '"':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.simple_tag (""");
+ lpos = i+1;
+ break;
+ case '\n':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.simple_tag ("br");
+ lpos = i+1;
+ break;
+ case '<':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.text ("<");
+ lpos = i+1;
+ break;
+ case '>':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.text (">");
+ lpos = i+1;
+ break;
+ case '&':
+ writer.text (content.substring (lpos, i-lpos));
+ writer.text ("&");
+ lpos = i+1;
+ break;
+ }
+ }
+ writer.text (content.substring (lpos, i-lpos));
+ }
+
+ public void append_since (Gee.List<Content.Taglet> taglets) {
+ foreach (Content.Taglet _taglet in taglets) {
+ Taglets.Since taglet = _taglet as Taglets.Since;
+ if (taglet == null || taglet.version == null) {
+ // ignore unexpected taglets
+ continue ;
+ }
+
+ if (separated == false) {
+ writer.text ("\n");
+ }
+
+ writer.set_wrap (false);
+ writer.text ("\nSince: ").text (taglet.version);
+ writer.set_wrap (true);
+ separated = true;
+
+ // ignore multiple occurrences
+ return ;
+ }
+ }
+
+ public void append_deprecated (Gee.List<Content.Taglet> taglets) {
+ foreach (Content.Taglet _taglet in taglets) {
+ Taglets.Deprecated taglet = _taglet as Taglets.Deprecated;
+ if (taglet == null) {
+ // ignore unexpected taglets
+ continue ;
+ }
+
+ if (separated == false) {
+ writer.text ("\n");
+ }
+
+ writer.set_wrap (false);
+ writer.text ("\nDeprecated: ");
+ taglet.accept_children (this);
+ writer.text (": ");
+ separated = true;
+ writer.set_wrap (true);
+
+ // ignore multiple occurrences
+ return ;
+ }
+ }
+
+ public void append_see (Gee.List<Content.Taglet> taglets) {
+ bool first = true;
+ foreach (Content.Taglet _taglet in taglets) {
+ Taglets.See taglet = _taglet as Taglets.See;
+ if (taglet == null || taglet.symbol == null) {
+ // ignore unexpected taglets
+ continue ;
+ }
+
+ if (first) {
+ writer.start_tag ("para").text ("See also: ");
+ } else {
+ writer.text (", ");
+ }
+
+ write_docbook_link (taglet.symbol);
+ first = false;
+ }
+
+ if (first == false) {
+ writer.end_tag ("para");
+ }
+ }
+
+ public void append_exceptions (Gee.List<Content.Taglet> taglets) {
+ bool first = true;
+ foreach (Content.Taglet _taglet in taglets) {
+ Taglets.Throws taglet = _taglet as Taglets.Throws;
+ if (taglet == null || taglet.error_domain == null) {
+ // ignore unexpected taglets
+ continue ;
+ }
+
+ if (first) {
+ writer.start_tag ("para").text ("This function may throw:").end_tag ("para");
+ writer.start_tag ("table");
+ }
+
+ writer.start_tag ("tr");
+
+ writer.start_tag ("td");
+ write_docbook_link (taglet.error_domain);
+ writer.end_tag ("td");
+
+ writer.start_tag ("td");
+ taglet.accept_children (this);
+ writer.end_tag ("td");
+
+ writer.end_tag ("tr");
+
+ first = false;
+ }
+
+ if (first == false) {
+ writer.end_tag ("table");
+ }
+ }
+}
+
diff --git a/src/libvaladoc/html/htmlrenderer.vala b/src/libvaladoc/html/htmlrenderer.vala
index c6148ae..2235380 100755
--- a/src/libvaladoc/html/htmlrenderer.vala
+++ b/src/libvaladoc/html/htmlrenderer.vala
@@ -344,9 +344,9 @@ public class Valadoc.Html.HtmlRenderer : ContentRenderer {
private void visit_notification_block (BlockContent element, string headline) {
writer.start_tag ("div", {"class", "main_notification_block"});
writer.start_tag ("span", {"class", "main_block_headline"}).text (headline).end_tag ("span").text (" ");
- writer.start_tag ("span", {"class", "main_block_content"});
+ writer.start_tag ("div", {"class", "main_block_content"});
element.accept_children (this);
- writer.end_tag ("span");
+ writer.end_tag ("div");
writer.end_tag ("div");
}
diff --git a/src/libvaladoc/markupwriter.vala b/src/libvaladoc/markupwriter.vala
index 02a42cf..7472d02 100755
--- a/src/libvaladoc/markupwriter.vala
+++ b/src/libvaladoc/markupwriter.vala
@@ -25,22 +25,70 @@
* Writes markups and text to a file.
*/
public class Valadoc.MarkupWriter {
- protected unowned FileStream stream;
+ protected WriteFunc write;
protected int indent;
- private long current_column = 0;
- private bool last_was_tag;
+
+ protected long current_column = 0;
+ protected bool last_was_tag;
private bool wrap = true;
+ public static string escape (string txt) {
+ StringBuilder builder = new StringBuilder ();
+ unowned string start = txt;
+ unowned string pos;
+ unichar c;
+
+ for (pos = txt; (c = pos.get_char ()) != '\0' ; pos = pos.next_char ()) {
+ switch (c) {
+ case '"':
+ builder.append_len (start, (ssize_t) ((char*) pos - (char*) start));
+ builder.append (""");
+ start = pos.next_char ();
+ break;
+
+ case '<':
+ builder.append_len (start, (ssize_t) ((char*) pos - (char*) start));
+ builder.append ("<");
+ start = pos.next_char ();
+ break;
+
+ case '>':
+ builder.append_len (start, (ssize_t) ((char*) pos - (char*) start));
+ builder.append (">");
+ start = pos.next_char ();
+ break;
+
+ case '&':
+ builder.append_len (start, (ssize_t) ((char*) pos - (char*) start));
+ builder.append ("&");
+ start = pos.next_char ();
+ break;
+ }
+ }
+
+ if (&txt == &start) {
+ return txt;
+ } else {
+ builder.append_len (start, (ssize_t) ((char*) pos - (char*) start));
+ return (owned) builder.str;
+ }
+ }
+
+ /**
+ * Writes text to a desination like a { link StringBuilder} or a { link FileStream}
+ */
+ public delegate void WriteFunc (string text);
+
private const int MAX_COLUMN = 150;
/**
* Initializes a new instance of the MarkupWriter
*
- * @param stream a file stream
+ * @param stream a WriteFunc
* @param xml_delcaration specifies whether this file starts with an xml-declaration
*/
- public MarkupWriter (FileStream stream, bool xml_declaration = true) {
- this.stream = stream;
+ public MarkupWriter (owned WriteFunc write, bool xml_declaration = true) {
+ this.write = (owned) write;
if (xml_declaration) {
do_write ("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
}
@@ -180,8 +228,8 @@ public class Valadoc.MarkupWriter {
}
private void break_line () {
- stream.printf ("\n");
- stream.printf (string.nfill (indent * 2, ' '));
+ write ("\n");
+ write (string.nfill (indent * 2, ' '));
current_column = indent * 2;
}
@@ -189,14 +237,14 @@ public class Valadoc.MarkupWriter {
if (wrap && current_column + text.length > MAX_COLUMN) {
break_line ();
}
- stream.printf (text);
+ write (text);
current_column += text.length;
}
private void check_column (string name, bool end_tag = false) {
if (!wrap) {
return;
- } else if (!end_tag && inline_element (name) && !last_was_tag) {
+ } else if (!end_tag && inline_element (name) /*&& !last_was_tag*/) {
return;
} else if (end_tag && content_inline_element (name)) {
return;
diff --git a/src/libvaladoc/settings.vala b/src/libvaladoc/settings.vala
index 5237fab..afbdbfd 100755
--- a/src/libvaladoc/settings.vala
+++ b/src/libvaladoc/settings.vala
@@ -126,6 +126,15 @@ public class Valadoc.Settings : Object {
*/
public string[] source_files;
+ /**
+ * GObject-Introspection directory
+ */
+ public string? gir_directory;
+
+ /**
+ * GObject-Introspection repository file name
+ */
+ public string? gir_name;
/**
* A list of all metadata directories
@@ -136,6 +145,10 @@ public class Valadoc.Settings : Object {
* A list of all gir directories.
*/
public string[] gir_directories;
+
+ public string gir_namespace;
+
+ public string gir_version;
}
diff --git a/src/valadoc/valadoc.vala b/src/valadoc/valadoc.vala
index de99f42..e284e44 100755
--- a/src/valadoc/valadoc.vala
+++ b/src/valadoc/valadoc.vala
@@ -35,8 +35,12 @@ public class ValaDoc : Object {
private static string docletpath = null;
[CCode (array_length = false, array_null_terminated = true)]
private static string[] pluginargs;
+ private static string gir_directory = null;
private static string directory = null;
private static string pkg_name = null;
+ private static string gir_name = null;
+ private static string gir_namespace = null;
+ private static string gir_version = null;
private static string driverpath = null;
private static bool add_inherited = false;
@@ -102,6 +106,7 @@ public class ValaDoc : Object {
{ "package-name", 0, 0, OptionArg.STRING, ref pkg_name, "package name", "NAME" },
{ "package-version", 0, 0, OptionArg.STRING, ref pkg_version, "package version", "VERSION" },
+ { "gir", 0, 0, OptionArg.STRING, ref gir_name, "GObject-Introspection repository file name", "NAME-VERSION.gir" },
{ "version", 0, 0, OptionArg.NONE, ref version, "Display version number", null },
@@ -302,6 +307,15 @@ public class ValaDoc : Object {
// settings:
var settings = new Valadoc.Settings ();
settings.pkg_name = this.get_pkg_name ();
+ settings.gir_namespace = this.gir_namespace;
+ settings.gir_version = this.gir_version;
+ if (this.gir_name != null) {
+ settings.gir_name = GLib.Path.get_basename (this.gir_name);
+ settings.gir_directory = GLib.Path.get_dirname (this.gir_name);
+ if (settings.gir_directory == "") {
+ settings.gir_directory = GLib.Path.get_dirname (this.directory);
+ }
+ }
settings.pkg_version = this.pkg_version;
settings.add_inherited = this.add_inherited;
settings._protected = this._protected;
@@ -368,6 +382,13 @@ public class ValaDoc : Object {
return quit (reporter);
}
+ if (this.gir_name != null) {
+ driver.write_gir (settings, reporter);
+ if (reporter.errors > 0) {
+ return quit (reporter);
+ }
+ }
+
modules.doclet.process (settings, doctree, reporter);
return quit (reporter);
}
@@ -421,6 +442,39 @@ public class ValaDoc : Object {
}
}
+ if (gir_name != null) {
+ long gir_len = gir_name.length;
+ int last_hyphen = gir_name.last_index_of_char ('-');
+
+ if (last_hyphen == -1 || !gir_name.has_suffix (".gir")) {
+ reporter.simple_error ("GIR file name `%s' is not well-formed, expected NAME-VERSION.gir", gir_name);
+ return quit (reporter);
+ }
+
+ gir_namespace = gir_name.substring (0, last_hyphen);
+ gir_version = gir_name.substring (last_hyphen + 1, gir_len - last_hyphen - 5);
+ gir_version.canon ("0123456789.", '?');
+
+ if (gir_namespace == "" || gir_version == "" || !gir_version[0].isdigit () || gir_version.contains ("?")) {
+ reporter.simple_error ("GIR file name `%s' is not well-formed, expected NAME-VERSION.gir", gir_name);
+ return quit (reporter);
+ }
+
+
+ bool report_warning = true;
+ foreach (string source in tsources) {
+ if (source.has_suffix (".vala") || source.has_suffix (".gs")) {
+ report_warning = false;
+ break;
+ }
+ }
+
+ if (report_warning == true) {
+ reporter.simple_error ("No source file specified to be compiled to gir.");
+ return quit (reporter);
+ }
+ }
+
var valadoc = new ValaDoc( );
return valadoc.run (reporter);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]