Release 0.41.92
[vala-gnome.git] / libvaladoc / devhelp-markupwriter.vala
blob36b3b397912f82a43889b3a6f1e8001d78510e41
1 /* devhelp-markupwriter.vala
3 * Copyright (C) 2008-2009 Florian Brosch
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Florian Brosch <flo.brosch@gmail.com>
24 public class Valadoc.Devhelp.MarkupWriter : Valadoc.MarkupWriter {
26 public MarkupWriter (FileStream stream, bool xml_declaration = true) {
27 // avoid broken implicit copy
28 unowned FileStream _stream = stream;
30 base ((str) => { _stream.printf (str); }, xml_declaration);
33 protected override bool inline_element (string name) {
34 return name != "book";
37 protected override bool content_inline_element (string name) {
38 return name == "keyword"
39 || name == "sub";
42 public unowned MarkupWriter start_book (string title, string lang, string link, string name, string version, string author) {
43 this.start_tag ("book", {"xmlns", "http://www.devhelp.net/book",
44 "title", title,
45 "language", lang,
46 "name", name,
47 "version", version,
48 "author", author,
49 "link", link});
50 return this;
53 public unowned MarkupWriter end_book () {
54 this.end_tag ("book");
55 return this;
58 public unowned MarkupWriter start_functions () {
59 this.start_tag ("functions");
60 return this;
63 public unowned MarkupWriter end_functions () {
64 this.end_tag ("functions");
65 return this;
68 public unowned MarkupWriter start_chapters () {
69 this.start_tag ("chapters");
70 return this;
73 public unowned MarkupWriter end_chapters () {
74 this.end_tag ("chapters");
75 return this;
78 public unowned MarkupWriter start_sub (string name, string link) {
79 this.start_tag ("sub", {"name", name, "link", link});
80 return this;
83 public unowned MarkupWriter end_sub () {
84 this.end_tag ("sub");
85 return this;
88 public unowned MarkupWriter keyword (string name, string type, string link) {
89 this.start_tag ("keyword", {"type", type, "name", name, "link", link});
90 this.end_tag ("keyword");
91 return this;