Vidalia
0.3.1
src
common
html.cpp
Go to the documentation of this file.
1
/*
2
** This file is part of Vidalia, and is subject to the license terms in the
3
** LICENSE file, found in the top level directory of this distribution. If you
4
** did not receive the LICENSE file with this file, you may obtain it from the
5
** Vidalia source package distributed by the Vidalia Project at
6
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7
** including this file, may be copied, modified, propagated, or distributed
8
** except according to the terms described in the LICENSE file.
9
*/
10
11
/*
12
** \file html.cpp
13
** \brief HTML formatting functions
14
*/
15
16
#include "
html.h
"
17
18
19
/** Wraps a string in "<p>" tags, converts "\n" to "<br/>" and converts "\n\n"
20
* to a new paragraph. */
21
QString
22
p
(QString str)
23
{
24
str =
"<p>"
+ str +
"</p>"
;
25
str.replace(
"\n\n"
,
"</p><p>"
);
26
str.replace(
"\n"
,
"<br/>"
);
27
return
str;
28
}
29
30
/** Wraps a string in "<i>" tags. */
31
QString
32
i
(QString str)
33
{
34
return
QString(
"<i>%1</i>"
).arg(str);
35
}
36
37
/** Wraps a string in "<b>" tags. */
38
QString
39
b
(QString str)
40
{
41
return
QString(
"<b>%1</b>"
).arg(str);
42
}
43
44
/** Wraps a string in "<tr>" tags. */
45
QString
46
trow
(QString str)
47
{
48
return
QString(
"<tr>%1</tr>"
).arg(str);
49
}
50
51
/** Wraps a string in "<td>" tags. */
52
QString
53
tcol
(QString str)
54
{
55
return
QString(
"<td>%1</td>"
).arg(str);
56
}
57
58
/** Wraps a string in "<th>" tags. */
59
QString
60
thead
(QString str)
61
{
62
return
QString(
"<th>%1</th>"
).arg(str);
63
}
64
65
/** Escapes "<" and ">" characters in the given string. */
66
QString
67
escape
(QString str)
68
{
69
str.replace(
"<"
,
"<"
);
70
str.replace(
">"
,
">"
);
71
return
str;
72
}
73
i
QString i(QString str)
Definition:
html.cpp:32
thead
QString thead(QString str)
Definition:
html.cpp:60
tcol
QString tcol(QString str)
Definition:
html.cpp:53
p
QString p(QString str)
Definition:
html.cpp:22
trow
QString trow(QString str)
Definition:
html.cpp:46
b
QString b(QString str)
Definition:
html.cpp:39
html.h
escape
QString escape(QString str)
Definition:
html.cpp:67
Generated by
1.8.17