Compare commits

...

4 Commits

Author SHA1 Message Date
Case Duckworth 4028897f6e Add makefile 2022-08-08 23:09:57 -05:00
Case Duckworth 18fd5efa6c Fix quoting 2022-08-08 23:09:51 -05:00
Case Duckworth 94d96ca4c4 Further awkify 2022-08-08 23:09:38 -05:00
Case Duckworth 31b7529778 Correct Jekyll feed parsing
jekyll is dumb.  there I said it.
2022-08-08 22:32:39 -05:00
3 changed files with 33 additions and 22 deletions

4
opml/Makefile Normal file
View File

@ -0,0 +1,4 @@
build:
./opml.sh make "the most delicious opml on friend planet" \
"barista" "barista@me.acdw.net" "https://git.tilde.town/mio/opml" \
./mug.of.opml

View File

@ -1,12 +1,12 @@
<?xml version=1.0?>
<opml version=2.0>
<?xml version="1.0"?>
<opml version="2.0">
<head>
<title>the most delicious opml on friend planet</title>
<dateCreated>Mon, 08 Aug 2022 07:42:14 +0000</dateCreated>
<dateModified>Mon, 08 Aug 2022 07:42:14 +0000</dateModified>
<ownerName>acdw</ownerName>
<ownerEmail>acdw@acdw.net</ownerEmail>
<ownerId>https://git.acdw.net/sfeed/</ownerId>
<dateCreated>Tue, 09 Aug 2022 04:08:29 +0000</dateCreated>
<dateModified>Tue, 09 Aug 2022 04:08:29 +0000</dateModified>
<ownerName>barista</ownerName>
<ownerEmail>barista@me.acdw.net</ownerEmail>
<ownerId>https://git.tilde.town/mio/opml</ownerId>
<docs>http://dev.opml.org/spec2.html</docs>
</head>
<body>
@ -39,8 +39,8 @@ xmlUrl="https://brainshit.fr/rss" htmlUrl="https://brainshit.fr" description="Si
xmlUrl="https://tilde.town/~lucidiot/ideas/rss.xml" htmlUrl="https://tilde.town/~lucidiot/ideas/" description="random ideas published by ~lucidiot"/>
<outline type="rss" text="#fridaypostcard"
xmlUrl="https://tilde.town/~lucidiot/fridaypostcard.xml" htmlUrl="http://tilde.town/~jumblesale/fp.html" description="to contribute, share a link to an image on irc with the text #fridaypostcard. updated every friday"/>
<outline type="rss" text="m455's blog"
xmlUrl="https://m455.casa/feed.rss" htmlUrl="https://m455.casa" description="A blog about programming and documentation."/>
<outline type="rss" text="m455.casa"
xmlUrl="https://m455.casa/feed.rss" htmlUrl="https://m455.casa" description="RSS feed for m455.casa"/>
<outline type="rss" text="Rick Carlino's Blog"
xmlUrl="https://rickcarlino.com/rss/feed.rss" htmlUrl="https://rickcarlino.com" description="The personal blog of Rick Carlino, a software tinkerer."/>
<outline type="rss" text="lipu pi jan Niko"

View File

@ -93,22 +93,25 @@ orange_pecan_mousse() {
if [ -z "$is_rss" ]; then
# Select the first instance of the opening tag, mark the closing tag,
# trim off everything after and before the tags, clean inner html
sprinkle=$(echo -e "$germ" | grep -m 1 "<title" |
sed "0,/<title>/ s/<title>//" |
sed "0,/<title/ s/<title type=\"html\">//" | sed "s/<\/title>.*//" |
sed "s/.*<title>//" | sed "s/.*<title type=\"html\">//" |
sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | sed "s/ //")
sprinkle=$(echo -e "$germ" |
awk '/<title/{title=1}
title{
match($0,/<title[^>]*>/);
$0 = substr($0, RSTART+RLENGTH);
if(sub(/<\/title>.*/,"")){title=0;seen=1;}
print;}
/<\/title/{seen=1}
!title&&seen{exit}')
# RSS
else
sprinkle=$(echo -e "$germ" | grep -m 1 "<title>" |
sed "s/.*<title>//" | sed "s/<\/title>.*//" |
sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | sed "s/ //")
sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | tr -d \\n)
pearl=$(echo -e "$germ" | grep -m 1 "<link>" |
sed "s/.*<link>//" | sed "s/<\/link>.*//" | sed "s/ //")
sed "s/.*<link>//" | sed "s/<\/link>.*//" | tr -d \\n)
luncheon=$(echo -e "$germ" | grep -m 1 "<description>" |
sed "s/.*<description>//" | sed "s/<\/description>.*//" |
sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | sed "s/ //")
sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | tr -d \\n)
fi
# Guess the website URL from the feed URL to avoid parsing
# strings with multiple link tags and no newline delimiters,
@ -120,10 +123,14 @@ orange_pecan_mousse() {
test -z "$luncheon" && luncheon="No description available"
echo -e "$__pecan" >>"$_wheremug.tmp"
sed -i "s|{{sprinkle}}|$sprinkle|g" "$_wheremug.tmp"
sed -i "s|{{seed}}|$seed|g" "$_wheremug.tmp"
sed -i "s|{{pearl}}|$pearl|g" "$_wheremug.tmp"
sed -i "s|{{luncheon}}|$luncheon|g" "$_wheremug.tmp"
awk '{
gsub(/{{sprinkle}}/,"'"$sprinkle"'");
gsub(/{{seed}}/,"'"$seed"'");
gsub(/{{pearl}}/,"'"$pearl"'");
gsub(/{{luncheon}}/,"'"$luncheon"'");
print;
}' <"$_wheremug.tmp" >"$_wheremug.tmp.tmp" &&
mv "$_wheremug.tmp.tmp" "$_wheremug.tmp"
sprinkle=""
pearl=""
luncheon=""