aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-10 11:01:11 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-10 11:01:11 +0100
commit90ae2cf11103d9acfc302897747404ec6c5f9005 (patch)
treee4f9dc17d5ca4dae80d6323f2aafb5b22f6af465
parent7253e7c36cc8c33092933a0e38eb02ff498cdd62 (diff)
downloadpaludis-90ae2cf11103d9acfc302897747404ec6c5f9005.tar.gz
paludis-90ae2cf11103d9acfc302897747404ec6c5f9005.tar.xz
Need some html escaping
-rw-r--r--paludis/args/man.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index cc421e9..7bbff7a 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -89,6 +89,21 @@ namespace
{
}
};
+
+ std::string escape_html_char(char c)
+ {
+ switch (c)
+ {
+ case '&':
+ return "&amp;";
+ case '<':
+ return "&lt;";
+ case '>':
+ return "&gt;";
+ default:
+ return std::string(1, c);
+ }
+ };
}
@@ -244,7 +259,7 @@ HtmlWriter::arg_group_item(const char & short_name, const std::string & long_nam
{
_os << "<dt>";
if (short_name)
- _os << "-" << short_name << ", ";
+ _os << "-" << escape_html_char(short_name) << ", ";
_os << "--" << long_name;
if (! negated_long_name.empty())
_os << " (" << "--" << negated_long_name << ")";
@@ -267,7 +282,7 @@ HtmlWriter::extra_arg_enum(const AllowedEnumArg & e, const std::string & default
_os << "<dt>" << e.long_name();
if (e.short_name())
- _os << " (" << std::string(1, e.short_name()) << ")";
+ _os << " (" << escape_html_char(e.short_name()) << ")";
_os << "</dt>" << endl;
_os << "<dd>" << e.description() << default_string << "</dd>" << endl;
}