Skip to content

Commit

Permalink
Separate template for index page
Browse files Browse the repository at this point in the history
  • Loading branch information
SuzanneSoy committed Nov 20, 2023
1 parent 71450c2 commit e877daf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
14 changes: 7 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
template() {
# usage: template TITLE CONTENTS_FILE PATH_TO_OUTPUT_WWW_ROOT RELATIVE_PATH_TO_OUTPUT_HTML
cat template.html \
| sed -e "/markdown-title-placeholder/a <title>$1</title>" \
cat "$1" \
| sed -e "/markdown-title-placeholder/a <title>$2</title>" \
-e '/markdown-title-placeholder/d' \
| sed -e "/markdown-content-placeholder/r $2" \
| sed -e "/markdown-content-placeholder/r $3" \
-e '/markdown-content-placeholder/d' \
| sed -e "s~placeholder-filepath~$4~g" \
> "$3/$4"
| sed -e "s~placeholder-filepath~$5~g" \
> "$4/$5"
}
for bounty in bounties/*.md; do
name="$(basename "$bounty" .md)"
template "LIGO Bounty $name" <(pandoc -f markdown -t html "$bounty") "$out/www/" "$name.html"
template "template.html" "LIGO Bounty $name" <(pandoc -f markdown -t html "$bounty") "$out/www/" "$name.html"
done
index_html_links() {
Expand All @@ -39,7 +39,7 @@
done
printf '%s\n' "</ul>"
}
template "LIGO Bounties" <(index_html_links) "$out/www/" "index.html"
template "template-index.html" "LIGO Bounties" <(index_html_links) "$out/www/" "index.html"
cp style.css sha256.js micro_ipfs.js "$out/www/"
cp www-ipfsignore "$out/www/.ipfsignore"
Expand Down
27 changes: 27 additions & 0 deletions template-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title class="markdown-title-placeholder">Bounty</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<p class="ipfs-permalink" id="ipfs-permalink"><a href="#">Permalink: ipfs://… (computing, please wait)</a></p>
<h1>LIGO bounty program</h1>
<p>The following tasks are open for third-party developers to claim. Please see the description of each task to learn about the process, the completion criteria and the associated payment or reward.</p>
<div class="markdown-content-placeholder"></div>
<script src="sha256.js"></script>
<script src="micro_ipfs.js"></script>
<script src="directory_hashes.js"></script>
<script>
(function() {
var hash = ipfs_self_hash.get_link();
var filepath = 'placeholder-filepath';
if (filepath == 'index.html') {
filepath = '';
}
document.getElementById('ipfs-permalink').innerHTML = '<a href="ipfs://' + hash + '/placeholder-filepath">Permalink: ipfs://'+hash.substring(0,4)+'…'+hash.substring(53)+'/'+filepath+'</a>';
})();
</script>
</body>
</html>

0 comments on commit e877daf

Please sign in to comment.