fix escaped text

This commit is contained in:
guinux 2016-04-16 09:43:14 +02:00
parent db85685529
commit b9a9b49b80
2 changed files with 15 additions and 13 deletions

View File

@ -430,7 +430,7 @@ namespace Pamac {
name = alpm_pkg.name,
version = alpm_pkg.version,
// desc can be null
desc = alpm_pkg.desc != null ? Markup.escape_text (alpm_pkg.desc) : "",
desc = alpm_pkg.desc ?? "",
repo = (owned) repo_name,
size = alpm_pkg.isize,
origin = (uint) alpm_pkg.origin
@ -573,7 +573,7 @@ namespace Pamac {
name = json_object.get_string_member ("Name"),
version = json_object.get_string_member ("Version"),
// desc can be null
desc = json_object.get_null_member ("Description") ? "" : Markup.escape_text (json_object.get_string_member ("Description")),
desc = json_object.get_null_member ("Description") ? "" : json_object.get_string_member ("Description"),
popularity = json_object.get_double_member ("Popularity")
};
}
@ -630,7 +630,7 @@ namespace Pamac {
version = json_object.get_string_member ("Version");
// desc can be null
if (!json_object.get_null_member ("Description")) {
desc = Markup.escape_text (json_object.get_string_member ("Description"));
desc = json_object.get_string_member ("Description");
}
popularity = json_object.get_double_member ("Popularity");
// packagebase
@ -638,7 +638,7 @@ namespace Pamac {
// url can be null
unowned Json.Node? node = json_object.get_member ("URL");
if (!node.is_null ()) {
url = Markup.escape_text (node.get_string ());
url = node.get_string ();
}
// maintainer can be null
node = json_object.get_member ("Maintainer");
@ -974,11 +974,11 @@ namespace Pamac {
version = alpm_pkg.version;
// desc can be null
if (alpm_pkg.desc != null) {
desc = Markup.escape_text (alpm_pkg.desc);
desc = alpm_pkg.desc;
}
// url can be null
if (alpm_pkg.url != null) {
url = Markup.escape_text (alpm_pkg.url);
url = alpm_pkg.url;
}
// packager can be null
packager = alpm_pkg.packager ?? "";

View File

@ -388,8 +388,9 @@ namespace Pamac {
AlpmPackageDetails details = transaction.get_pkg_details (pkgname);
// infos
name_label.set_markup ("<big><b>%s %s</b></big>".printf (details.name, details.version));
desc_label.set_markup (details.desc);
link_label.set_markup ("<a href=\"%s\">%s</a>".printf (details.url, details.url));
desc_label.set_text (details.desc);
string escaped_url = Markup.escape_text (details.url);
link_label.set_markup ("<a href=\"%s\">%s</a>".printf (escaped_url, escaped_url));
StringBuilder licenses = new StringBuilder ();
licenses.append (dgettext (null, "Licenses"));
licenses.append (":");
@ -397,7 +398,7 @@ namespace Pamac {
licenses.append (" ");
licenses.append (license);
}
licenses_label.set_markup (licenses.str);
licenses_label.set_text (licenses.str);
// details
details_list.clear ();
details_list.insert_with_values (null, -1,
@ -554,7 +555,8 @@ namespace Pamac {
name_label.set_markup ("<big><b>%s %s</b></big>".printf (details.name, details.version));
desc_label.set_text (details.desc);
string aur_url = "http://aur.archlinux.org/packages/" + details.name;
link_label.set_markup ("<a href=\"%s\">%s</a>\n\n<a href=\"%s\">%s</a>".printf (details.url, details.url, aur_url, aur_url));
string escaped_url = Markup.escape_text (details.url);
link_label.set_markup ("<a href=\"%s\">%s</a>\n\n<a href=\"%s\">%s</a>".printf (escaped_url, escaped_url, aur_url, aur_url));
StringBuilder licenses = new StringBuilder ();
licenses.append (dgettext (null, "Licenses"));
licenses.append (":");
@ -664,7 +666,7 @@ namespace Pamac {
packages_list.insert_with_values (null, -1,
0, pkg.origin,
1, pkg.name,
2, "<b>%s</b>\n%s".printf (pkg.name, pkg.desc),
2, "<b>%s</b>\n%s".printf (pkg.name, Markup.escape_text (pkg.desc)),
3, pkg.version,
4, pkg.repo,
5, pkg.size,
@ -686,7 +688,7 @@ namespace Pamac {
aur_list.insert_with_values (null, -1,
0, alpm_pkg.origin,
1, alpm_pkg.name,
2, "<b>%s</b>\n%s".printf (alpm_pkg.name, alpm_pkg.desc),
2, "<b>%s</b>\n%s".printf (alpm_pkg.name, Markup.escape_text (alpm_pkg.desc)),
3, alpm_pkg.version,
4, aur_pkg.popularity,
5, "%.2f".printf (aur_pkg.popularity));
@ -694,7 +696,7 @@ namespace Pamac {
aur_list.insert_with_values (null, -1,
0, 0,
1, aur_pkg.name,
2, "<b>%s</b>\n%s".printf (aur_pkg.name, aur_pkg.desc),
2, "<b>%s</b>\n%s".printf (aur_pkg.name, Markup.escape_text (aur_pkg.desc)),
3, aur_pkg.version,
4, aur_pkg.popularity,
5, "%.2f".printf (aur_pkg.popularity));