Compare commits
15 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d80519cee | |||
| 2fef20f836 | |||
| d55460cded | |||
| b95a53e880 | |||
| 730e3cb989 | |||
| e76d43b440 | |||
| 238a500b47 | |||
| 6faf158f3f | |||
| c15fa62d64 | |||
| dcc71d9896 | |||
| 224725c065 | |||
| e4052891b8 | |||
| ef8c6a0110 | |||
| e04e2db325 | |||
| 848c3b4c60 |
5 changed files with 103 additions and 30 deletions
|
|
@ -37,4 +37,7 @@ or
|
|||
you can optionally add a text at the end of the HTML page title as the second argument
|
||||
```./genlog.sh /path/to/your/choosen/folder "Your custom title"```
|
||||
|
||||
you can also put your own `header.html` or `footer.html` in the `html/substitutes` folder
|
||||
so they will be used instead of the default ones and you can freely personalize them
|
||||
|
||||
this project uses the [HotChocolateLicence](https://codeberg.org/OniriCorpe/HotChocolateLicence)
|
||||
|
|
|
|||
40
genlog.sh
40
genlog.sh
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
:' LICENCE
|
||||
: '
|
||||
LICENCE
|
||||
THE "HOT CHOCOLATE LICENSE ☕" (HCL revision 1312.2):
|
||||
|
||||
OniriCorpe wrote this file. As long as you retain this
|
||||
|
|
@ -10,7 +11,8 @@ disabled comrades, etc), you can do whatever you want with this stuff.
|
|||
If we meet some day, and you think this stuff is worth it, you can buy me a
|
||||
hot chocolate or any other non-alcoholic drink that suits me in return.
|
||||
|
||||
OniriCorpe 🏴'
|
||||
OniriCorpe 🏴
|
||||
'
|
||||
|
||||
|
||||
# some useful things
|
||||
|
|
@ -34,9 +36,23 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# if header or footer file exists in the substitutes folder, use it instead of the default ones
|
||||
if [ -f html/substitutes/header.html ]; then
|
||||
header_template="html/substitutes/header.html"
|
||||
else
|
||||
header_template="html/header.html"
|
||||
fi
|
||||
|
||||
if [ -f html/substitutes/footer.html ]; then
|
||||
footer_template="html/substitutes/footer.html"
|
||||
else
|
||||
footer_template="html/footer.html"
|
||||
fi
|
||||
|
||||
|
||||
# get the current date for the footer (UTC and ISO 8601 with hours and minutes)
|
||||
date=$(date -u --iso-8601=minutes)
|
||||
sed "s/GEN_DATE/${date}/" html/footer.html > "$tempdir/footer.html"
|
||||
sed "s/GEN_DATE/${date}/" "$footer_template" > "$tempdir/footer.html"
|
||||
|
||||
|
||||
# finding recursively all ".gmi" files on the working path
|
||||
|
|
@ -46,15 +62,29 @@ do
|
|||
# deleting the '#' of the first line and save it as title
|
||||
title="$(sed -n '1{s/# //p}' "$gmi_file") $2"
|
||||
# escaping eventual '&' (otherwise causing a bug where it is replaced by '<\!-- TITLE -->')
|
||||
# shellcheck disable=SC2001
|
||||
title=$(echo "$title" | sed "s#&#\\\&#g")
|
||||
|
||||
# in the header.html, replacing the "<\-- TITLE -->" by the previously
|
||||
# saved title, and save the modified file in our temporary directory
|
||||
sed "s#<\!-- TITLE -->#${title}#" html/header.html > "$tempdir/header.html"
|
||||
sed "s#<\!-- TITLE -->#${title}#" "$header_template" > "$tempdir/header.html"
|
||||
|
||||
# convertig .gmi files in .html
|
||||
# converting .gmi files in .html
|
||||
/usr/local/bin/gmnitohtml < "$gmi_file" > "$tempdir/body.html"
|
||||
|
||||
cp "$tempdir/body.html" "$tempdir/work-body.html"
|
||||
|
||||
# trick to support h4 titles
|
||||
while IFS= read -r line; do
|
||||
if echo $ "$line" | grep -q "<h3># .*<\/h3>"; then
|
||||
fixed_line=${line//<h3># /<h4>} # replace '<h3># ' by '<h4>'
|
||||
fixed_line=${fixed_line//<\/h3>/<\/h4>} # replace '</h3>' by '</h4>'
|
||||
# shellcheck disable=SC2001
|
||||
fixed_line=$(echo "$fixed_line" | sed "s#&#\\\&#g") # escape eventual '&'
|
||||
sed -i "s^${line}^${fixed_line}^" "$tempdir/body.html"
|
||||
fi
|
||||
done < "$tempdir/work-body.html"
|
||||
|
||||
# retrieving of the path of the current .gmi file
|
||||
file_path="$(dirname "$gmi_file")"
|
||||
# retrieving of the filename of the current .gmi file, without its extension
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
</article>
|
||||
|
||||
<div class="footer">
|
||||
<p>Cette page est consultable via <a href="//gemini.circumlunar.space/">Gemini</a> à la même adresse.</p>
|
||||
<p>Made with <a href="https://codeberg.org/OniriCorpe/genlog">Genlog</a> and many executive dysfunction.</p>
|
||||
<!-- Generated on GEN_DATE with Genlog https://codeberg.org/OniriCorpe/genlog -->
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
|
@ -10,32 +10,68 @@
|
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
||||
|
||||
<style>
|
||||
a[href^="//"]::after,
|
||||
a[href^="http"]::after,
|
||||
a[href^="gemini"]::after {
|
||||
content: "";
|
||||
width: 0.7em;
|
||||
height: 0.7em;
|
||||
margin-left: 0.3em;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");
|
||||
background-size: contain;
|
||||
display: inline-block;
|
||||
a {
|
||||
color: var(--text-main);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #9d9d9d;
|
||||
}
|
||||
|
||||
article a::before {
|
||||
content: "➤ ";
|
||||
}
|
||||
|
||||
a[href^="//"]::before,
|
||||
a[href^="//"]:hover {
|
||||
color: #9211ce;
|
||||
}
|
||||
|
||||
a[href^="http"]::before,
|
||||
a[href^="http"]:hover {
|
||||
color: #006eff;
|
||||
}
|
||||
|
||||
|
||||
a[href^="gemini"]::before,
|
||||
a[href^="gemini"]:hover {
|
||||
color: #ff5e00;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
a::before, h1::before, h2::before, h3::before,
|
||||
blockquote::before, .footer {
|
||||
color: #505050
|
||||
a::before,
|
||||
h1::before,
|
||||
h2::before,
|
||||
h3::before,
|
||||
h4::before,
|
||||
blockquote::before,
|
||||
.footer {
|
||||
color: #9d9d9d;
|
||||
}
|
||||
|
||||
article a::before { content:"→ "; }
|
||||
h1::before { content:"# "; }
|
||||
h2::before { content:"## "; }
|
||||
h3::before { content:"### "; }
|
||||
blockquote::before { content:"> "; }
|
||||
h1::before {
|
||||
content: "# ";
|
||||
}
|
||||
|
||||
h2::before {
|
||||
content: "## ";
|
||||
}
|
||||
|
||||
h3::before {
|
||||
content: "### ";
|
||||
}
|
||||
|
||||
h4::before {
|
||||
content: "#### ";
|
||||
}
|
||||
|
||||
blockquote::before {
|
||||
content: "> ";
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 1em;
|
||||
|
|
|
|||
4
html/substitutes/.gitignore
vendored
Normal file
4
html/substitutes/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
Loading…
Add table
Add a link
Reference in a new issue