contrib/html: simplify handling of relative paths

This commit is contained in:
Christian Hesse 2025-11-17 11:03:02 +01:00
parent 269e1688e6
commit 6eeebb010d
2 changed files with 7 additions and 10 deletions

View file

@ -6,11 +6,8 @@ RELTO="$(dirname "${1}")"
sed \ sed \
-e "s|__TITLE__|$(head -n1 "${1}")|" \ -e "s|__TITLE__|$(head -n1 "${1}")|" \
-e "s|__STYLE__|$(realpath --relative-to="${RELTO}" general/style.css)|" \ -e "s|__GENERAL__|$(realpath --relative-to="${RELTO}" general/)|" \
-e "s|__LOGO__|$(realpath --relative-to="${RELTO}" logo.png)|" \ -e "s|__ROOT__|$(realpath --relative-to="${RELTO}" ./)|" \
-e "s|__EWORM__|$(realpath --relative-to="${RELTO}" general/eworm-meadow.avif)|" \
-e "s|__QR_CODE__|$(realpath --relative-to="${RELTO}" general/qr-code.png)|" \
-e "s|__CLIPBOARD__|$(realpath --relative-to="${RELTO}" general/clipboard.js)|" \
< "${0}.d/head.html" < "${0}.d/head.html"
markdown -f toc,idanchor "${1}" | sed \ markdown -f toc,idanchor "${1}" | sed \

View file

@ -1,14 +1,14 @@
<!DOCTYPE html><html lang="en"> <!DOCTYPE html><html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8"> <head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>RouterOS Scripts :: __TITLE__</title> <title>RouterOS Scripts :: __TITLE__</title>
<link rel="stylesheet" type="text/css" href="__STYLE__"> <link rel="stylesheet" type="text/css" href="__GENERAL__/style.css">
<link rel="icon" type="image/png" href="__LOGO__"> <link rel="icon" type="image/png" href="__ROOT__/logo.png">
<script type="text/javascript" src="__CLIPBOARD__"></script> <script type="text/javascript" src="__GENERAL__/clipboard.js"></script>
</head><body> </head><body>
<table><tr> <table><tr>
<td><img src="__EWORM__" alt="eworm on meadow" /></td> <td><img src="__GENERAL__/eworm-meadow.avif" alt="eworm on meadow" /></td>
<td><img src="__QR_CODE__" alt="QR code: rsc.eworm.de" /></td> <td><img src="__GENERAL__/qr-code.png" alt="QR code: rsc.eworm.de" /></td>
<td class="head"><span class="top">RouterOS Scripts</span><br /> <td class="head"><span class="top">RouterOS Scripts</span><br />
<span class="bottom">a collection of scripts for MikroTik RouterOS</span></td> <span class="bottom">a collection of scripts for MikroTik RouterOS</span></td>
</tr></table> </tr></table>