Sitemaps: Add better support for RTL sites.

While the URLs are intended to be machine readable, they should always be LTR, while other data would be RTL in the sitemap.

Fixes #50449.

Props joyously, SergeyBiryukov, pbiron. apedog, ramiy.



git-svn-id: https://develop.svn.wordpress.org/trunk@48414 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2020-07-10 00:48:54 +00:00
parent 0802e754a2
commit 36f9f6c70d

View File

@ -248,33 +248,46 @@ XSL;
* @return string The CSS.
*/
public function get_stylesheet_css() {
$css = '
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
color: #444;
}
$text_align = is_rtl() ? 'right' : 'left';
#sitemap__table {
border: solid 1px #ccc;
border-collapse: collapse;
}
#sitemap__table tr th {
text-align: left;
}
#sitemap__table tr td,
#sitemap__table tr th {
padding: 10px;
}
#sitemap__table tr:nth-child(odd) td {
background-color: #eee;
}
a:hover {
text-decoration: none;
}';
$css = <<<EOF
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
color: #444;
}
#sitemap__table {
border: solid 1px #ccc;
border-collapse: collapse;
}
#sitemap__table tr td.loc {
/*
* URLs should always be LTR.
* see https://core.trac.wordpress.org/ticket/16834 and
* https://core.trac.wordpress.org/ticket/49949
*/
direction: ltr;
}
#sitemap__table tr th {
text-align: {$text_align};
}
#sitemap__table tr td,
#sitemap__table tr th {
padding: 10px;
}
#sitemap__table tr:nth-child(odd) td {
background-color: #eee;
}
a:hover {
text-decoration: none;
}
EOF;
/**
* Filters the CSS only for the sitemap stylesheet.