diff options
| -rw-r--r-- | scss/sidebar.scss | 4 | ||||
| -rw-r--r-- | src/modules/sidebar/modules/headlines.tsx | 16 |
2 files changed, 13 insertions, 7 deletions
diff --git a/scss/sidebar.scss b/scss/sidebar.scss index 1fea682..eb7a3ed 100644 --- a/scss/sidebar.scss +++ b/scss/sidebar.scss @@ -851,6 +851,10 @@ font-size: lib.s(15); margin-top: lib.s(10); color: scheme.$subtext1; + + & > :last-child { + margin-top: lib.s(8); + } } button:hover .article-body, diff --git a/src/modules/sidebar/modules/headlines.tsx b/src/modules/sidebar/modules/headlines.tsx index 924e5b8..089119c 100644 --- a/src/modules/sidebar/modules/headlines.tsx +++ b/src/modules/sidebar/modules/headlines.tsx @@ -9,8 +9,6 @@ const fixGoogleNews = (colours: IPalette, title: string, desc: string) => { // Add separator, bold and split at domain (domain is at the end of each headline) const domain = title.split(" - ").at(-1); if (domain) desc = desc.replaceAll(domain, `— <span foreground="${colours.subtext0}">${domain}</span>\n\n`); - // Add spaces between sentences - desc = desc.replace(/\.([A-Z])/g, ". $1"); // Split headlines desc = desc.replace(/(( |\.)[^A-Z][a-z]+)([A-Z])/g, "$1\n\n$3"); desc = desc.replace(/( [A-Z]+)([A-Z](?![s])[a-z])/g, "$1\n\n$2"); @@ -20,6 +18,14 @@ const fixGoogleNews = (colours: IPalette, title: string, desc: string) => { return desc.trim(); }; +const fixNews = (colours: IPalette, title: string, desc: string, source: string) => { + // Add spaces between sentences + desc = desc.replace(/\.([A-Z])/g, ". $1"); + // Google News needs some other fixes + if (source === "Google News") desc = fixGoogleNews(colours, title, desc); + return desc.replaceAll("&", "&"); +}; + const getCategoryIcon = (category: string) => { if (category === "business") return "monitoring"; if (category === "crime") return "speed_camera"; @@ -81,11 +87,7 @@ const Article = ({ title, description, creator, pubDate, source_name, link }: IA useMarkup xalign={0} label={bind(Palette.get_default(), "colours").as(c => - `\n${ - source_name === "Google News" - ? fixGoogleNews(c, title, description) - : description - }`.replaceAll("&", "&") + fixNews(c, title, description, source_name) )} /> )} |