_devhelpwriter.start_functions ();
foreach (Api.Node node in this.nodes) {
string typekeyword = "";
- if (node is Enum) {
+ if (node is Api.Enum) {
typekeyword = "enum";
- } else if (node is Constant) {
+ } else if (node is Api.Constant) {
typekeyword = "constant";
- } else if (node is Method) {
+ } else if (node is Api.Method) {
typekeyword = "function";
- } else if (node is Field) {
+ } else if (node is Api.Field) {
typekeyword = "variable";
- } else if (node is Property) {
+ } else if (node is Api.Property) {
typekeyword = "property";
} else if (node is Api.Signal) {
typekeyword = "signal";
- } else if (node is Struct) {
+ } else if (node is Api.Struct) {
typekeyword = "struct";
}
process_node (item);
}
- public override void visit_enum ( Enum item) {
+ public override void visit_enum (Api.Enum item) {
process_node (item);
}
GLib.FileStream file = GLib.FileStream.open (GLib.Path.build_filename ( path, "index.htm" ), "w");
writer = new Html.MarkupWriter (file);
_renderer.set_writer (writer);
- write_file_header (this.css_path, pkg_name);
+// write_file_header (this.css_path, pkg_name);
write_navi_package (package);
write_package_content (package, package);
- write_file_footer ();
+// write_file_footer ();
file = null;
package.accept_all_children (this);
process_node (item);
}
- public override void visit_class (Class item) {
+ public override void visit_class (Api.Class item) {
process_node (item);
}
- public override void visit_struct (Struct item) {
+ public override void visit_struct (Api.Struct item) {
process_node (item);
}
- public override void visit_error_domain (ErrorDomain item) {
+ public override void visit_error_domain (Api.ErrorDomain item) {
process_node (item);
}
- public override void visit_enum (Enum item) {
+ public override void visit_enum (Api.Enum item) {
process_node (item);
}
- public override void visit_property (Property item) {
+ public override void visit_property (Api.Property item) {
process_node (item);
}
- public override void visit_constant (Constant item) {
+ public override void visit_constant (Api.Constant item) {
process_node (item);
}
- public override void visit_field (Field item) {
+ public override void visit_field (Api.Field item) {
process_node (item);
}
- public override void visit_error_code (ErrorCode item) {
+ public override void visit_error_code (Api.ErrorCode item) {
process_node (item);
}
process_node (item);
}
- public override void visit_delegate (Delegate item) {
+ public override void visit_delegate (Api.Delegate item) {
process_node (item);
}
process_node (item);
}
- public override void visit_method (Method item) {
+ public override void visit_method (Api.Method item) {
process_node (item);
}
}
}
// avoid exceptions and signal childs
- if (node is Class || node is Struct || node is Enum || node is ErrorDomain || node is Namespace) {
+ if (node is Api.Class || node is Api.Struct || node is Api.Enum || node is Api.ErrorDomain || node is Api.Namespace) {
node.accept_all_children (this);
}
tree.accept_children (this);
}
- public override void visit_package (Package package) {
+ public override void visit_package (Api.Package package) {
string path = GLib.Path.build_filename (this.settings.path, package.name);
DirUtils.create (path, 0777);
file = null;
}
- public override void visit_namespace (Namespace ns) {
+ public override void visit_namespace (Api.Namespace ns) {
process_node (ns, "namespace");
}
- public override void visit_interface (Interface item) {
+ public override void visit_interface (Api.Interface item) {
process_node (item, "interface");
}
- public override void visit_class (Class item) {
+ public override void visit_class (Api.Class item) {
process_node (item, "class");
}
- public override void visit_struct (Struct item) {
+ public override void visit_struct (Api.Struct item) {
process_node (item, "struct");
}
- public override void visit_error_domain (ErrorDomain item) {
+ public override void visit_error_domain (Api.ErrorDomain item) {
process_node (item, "error-domain");
}
- public override void visit_enum (Enum item) {
+ public override void visit_enum (Api.Enum item) {
process_node (item, "enum");
}
- public override void visit_property (Property item) {
+ public override void visit_property (Api.Property item) {
process_node (item, "property");
}
- public override void visit_constant (Constant item) {
+ public override void visit_constant (Api.Constant item) {
process_node (item, "constant");
}
- public override void visit_field (Field item) {
+ public override void visit_field (Api.Field item) {
process_node (item, "field");
}
- public override void visit_error_code (ErrorCode item) {
+ public override void visit_error_code (Api.ErrorCode item) {
process_node (item, "error-code");
}
process_node (item, "enum-value");
}
- public override void visit_delegate (Delegate item) {
+ public override void visit_delegate (Api.Delegate item) {
process_node (item, "delegate");
}
process_node (item, "signal");
}
- public override void visit_method (Method item) {
+ public override void visit_method (Api.Method item) {
process_node (item, "method");
}
}
NULL =
+globalvapidir = `pkg-config vala-1.0 --variable vapidir`
+
AM_CFLAGS = \
-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
+ -DPACKAGE_VAPIDIR=\"$(globalvapidir)\" \
$(LIBGVC_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
documentation/documentationparser.vala \
documentation/wiki.vala \
documentation/wikiscanner.vala \
+ importer/documentationimporter.vala \
+ importer/valadocdocumentationimporter.vala \
+ importer/valamarkupreader.vala \
api/array.vala \
api/class.vala \
api/constant.vala \
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 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 --pkg config --library valadoc-1.0 --basedir $(top_srcdir)/src/libvaladoc/ --save-temps $^
touch $@
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
if (this.data_type == null) {
/*TODO:possible?*/;
} else if (this.data_type is Array) {
}
}
- protected TypeReference? base_type {
+ public TypeReference? base_type {
private set;
get;
}
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
var lst = this.vclass.get_base_types ();
this.set_parent_type_references (root, lst);
return ((Vala.Constant) symbol).get_cname ();
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
type_reference.resolve_type_references (root);
}
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
return_type.resolve_type_references (root);
base.resolve_type_references (root);
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
var source_comment = ((Vala.EnumValue) symbol).comment;
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
field_type.resolve_type_references (root);
base.resolve_type_references (root);
visitor.visit_formal_parameter (this);
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
if (ellipsis) {
return;
}
return ((Vala.Interface) symbol).get_cname ();
}
- protected TypeReference? base_type { private set; get; }
+ public TypeReference? base_type { private set; get; }
public override NodeType node_type { get { return NodeType.INTERFACE; } }
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
var prerequisites = ((Vala.Interface) symbol).get_prerequisites ();
this.set_prerequisites (root, prerequisites);
public Item parent { protected set; get; }
- protected virtual void resolve_type_references (Tree root) {
+ internal virtual void resolve_type_references (Tree root) {
}
- protected virtual void process_comments (Settings settings, DocumentationParser parser) {
+ internal virtual void process_comments (Settings settings, DocumentationParser parser) {
}
public Inline signature {
base (symbol, parent);
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
var source_comment = ((Vala.Member) symbol).comment;
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
Vala.Method vala_method = symbol as Vala.Method;
Vala.Method? base_vala_method = null;
if (vala_method.base_method != null) {
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
}
return null;
}
- protected void add_child (Symbol child) {
+ internal void add_child (Symbol child) {
if (child.name != null) {
per_name_children.set (child.name, child);
} else {
children.add (child);
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
foreach (Node node in per_name_children.values) {
node.resolve_type_references (root);
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
do_document = true;
foreach (Node node in per_symbol_children.values) {
}
public Content.Comment? documentation {
- protected set;
+ internal set;
get;
}
}
public override bool is_visitor_accessible (Settings settings) {
- return !( this.is_package && settings.with_deps == false );
+ return !(this.is_package && settings.with_deps == false);
}
public override NodeType node_type { get { return NodeType.PACKAGE; } }
.get ();
}
- protected Namespace get_namespace (Tree root, Vala.Symbol symbol) {
+ internal void import_documentation (string path, Settings settings, DocumentationImporter importer) {
+ importer.process (path, settings, this);
+ }
+
+ internal Namespace get_namespace (Tree root, Vala.Symbol symbol) {
Vala.Symbol namespace_symbol = symbol;
while (!(namespace_symbol is Vala.Namespace)) {
namespace_symbol = namespace_symbol.parent_symbol;
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
Api.Item type = this.data_type;
if (type == null) {
;
public Property base_property { private set; get; }
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
Vala.Property vala_property = symbol as Vala.Property;
Vala.Property? base_vala_property = null;
if (vala_property.base_property != null) {
property_type.resolve_type_references (root);
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
if (getter != null && getter.is_visitor_accessible (settings)) {
getter.process_comments (settings, parser);
}
public TypeReference? return_type { protected set; get; }
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
return_type.resolve_type_references (root);
base.resolve_type_references (root);
base (symbol, parent);
}
- protected TypeReference? base_type { private set; get; }
+ public TypeReference? base_type { private set; get; }
public string? get_cname () {
return ((Vala.Struct) symbol).get_cname();
this.base_type.resolve_type_references (root);
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
this.set_parent_references (root);
base.resolve_type_references (root);
public abstract class Valadoc.Api.Symbol : Node {
- protected Vala.Symbol symbol { private set; get; }
+ internal Vala.Symbol symbol { private set; get; }
public override string? name {
owned get {
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
base.resolve_type_references (root);
foreach (Vala.DataType type in symbol.get_error_types ()) {
private Node? search_relative_to (Node element, string[] path) {
Api.Node? node = element;
+
foreach (string name in path) {
node = node.find_by_name (name);
if (node == null) {
return node;
}
+ public Node? search_symbol_path (Node? element, string[] path) {
+ Api.Node? node = null;
+
+ // relative to element
+ if (element != null) {
+ node = search_relative_to (element, path);
+ if (node != null) {
+ return node;
+ }
+ }
+
+
+ // absolute
+ foreach (Package package in packages) {
+ // search in root namespace
+ node = search_relative_to (package.find_by_name (""), path);
+ if (node != null) {
+ return node;
+ }
+ }
+
+ return null;
+ }
+
public Node? search_symbol_str (Node? element, string symname) {
string[] path = split_name (symname);
- if (element == null) {
- Api.Node? node = null;
- foreach (Package packgage in packages) {
- node = search_relative_to (packgage, path);
- if (node != null) {
- return (Node) node;
- }
- }
- return null;
+ var node = search_symbol_path (element, path);
+ if (node != null) {
+ return node;
+ }
+
+ if (path.length >= 3 && path[path.length-3] == path[path.length-2]) {
+ path[path.length-2] = path[path.length-2]+"."+path[path.length-1];
+ path.resize (path.length-1);
+ return search_symbol_path (element, path);
}
- return (Node) search_relative_to ((Node) element, path);
+ return null;
}
private string[] split_name (string full_name) {
- string[] params = full_name.split (".", -1);
+ string[] params = (full_name).split (".", -1);
int i = 0; while (params[i] != null) i++;
params.length = i;
return params;
return true;
}
+ // copied from valacodecontext.vala
+ private string? get_file_path (string basename, string data_dir, string[] directories) {
+ string filename = null;
+
+ if (directories != null) {
+ foreach (string dir in directories) {
+ filename = Path.build_filename (dir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+ }
+
+ foreach (string dir in Environment.get_system_data_dirs ()) {
+ filename = Path.build_filename (dir, data_dir, basename);
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ return filename;
+ }
+ }
+
+ return null;
+ }
+
+ // copied from valacodecontext.vala
+ private string? get_external_documentation_path (string pkg) {
+ var path = get_file_path (Path.build_filename (pkg, pkg + ".valadoc"), "vala/vapi/documentation", settings.docu_directories);
+
+ if (path == null) {
+ /* last chance: try the package compiled-in vapi dir */
+ var filename = Path.build_filename (Config.vapi_dir, "vapi", "documentation", pkg, pkg + ".valadoc");
+ if (FileUtils.test (filename, FileTest.EXISTS)) {
+ path = filename;
+ }
+ }
+
+ return path;
+ }
public void add_depencies (string[] packages) {
foreach (string package in packages) {
}
}
+ private Package? get_source_package () {
+ foreach (Package pkg in packages) {
+ if (!pkg.is_package) {
+ return pkg;
+ }
+ }
+
+ return null;
+ }
+
+ private void process_wiki (DocumentationParser docparser) {
+ this.wikitree = new WikiPageTree(this.reporter, this.settings);
+ var pkg = get_source_package ();
+ if (pkg != null) {
+ wikitree.create_tree (docparser, pkg);
+ }
+ }
+
// TODO Rename to process_comments
public void parse_comments (DocumentationParser docparser) {
// TODO Move Wiki tree parse to Package
- this.wikitree = new WikiPageTree(this.reporter, this.settings);
- wikitree.create_tree (docparser);
+ process_wiki (docparser);
foreach (Package pkg in this.packages) {
if (pkg.is_visitor_accessible (settings)) {
}
}
+ public void import_documentation (DocumentationImporter importer) {
+ foreach (Package pkg in this.packages) {
+ string? path = (pkg.is_package)? get_external_documentation_path (pkg.name) : null;
+
+ if (pkg.is_visitor_accessible (settings) && path != null) {
+ pkg.import_documentation (path, settings, importer);
+ }
+ }
+
+ }
+
internal Symbol? search_vala_symbol (Vala.Symbol symbol) {
Vala.SourceFile source_file = symbol.source_reference.file;
Package package = find_package_for_file (source_file);
}
}
- protected override void resolve_type_references (Tree root) {
+ internal override void resolve_type_references (Tree root) {
if ( this.vtyperef is Vala.PointerType) {
this.data_type = new Pointer ((Vala.PointerType) this.vtyperef, this);
} else if (vtyperef is Vala.ArrayType) {
}
}
- protected override void process_comments (Settings settings, DocumentationParser parser) {
+ internal override void process_comments (Settings settings, DocumentationParser parser) {
var source_comment = ((Vala.TypeSymbol) symbol).comment;
if (source_comment != null) {
documentation = parser.parse (this, source_comment);
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
foreach (Block element in _content) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
- base.check (api_root, container, reporter);
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
+ base.check (api_root, container, reporter, settings);
foreach (Taglet element in _taglets) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
return (TableRow) configure (new TableRow ());
}
- public Taglet create_taglet (string name) {
+ public Taglet? create_taglet (string name) {
return _modules.create_taglet (name);
}
public HorizontalAlign? horizontal_align { get; set; }
public VerticalAlign? vertical_align { get; set; }
public string? style { get; set; }
+ public Api.Package package;
private ResourceLocator _locator;
_locator = locator;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
- // Check the image exists if it a local resource
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
+ if (!FileUtils.test (url, FileTest.EXISTS | FileTest.IS_REGULAR)) {
+ reporter.simple_error ("%s does not exist".printf (url));
+ } else {
+ package = container.package;
+ }
}
public override void accept (ContentVisitor visitor) {
_level = 0;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// TODO report error if level == 0 ?
+ // TODO: content.size == 0?
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
internal InlineContent () {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
foreach (Inline element in _content) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
public abstract Rule? get_parser_rule (Rule run_rule);
+ public abstract void xml_importer_parer_rule (Xml.DocumentationImporter importer);
+
public abstract ContentElement produce_content ();
private ContentElement get_content () {
this.locator = locator;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
ContentElement element = get_content ();
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
+ //TODO: check url
}
public override void accept (ContentVisitor visitor) {
ORDERED_LOWER_CASE_ALPHA,
ORDERED_UPPER_CASE_ALPHA,
ORDERED_LOWER_CASE_ROMAN,
- ORDERED_UPPER_CASE_ROMAN
+ ORDERED_UPPER_CASE_ROMAN;
+
+ public static Bullet? from_string (string? str) {
+ switch (str) {
+ case "none":
+ return Bullet.NONE;
+
+ case "unordered":
+ return Bullet.UNORDERED;
+
+ case "ordered":
+ return Bullet.ORDERED;
+
+ case "ordered-number":
+ return Bullet.ORDERED_NUMBER;
+
+ case "ordered-lower-case-alpa":
+ return Bullet.ORDERED_LOWER_CASE_ALPHA;
+
+ case "ordered-upper-case-alpha":
+ return Bullet.ORDERED_UPPER_CASE_ALPHA;
+
+ case "ordered-lower-case-roman":
+ return Bullet.ORDERED_LOWER_CASE_ROMAN;
+
+ case "ordered-upper-case-roman":
+ return Bullet.ORDERED_UPPER_CASE_ROMAN;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case Bullet.NONE:
+ return "none";
+
+ case Bullet.UNORDERED:
+ return "unordered";
+
+ case Bullet.ORDERED:
+ return "ordered";
+
+ case Bullet.ORDERED_NUMBER:
+ return "ordered-number";
+
+ case Bullet.ORDERED_LOWER_CASE_ALPHA:
+ return "ordered-lower-case-alpa";
+
+ case Bullet.ORDERED_UPPER_CASE_ALPHA:
+ return "ordered-upper-case-alpha";
+
+ case Bullet.ORDERED_LOWER_CASE_ROMAN:
+ return "ordered-lower-case-roman";
+
+ case Bullet.ORDERED_UPPER_CASE_ROMAN:
+ return "ordered-upper-case-roman";
+ }
+
+ assert (true);
+ return "";
+ }
}
public Bullet bullet { get; set; }
_items = new ArrayList<ListItem> ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check individual list items
foreach (ListItem element in _items) {
- element.check (api_root, container, reporter);
+ element.check (api_root, container, reporter, settings);
}
}
base ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
if (sub_list != null) {
- sub_list.check (api_root, container, reporter);
+ sub_list.check (api_root, container, reporter, settings);
}
}
base ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
LANG_KEYWORD,
LANG_LITERAL,
LANG_BASIC_TYPE,
- LANG_TYPE
+ LANG_TYPE;
+
+ public static Style? from_string (string str) {
+ switch (str) {
+ case "none":
+ return Style.NONE;
+
+ case "bold":
+ return Style.BOLD;
+
+ case "italic":
+ return Style.ITALIC;
+
+ case "underlined":
+ return Style.UNDERLINED;
+
+ case "monospaced":
+ return Style.MONOSPACED;
+
+ case "stroke":
+ return Style.STROKE;
+
+ case "lang-keyword":
+ return Style.LANG_KEYWORD;
+
+ case "lang-literal":
+ return Style.LANG_LITERAL;
+
+ case "lang-basic-type":
+ return Style.LANG_BASIC_TYPE;
+
+ case "lang-type":
+ return Style.LANG_TYPE;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case Style.NONE:
+ return "none";
+
+ case Style.BOLD:
+ return "bold";
+
+ case Style.ITALIC:
+ return "italic";
+
+ case Style.UNDERLINED:
+ return "underlined";
+
+ case Style.MONOSPACED:
+ return "monopace";
+
+ case Style.STROKE:
+ return "stroke";
+
+ case Style.LANG_KEYWORD:
+ return "lang-keyword";
+
+ case Style.LANG_LITERAL:
+ return "lang-literal";
+
+ case Style.LANG_BASIC_TYPE:
+ return "lang-basic-type";
+
+ case Style.LANG_TYPE:
+ return "lang-type";
+ }
+
+ assert (true);
+ return "";
+ }
}
public Style style { get; set; }
_style = style;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
public enum Language {
GENIE,
VALA,
- C
+ C;
+
+ public static Language? from_string (string str) {
+ switch (str) {
+ case "Genie":
+ return Language.GENIE;
+ case "Vala":
+ return Language.VALA;
+ case "C":
+ return Language.C;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case Language.GENIE:
+ return "Genie";
+ case Language.VALA:
+ return "Vala";
+ case Language.C:
+ return "C";
+ }
+
+ assert (true);
+ return "";
+ }
}
public string code { get; set; }
_language = Language.VALA;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
}
public override void accept (ContentVisitor visitor) {
public enum Valadoc.Content.HorizontalAlign {
LEFT,
RIGHT,
- CENTER
+ CENTER;
+
+ public static HorizontalAlign? from_string (string str) {
+ switch (str) {
+ case "left":
+ return HorizontalAlign.LEFT;
+
+ case "right":
+ return HorizontalAlign.RIGHT;
+
+ case "center":
+ return HorizontalAlign.CENTER;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case HorizontalAlign.LEFT:
+ return "left";
+
+ case HorizontalAlign.RIGHT:
+ return "right";
+
+ case HorizontalAlign.CENTER:
+ return "center";
+ }
+
+ assert (true);
+ return "";
+ }
}
public enum Valadoc.Content.VerticalAlign {
TOP,
MIDDLE,
- BOTTOM
+ BOTTOM;
+
+ public static VerticalAlign? from_string (string str) {
+ switch (str) {
+ case "top":
+ return VerticalAlign.TOP;
+
+ case "middle":
+ return VerticalAlign.MIDDLE;
+
+ case "bottom":
+ return VerticalAlign.BOTTOM;
+ }
+
+ return null;
+ }
+
+ public weak string to_string () {
+ switch (this) {
+ case VerticalAlign.TOP:
+ return "top";
+
+ case VerticalAlign.MIDDLE:
+ return "middle";
+
+ case VerticalAlign.BOTTOM:
+ return "bottom";
+ }
+
+ assert (true);
+ return "";
+ }
}
public interface Valadoc.Content.StyleAttributes : ContentElement {
public override void configure (Settings settings, ResourceLocator locator) {
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
}
public override void accept (ContentVisitor visitor) {
_rows = new ArrayList<TableRow> ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check the table consistency in term of row/column number
// Check individual rows
foreach (var row in _rows) {
- row.check (api_root, container, reporter);
+ row.check (api_root, container, reporter, settings);
}
}
_rowspan = 1;
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check inline content
- base.check (api_root, container, reporter);
+ base.check (api_root, container, reporter, settings);
}
public override void accept (ContentVisitor visitor) {
_cells = new ArrayList<TableCell> ();
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
// Check individual cells
foreach (var cell in _cells) {
- cell.check (api_root, container, reporter);
+ cell.check (api_root, container, reporter, settings);
}
}
}
}
- public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter) {
+ public override void check (Api.Tree api_root, Api.Node? container, ErrorReporter reporter, Settings settings) {
}
public override void accept (ContentVisitor visitor) {
using Gee;
-public static delegate Type Valadoc.DocletRegisterFunction ( );
+[CCode (has_target = false)]
+public delegate Type Valadoc.DocletRegisterFunction ( );
public interface Valadoc.Doclet : GLib.Object {
public abstract void process (Settings settings, Api.Tree tree);
var source_ref = source_comment.source_reference;
try {
Comment doc_comment = parse_comment (content, source_ref.file.filename, source_ref.first_line, source_ref.first_column);
- doc_comment.check (_tree, element, _reporter);
+ doc_comment.check (_tree, element, _reporter, _settings);
return doc_comment;
} catch (ParserError error) {
return null;
}
}
- public Page? parse_wikipage (WikiPage page) {
+ public Page? parse_wikipage (WikiPage page, Api.Package pkg) {
if (page.documentation != null) {
return page.documentation;
}
try {
Page documentation = parse_wiki (page.documentation_str, page.get_filename ());
- documentation.check (_tree, null, _reporter);
+ documentation.check (_tree, pkg, _reporter, _settings);
return documentation;
} catch (ParserError error) {
return null;
}
}
- public bool parse (DocumentationParser docparser) {
- documentation = docparser.parse_wikipage ( this );
+ public bool parse (DocumentationParser docparser, Api.Package pkg) {
+ documentation = docparser.parse_wikipage (this, pkg);
return true;
}
}
private ErrorReporter reporter;
private Settings settings;
+ //TODO: reporter, settings -> create_tree
public WikiPageTree (ErrorReporter reporter, Settings settings) {
this.reporter = reporter;
this.settings = settings;
}
}
- public void create_tree (DocumentationParser docparser) throws GLib.FileError {
+ public void create_tree (DocumentationParser docparser, Api.Package pkg) throws GLib.FileError {
try {
weak string path = this.settings.wiki_directory;
if (path == null) {
this.create_tree_from_path (docparser, path);
foreach (WikiPage page in this.wikipages) {
- page.parse (docparser);
+ page.parse (docparser, pkg);
}
}
catch (FileError err) {
using Valadoc.Api;
public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
- protected Settings settings;
+ public Settings settings { protected set; get; }
protected HtmlRenderer _renderer;
protected Html.MarkupWriter writer;
protected bool is_internal_node (Api.Node node) {
return node is Package
- || node is Namespace
- || node is Interface
- || node is Class
- || node is Struct
- || node is Enum
+ || node is Api.Namespace
+ || node is Api.Interface
+ || node is Api.Class
+ || node is Api.Struct
+ || node is Api.Enum
|| node is Api.EnumValue
- || node is ErrorDomain
- || node is ErrorCode;
+ || node is Api.ErrorDomain
+ || node is Api.ErrorCode;
}
public void write_navi_packages_inline (Api.Tree tree) {
writer.end_tag ("div");
}
- public void write_symbol_content (Api.Node node) {
+ public void write_symbol_content (Api.Node node, string image_path_prefix = "") {
string full_name = node.full_name ();
writer.start_tag ("div", {"class", css_style_content});
writer.start_tag ("h1", {"class", css_title, full_name}).text (node.name).end_tag ("h1");
writer.simple_tag ("hr", {"class", css_headline_hr});
- this.write_image_block (node);
+ this.write_image_block (node, image_path_prefix);
writer.start_tag ("h2", {"class", css_title}).text ("Description:").end_tag ("h2");
writer.start_tag ("div", {"class", css_code_definition});
this.write_signature (node, node);
this.write_namespace_note (node);
this.write_package_note (node);
}
+
if (node.has_children ({
Api.NodeType.ERROR_CODE,
Api.NodeType.ENUM_VALUE,
}
}
- protected void write_image_block (Api.Node element) {
+ protected void write_image_block (Api.Node element, string path_prefix = "") {
if (!(element is Class || element is Interface || element is Struct)) {
return;
}
string realimgpath = this.get_img_real_path (element);
string imgpath = this.get_img_path (element);
+ if (path_prefix != null) {
+ imgpath = Path.build_filename (path_prefix, imgpath);
+ }
if (element is Class) {
Diagrams.write_class_diagram ((Class)element, realimgpath);
}
public string get_html_css_class (Valadoc.Api.Item element) {
- if ( element is Namespace ) {
+ if ( element is Api.Namespace ) {
return css_namespace;
}
- else if ( element is Struct ) {
+ else if ( element is Api.Struct ) {
return css_struct;
}
- else if ( element is Interface ) {
+ else if ( element is Api.Interface ) {
return css_interface;
}
- else if ( element is Class ) {
+ else if ( element is Api.Class ) {
return (((Class)element).is_abstract)? css_abstract_class : css_class;
}
- else if ( element is Enum ) {
+ else if ( element is Api.Enum ) {
return css_enum;
}
- else if ( element is ErrorDomain ) {
+ else if ( element is Api.ErrorDomain ) {
return css_errordomain;
}
- else if ( element is Delegate ) {
+ else if ( element is Api.Delegate ) {
return css_delegate;
}
- else if ( element is Method ) {
- if ( ((Method)element).is_static )
+ else if ( element is Api.Method ) {
+ if ( ((Api.Method)element).is_static )
return css_static_method;
- else if ( ((Method)element).is_static )
+ else if ( ((Api.Method)element).is_static )
return css_static_method;
- else if ( ((Method)element).is_constructor )
+ else if ( ((Api.Method)element).is_constructor )
return css_creation_method;
- else if ( ((Method)element).is_abstract )
+ else if ( ((Api.Method)element).is_abstract )
return css_abstract_method;
- else if ( ((Method)element).is_virtual || ((Method)element).is_override )
+ else if ( ((Api.Method)element).is_virtual || ((Api.Method)element).is_override )
return css_virtual_method;
else
return css_method;
else if ( element is Api.Signal ) {
return css_signal;
}
- else if ( element is Property ) {
- if ( ((Property)element).is_virtual || ((Property)element).is_override )
+ else if ( element is Api.Property ) {
+ if ( ((Api.Property)element).is_virtual || ((Property)element).is_override )
return css_virtual_property;
- else if ( ((Property)element).is_abstract )
+ else if ( ((Api.Property)element).is_abstract )
return css_abstract_property;
else
return css_property;
}
- else if ( element is Field ) {
+ else if ( element is Api.Field ) {
return css_field;
}
- else if ( element is Constant ) {
+ else if ( element is Api.Constant ) {
return css_constant;
}
else if ( element is Api.EnumValue ) {
return css_enumvalue;
}
- else if ( element is ErrorCode ) {
+ else if ( element is Api.ErrorCode ) {
return css_errorcode;
}
- else if ( element is Package ) {
+ else if ( element is Api.Package ) {
return css_package;
}
return "";
} else {
start_tag ("a", {"href", url, "class", css_class});
}
+
text (label);
end_tag ("a");
return this;
public class Valadoc.Html.HtmlRenderer : ContentRenderer {
- private BasicDoclet _doclet;
- private Documentation? _container;
- private unowned MarkupWriter writer;
+ protected BasicDoclet _doclet;
+ protected Documentation? _container;
+ protected unowned MarkupWriter writer;
public HtmlRenderer (BasicDoclet doclet) {
_doclet = doclet;
return get_html_link (_doclet.settings, symbol, _container);
}
- private void write_symbol_link (Api.Node symbol, string label) {
+ private void write_symbol_link (Api.Node symbol, string? label) {
var url = get_url (symbol);
writer.link (url,
(label == null || label == "") ? symbol.full_name () : label,
public override void visit_embedded (Embedded element) {
var caption = element.caption;
- writer.image (element.url, (caption == null || caption == "") ? "" : caption);
+
+ var absolute_path = Path.build_filename (_doclet.settings.path, element.package.name, "img", Path.get_basename (element.url));
+ var relative_path = Path.build_filename ("img", Path.get_basename (element.url));
+
+ copy_file (element.url, absolute_path);
+
+ writer.image (relative_path, (caption == null || caption == "") ? "" : caption);
}
public override void visit_headline (Headline element) {
using Gee;
-public static delegate void Valadoc.TagletRegisterFunction (ModuleLoader loader);
+[CCode (has_target = false)]
+public delegate void Valadoc.TagletRegisterFunction (ModuleLoader loader);
public class Valadoc.ModuleLoader : Object {
return true;
}
- public Content.Taglet create_taglet (string keyword) {
- return (Content.Taglet) GLib.Object.new (taglets.get (keyword));
+ public Content.Taglet? create_taglet (string keyword) {
+ return (taglets.has_key (keyword))? (Content.Taglet) GLib.Object.new (taglets.get (keyword)) : null;
}
private bool load_doclet (string path) {
public string[] defines;
public string[] vapi_directories;
+ public string[] docu_directories;
}
private static bool disable_dbus_transformation;
private static string profile;
+ [CCode (array_length = false, array_null_terminated = true)]
+ private static string[] docu_directories;
[CCode (array_length = false, array_null_terminated = true)]
private static string[] vapi_directories;
[CCode (array_length = false, array_null_terminated = true)]
{ "enable-experimental-non-null", 0, 0, OptionArg.NONE, ref experimental_non_null, "Enable experimental enhancements for non-null types", null },
{ "disable-dbus-transformation", 0, 0, OptionArg.NONE, ref disable_dbus_transformation, "Disable transformation of D-Bus member names", null },
{ "vapidir", 0, 0, OptionArg.FILENAME_ARRAY, ref vapi_directories, "Look for package bindings in DIRECTORY", "DIRECTORY..." },
+ { "docudir", 0, 0, OptionArg.FILENAME_ARRAY, ref docu_directories, "Look for external documentation in DIRECTORY", "DIRECTORY..." },
{ "profile", 0, 0, OptionArg.STRING, ref profile, "Use the given profile instead of the default", "PROFILE" },
settings.basedir = basedir;
settings.directory = directory;
settings.vapi_directories = vapi_directories;
+ settings.docu_directories = docu_directories;
settings.profile = profile;
settings.defines = defines;
Valadoc.Api.Tree doctree = new Valadoc.Api.Tree (reporter, settings);
Valadoc.DocumentationParser docparser = new Valadoc.DocumentationParser (settings, reporter, doctree, modules);
- if (reporter.errors > 0) {
- return quit (reporter);
- }
+ Valadoc.DocumentationImporter importer = new Valadoc.Xml.DocumentationImporter (doctree, modules, settings, reporter);
doctree.add_depencies (packages);
if (reporter.errors > 0) {
return quit (reporter);
}
-
doctree.add_documented_file (tsources);
if (reporter.errors > 0) {
return quit (reporter);
}
- if (!doctree.create_tree())
+ if (!doctree.create_tree()) {
return quit (reporter);
+ }
doctree.parse_comments (docparser);
- if (reporter.errors > 0)
+ if (reporter.errors > 0) {
+ return quit (reporter);
+ }
+
+ doctree.import_documentation (importer);
+ if (reporter.errors > 0) {
return quit (reporter);
+ }
modules.doclet.process (settings, doctree);
return quit (reporter);