3 * Copyright (C) 2008-2014 Florian Brosch, Didier Villevalois
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
20 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
24 using Valadoc
.Content
;
26 public class Valadoc
.Html
.MarkupWriter
: Valadoc
.MarkupWriter
{
28 public MarkupWriter (FileStream stream
, bool xml_declaration
= true) {
29 // avoid broken implicit copy
30 unowned FileStream _stream
= stream
;
37 public MarkupWriter
.builder (StringBuilder builder
, bool xml_declaration
= true) {
38 // avoid broken implicit copy
39 unowned StringBuilder _builder
= builder
;
42 _builder
.append (str
);
46 public MarkupWriter
add_usemap (Charts
.Chart chart
) {
47 string? buf
= (string?
) chart
.write_buffer ("cmapx");
57 public MarkupWriter
link (string url
, string label
, string? css_class
= null) {
58 if (css_class
== null) {
59 start_tag ("a", {"href", url
});
61 start_tag ("a", {"href", url
, "class", css_class
});
69 public MarkupWriter
image (string src
, string? caption
= null, string? css_class
= null) {
70 if (css_class
== null) {
71 simple_tag ("img", {"src", src
, "alt", caption
});
73 simple_tag ("img", {"src", src
, "alt", caption
, "class", css_class
});
78 public MarkupWriter
stylesheet_link (string url
) {
79 simple_tag ("link", {"href", url
, "rel", "stylesheet", "type", "text/css"});
83 public MarkupWriter
javascript_link (string url
) {
84 start_tag ("script", {"src", url
, "type", "text/javascript"});
89 protected override bool inline_element (string name
) {
113 protected override bool content_inline_element (string name
) {
114 return name
== "title"