pub / newsplanet

Planet-Style Newsfeed generated with perlanet
git clone https://src.jayvii.de/pub/newsplanet.git
Home | Log | Files | Exports | Refs | README | RSS

commit cc5cfb85ff60262aae3ff662e86ef370deeb8953
parent 72858010630a7d315d0305658c118281c7b522bf
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Wed, 18 Dec 2024 17:36:39 +0100

fix: replace favicons by news domains

Diffstat:
Aassets/css/custom.css | 46++++++++++++++++++++++++++++++++++++++++++++++
Mrun.sh | 21++++++++++++---------
Mtemplate.html | 52++++------------------------------------------------
3 files changed, 62 insertions(+), 57 deletions(-)

diff --git a/assets/css/custom.css b/assets/css/custom.css @@ -0,0 +1,46 @@ +/* Always scroll smoothly */ +* { + scroll-behavior: smooth; +} +/* Hide linebreaks inside articles */ +section > br, +section > p > br +{ + display: none; +} +/* Only show first paragraph of article content (typically the summary) */ +.article_content > *:nth-child(n + 2) { + display: none; +} +.article_content { + margin-bottom: 1.5em; +} +/* Content should not be weighted */ +.article_content > strong { + font-weight: normal; +} +/* Hide iframes and images in case they are not filtered out */ +.article_content > iframe, +.article_content > img, +.article_content > * > img, +.article_content > * > iframe +{ + display: none; +} +/* Rules for buttons row */ +.button-row { + width: 100%; + display: inline-block; +} +.button-row > .button { + display: inline-block; + margin-left: 5px; + margin-right: 5px; + max-height: 50px; +} +a.button > img { + height: 30px; + width: auto; + margin-right: 5px; +} + diff --git a/run.sh b/run.sh @@ -7,9 +7,6 @@ else CONFIG="$1" fi -# Re-download favicons -./fetch_favicon.sh "$CONFIG" & - # Gather various information from config file printf "Gather information from config file...\n" HTML=`grep -E '^\s+file:.*?\.html\s*$' "$CONFIG" | awk '{ print $NF }'` @@ -34,16 +31,19 @@ sed -E -e 's/<br[^a-z]*[^>]*>//g' -e 's/<p[^a-z]*[^>]*><\/p>//g' -i "$HTML" # insert link to rss/xml file printf "Inserting RSS feed file...\n" -sed -E -e "s/<!--XML-->/\"$XML\"/" -i "$HTML" +sed -E -e "s/<\!--XML-->/\"$XML\"/" -i "$HTML" # insert link to manifest JSON file printf "Inserting manifest file...\n" MANIFEST=`echo "$HTML" | sed -e 's/html/json/'` -sed -E -e "s/<!--MANIFEST-->/\"$MANIFEST\"/" -i "$HTML" +sed -E -e "s/<\!--MANIFEST-->/\"$MANIFEST\"/" -i "$HTML" # insert favicon image buttons -printf "Inserting favicons...\n" -sed -E -e 's/<!--IMG\ src=\"https:\/\/([^\/]*)[^\"]*(\"[^>]*>)-->/<img alt=\"\1\" title=\"\1\" src=\"\/assets\/site-icons\/\1\2/g' -i "$HTML" +# printf "Inserting favicons...\n" +# sed -E -e 's/<\!--IMG\ src=\"https:\/\/([^\/]*)[^\"]*(\"[^>]*>)-->/<img src=\"assets\/site-icons\/\1\2 \1/g' -i "$HTML" + +# insert feed domain +sed -E -e 's/<\!--IMG\ src=\"https:\/\/([^\/]*)[^\"]*(\"[^>]*>)-->/\1/g' -i "$HTML" # Insert feeds list printf "Inserting feeds list...\n" @@ -54,9 +54,12 @@ for i in `seq 1 1 $NFEEDS`; do FEEDS="$FEEDS<a href=\"$WEB\">$TITLE</a><br>" done FEEDS=`echo "$FEEDS" | sed -e 's/\//\\\\\//g' -ze 's/\n//g'` -sed -E -e "s/<!--FEEDS-->/$FEEDS/" -i "$HTML" +sed -E -e "s/<\!--FEEDS-->/$FEEDS/" -i "$HTML" # Insert Update time printf "Inserting update time...\n" DATE=`date +%c` -sed -E -e "s/<!--UPDATED-->/$DATE/" -i "$HTML" +sed -E -e "s/<\!--UPDATED-->/$DATE/" -i "$HTML" + +# Re-download favicons +# ./fetch_favicon.sh "$CONFIG" diff --git a/template.html b/template.html @@ -19,55 +19,10 @@ <link rel="icon" type="image/png" sizes="128x128" href="assets/favicon_128.png"> <link rel="apple-touch-icon" href="assets/favicon.png"> <link rel="stylesheet" type="text/css" href="assets/css/simple.min.css"> + <link rel="stylesheet" type="text/css" href="assets/css/custom.css"> <link rel="alternate" title="[%feed.title %]" type="application/atom+xml" href="rss.xml"> <link crossorigin="use-credentials" rel="manifest" href=<!--MANIFEST-->> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <style> - /* Always scroll smoothly */ - * { - scroll-behavior: smooth; - } - /* Hide linebreaks inside articles */ - section > br, - section > p > br - { - display: none; - } - /* Only show first paragraph of article content (typically the summary) */ - .article_content > *:nth-child(n + 2) { - display: none; - } - .article_content { - margin-bottom: 1.5em; - } - /* Content should not be weighted */ - .article_content > strong { - font-weight: normal; - } - /* Hide iframes and images in case they are not filtered out */ - .article_content > iframe, - .article_content > img, - .article_content > * > img, - .article_content > * > iframe - { - display: none; - } - /* Rules for buttons row */ - .button-row { - width: 100%; - display: flex; - } - .button-row > .button { - display: inline-flex; - margin-left: 5px; - margin-right: 5px; - max-height: 50px; - } - a.button > img { - height: 30px; - width: auto; - } - </style> </head> <body> @@ -122,9 +77,10 @@ <a class="button" href="[% entry.link | url | html %]" - style="width:65px;" + style="width:auto;min-width:65px;" > - <!--IMG src="[% entry.link | url | html %]" alt="News Source">--> + <!-- leave ALT empty because the text is right next to it --> + <!--IMG src="[% entry.link | url | html %]" alt="">--> </a> [% IF entry.issued %] <stretch class="button">