Archived
1
0
Fork 0

Migrated some parts of noter.sh to config.sh for ease of customisation

This commit is contained in:
Siina Mashek 2024-02-17 16:01:25 +02:00
parent 4de2542e90
commit c8f0f18f9b
2 changed files with 108 additions and 101 deletions

99
config.sh Normal file
View file

@ -0,0 +1,99 @@
showgenerator="true"
backtotop="true"
lastupdated="true"
#rssfeed="true"
site_title="koutsie's telenotes"
site_description="thoughts about mainly computers... maybe recipes and cats too?"
site_link="https://k0.tel/"
# Put CSS between <<EOF and EOF
site_css=$(cat <<EOF
/* font by https://www.1001fonts.com/users/junkohanhero/ */
@font-face { font-family: header; src: url(scratch_x_black.ttf); }
body {
background-color: #0f0f0f;
color: #fff;
font-family: 'Arial Rounded MT', sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
margin: 0;
/* font legibility optimizations */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
.container {
max-width: 800px;
padding: 20px;
border-radius: 15px;
}
.note {
background-color: #181717;
padding: 10px;
margin-bottom: 20px;
border-radius: 10px;
}
h1 {
text-align: center;
font-family: "header", sans-serif;
}
h3 {
color: #fff;
}
img {
border-radius: 5px;
}
note {
color: #fff;
white-space: pre-wrap;
}
code {
color: #00ff62b5;
font-family: "Lucida Console", "Courier New", monospace;
white-space: pre-wrap;
}
.back-to-top {
text-align: right;
margin-top: 20px;
}
.last-updated {
text-align: right;
margin-bottom: 20px;
color: #888;
font-size: 13px;
}
a:link, a:visited, a:hover, a:active {
color: #ff7b00;
font-style: normal;
text-decoration: underline;
}
/* le tableee */
table {
width: 100%;
border-collapse: collapse;
border: 1px solid #fff;
border-radius: 8px;
overflow: hidden;
color: #fff;
}
th, td {
padding: 10px 15px;
border: 1px solid #fff;
border-radius: 8px;
}
th {
background: #1f1f1f;
text-align: left;
font-weight: bold;
}
td {
background: #0b0b0b;
}
EOF
)

110
noter.sh
View file

@ -1,11 +1,7 @@
#!/bin/bash
# noter 1.2.4 - "nice font" - @k@layer8.space - mit
showgenerator="true"
backtotop="true"
lastupdated="true"
#rssfeed="true"
# noter 1.3.0 - "nice configs" - @k@layer8.space - mit
source ./config.sh
# a pretty nifty little logging utility!
nlog() {
@ -86,9 +82,6 @@ generate_top_year_bar() {
generate_rss_feed() {
nlog "generating rss feed"
local rss_file="feed.xml"
local rss_title="koutsies telenotes"
local rss_description="thoughts about mainly computers... maybe recipes and cats too?"
local rss_link="https://k0.tel/"
local rss_pubdate=$(date -u +"%a, %d %b %Y %H:%M:%S GMT")
xml_escape() {
@ -100,9 +93,9 @@ generate_rss_feed() {
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<rss version=\"2.0\">
<channel>
<title>$(xml_escape "$rss_title")</title>
<link>$rss_link</link>
<description>$(xml_escape "$rss_description")</description>
<title>$(xml_escape "$site_title")</title>
<link>$site_link</link>
<description>$(xml_escape "$site_description")</description>
<pubDate>$rss_pubdate</pubDate>
<lastBuildDate>$rss_pubdate</lastBuildDate>
<docs>https://cyber.harvard.edu/rss/rss.html</docs>
@ -147,8 +140,8 @@ echo "<!DOCTYPE html>
<head>
<meta charset='utf-8'>
<title>$notecount notes | noter</title>
<meta property='og:title' content='koutsies telenotes' />
<meta property='og:description' content='thoughts about mainly computers... maybe recipes and cats too?' />
<meta property='og:title' content='$site_title' />
<meta property='og:description' content='$site_description' />
<meta property='og:type' content='blog' />
<meta property='og:generator' content='noter' />
<!-- those who seek, shall see - but thy shall be prepared... -->
@ -156,97 +149,12 @@ echo "<!DOCTYPE html>
<link rel='alternate' type='application/atom+xml' title="rss" href='/feed.xml' />
<meta name='last-generated' content='$(date +"%Y-%m-%d %H:%M:%S")' />
<style>
/* font by https://www.1001fonts.com/users/junkohanhero/ */
@font-face { font-family: header; src: url(scratch_x_black.ttf); }
body {
background-color: #0f0f0f;
color: #fff;
font-family: 'Arial Rounded MT', sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
margin: 0;
/* font legibility optimizations */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
.container {
max-width: 800px;
padding: 20px;
border-radius: 15px;
}
.note {
background-color: #181717;
padding: 10px;
margin-bottom: 20px;
border-radius: 10px;
}
h1 {
text-align: center;
font-family: "header", sans-serif;
}
h3 {
color: #fff;
}
img {
border-radius: 5px;
}
note {
color: #fff;
white-space: pre-wrap;
}
code {
color: #00ff62b5;
font-family: "Lucida Console", "Courier New", monospace;
white-space: pre-wrap;
}
.back-to-top {
text-align: right;
margin-top: 20px;
}
.last-updated {
text-align: right;
margin-bottom: 20px;
color: #888;
font-size: 13px;
}
a:link, a:visited, a:hover, a:active {
color: #ff7b00;
font-style: normal;
text-decoration: underline;
}
/* le tableee */
table {
width: 100%;
border-collapse: collapse;
border: 1px solid #fff;
border-radius: 8px;
overflow: hidden;
color: #fff;
}
th, td {
padding: 10px 15px;
border: 1px solid #fff;
border-radius: 8px;
}
th {
background: #1f1f1f;
text-align: left;
font-weight: bold;
}
td {
background: #0b0b0b;
}
$site_css
</style>
</head>
<body>
<div class='container'>
<h1>koutsie's telenotes</h1><br>
<h1>$site_title</h1><br>
<center> <a rel='me' href='https://layer8.space/@k'>fedi</a> | <a href="feed.xml">rss</a> | <a href="https://the-sauna.icu/">sauna</a> </center>" >"$output_file"
generate_top_year_bar >>"$output_file"