marc/build.py
Marc Beninca 6a74eb8729 nav/html
2023-06-27 13:00:29 +02:00

315 lines
13 KiB
Python
Executable file

#! /usr/bin/env python3
import os
import subprocess
def run(*args):
subprocess.call(args)
def link(active: str, id: str, text: str) -> str:
items = ['<a']
if (active == id):
items.append(' class="active"')
items.append(f' href="#{id}">{text}</a>')
return str().join(items)
def nav(active: str) -> str:
return f'''\
<nav>
{link(active, 'home', 'Home')}
{link(active, 'id', 'Identity')}
{link(active, 'tilde', '~')}
{link(active, 'ed', 'Education')}
{link(active, 'lib', 'LinkInBio')}
</nav>
'''
def main():
root = os.path.dirname(os.path.realpath(__file__))
link_gv = os.path.join(root, 'link.gv')
link_svg = os.path.join(root, 'link.svg')
run('dot', link_gv, '-Tsvg', '-o', link_svg)
with open(link_svg, 'br') as f:
link_text = f.read().decode('u8')
page_file = os.path.join(root, 'index.html')
page_text = f'''\
<!DOCTYPE html><html><head>
<!----------------------------------------------------------------------------->
<meta charset="UTF-8" />
<meta name="flattr:id" content="z3d26l" />
<link rel="stylesheet" href="index.css" />
<title>Marc Beninca</title>
<!----------------------------------------------------------------------------->
</head><body><header>
<!----------------------------------------------------------------------------->
<h1><a href="#home">Marc Beninca</a></h1>
<!----------------------------------------------------------------------------->
</header><main>
<!----------------------------------------------------------------------------->
{nav('home')}
<!----------------------------------------------------------------------------->
<section id="home">
{nav('home')}
Home
</section>
<!----------------------------------------------------------------------------->
<section id="id">
{nav('id')}
<img src="marc.jpeg" />
<ul>
<li><a href="https://linkedin.com/in/marc-beninca">LinkedIn</a></li>
</ul>
<table>
<tr><th colspan="2">OpenPGP</th></tr>
<tr><td colspan="2"><a href="https://marc.beninca.link/pgp.asc">marc.beninca.link</a></td></tr>
<tr><td colspan="2"><a href="https://meta.sr.ht/~marc_beninca.pgp">meta.sr.ht</a></td></tr>
<tr><td colspan="2"><a href="https://keys.openpgp.org/search?q=marc@beninca.link">keys.openpgp.org</a></td></tr>
<tr>
<th><a href="https://keybase.io/marc_beninca">Key<br>Base</a></th>
<th><a href="https://keyoxide.org/marc@beninca.link">Key<br>Oxide</a></th>
<th><a href="https://liberapay.com/marc.beninca">Libera<br>Pay</a></th>
<th><a href="https://utip.io/marc_beninca">U<br>Tip</a></th>
<th><a href="https://patreon.com/marc_beninca">Patreon</a></th>
<th><a href="https://tipeee.com/marc-beninca">Tip<br>eee</a></th>
</tr>
<tr>
<td />
<td colspan="2"><a href="https://mastodon.cloud/@marc_beninca">Mastodon</a></td>
<td colspan="3"><a href="https://discord.gg/v6p7CtZ4Zh">Discord</a></td>
</tr><tr>
<td><a href="https://dmoj.ca/user/marc_beninca">DMOJ</a></td>
<td colspan="2"><a href="https://gitlab.com/marc.beninca">GitLab</a></td>
<td colspan="2"><a href="https://youtube.com/@marc.beninca">YouTube</a></td>
</tr><tr>
<td><a href="https://galactictalk.org/u/marc_beninca">GalacticTalk</a></td>
<td colspan="2"><a href="https://poa.st/@marc_beninca">Pleroma</a></td>
<td></td>
<td><a href="https://facebook.com/marc.beninca.page">FaceBook</a></td>
</tr><tr>
<td><a href="https://omg.lol/marc-beninca">OMG.LOL</a></td>
<td><a href="https://pixelfed.social/marc.beninca">PixelFed</a></td>
<td><a href="https://openstreetmap.org/user/Marc Beninca">OpenStreetMap</a></td>
<td colspan="2"><a href="https://instagram.com/marc.beninca">Instagram</a></td>
</tr><tr>
<td colspan="2"><a href="https://reddit.com/user/marc_beninca">Reddit</a></td>
<td colspan="2"><a href="https://twitch.tv/marc_beninca">Twitch</a></td>
<td><a href="https://vimeo.com/marcbeninca">Vimeo</a></td>
</tr><tr>
<td colspan="5"><a href="https://twitter.com/marc_beninca">Twitter</a></td>
</tr><tr>
<td colspan="2"><a href="https://news.ycombinator.com/user?id=marc_beninca">HackerNews</a></td>
<td><a href="https://bitbucket.org/marc_beninca">BitBucket</a></td>
</tr><tr>
<td colspan="2"><a href="https://lobste.rs/u/marc_beninca">Lobsters</a></td>
<td><a href="https://linuxfr.org/users/marc-beninca">LinuxFR</a></td>
</tr><tr>
<td colspan="3"><a href="https://github.com/marc-beninca">GitHub</a></td>
</tr>
<tr><th colspan="2">DNS</th></tr>
<tr><td colspan="2"><a href="https://beninca.link">beninca.link</a></td></tr>
<tr><td colspan="2"><a href="https://computing.land">computing.land</a></td></tr>
<tr><td colspan="2">marc-beninca.fr</td></tr>
<tr><td colspan="2"><a href="https://rwx.work">rwx.work</a></td></tr>
<tr><td colspan="2"><a href="https://tilde.link">tilde.link</a></td></tr>
<tr><th /><th>GitLab</th></tr>
<tr><td /><td><a href="https://salsa.debian.org/marc.beninca">Debian</a></td></tr>
<tr><td /><td><a href="https://framagit.org/marc.beninca">FramaGit</a></td></tr>
<tr><td /><td><a href="https://lab.frogg.it/marc.beninca">FrogGit</a></td></tr>
<tr><td /><td><a href="https://gitgud.io/marc.beninca">GitGud</a></td></tr>
<tr><td /><td><a href="https://git.insomnia247.nl/marc.beninca">Insomnia</a></td></tr>
<tr><th /><th>Gitea</th></tr>
<tr><td /><td><a href="https://git.42l.fr/marc.beninca">42l</a></td></tr>
<tr><td /><td><a href="https://git.afpy.org/marc.beninca">AFPy</a></td></tr>
<tr><td /><td><a href="https://forge.chapril.org/marc.beninca">Chapril</a></td></tr>
<tr><td /><td><a href="https://codeberg.org/marc.beninca">CodeBerg</a></td></tr>
<tr><td /><td><a href="https://git.disroot.org/marc.beninca">DisRoot</a></td></tr>
<tr><td /><td><a href="https://git.froggi.es/marc.beninca">Froggies</a></td></tr>
<tr><td /><td><a href="https://git.fsfe.org/marc.beninca">FSFE</a></td></tr>
<tr><td /><td><a href="https://gitdab.com/marc.beninca">GitDab</a></td></tr>
<tr><td /><td><a href="https://gitea.com/marc.beninca">Gitea</a></td></tr>
<tr><td /><td><a href="https://git.projectsegfau.lt/marc.beninca">ProjectSegfault</a></td></tr>
<!--<tr><td /><td><a href="https://silica.codes/marc.beninca">SilicaCodes</a></td></tr>-->
<tr><td /><td><a href="https://tildegit.org/marc.beninca">TildeGit</a></td></tr>
<tr><th /><th><a href="https://stackexchange.com/users/27893631">StackExchange</a></th></tr>
<tr><td /><td><a href="https://meta.stackexchange.com/users/1332957">Meta</a></td></tr>
<tr><td /><td><a href="https://serverfault.com/users/1007137">ServerFault</a></td></tr>
<tr><td /><td><a href="https://stackoverflow.com/users/21299988">StackOverflow</a></td></tr>
<tr><td /><td><a href="https://tex.stackexchange.com/users/291075">TeX</a></td></tr>
<tr><td /><td><a href="https://unix.stackexchange.com/users/562508">Unix</a></td></tr>
</table>
<ul>
<li><a href="https://bsky.app/profile/marc-beninca.bsky.social">Blue Sky</a></li>
<li><a href="https://buymeacoffee.com/marc.beninca">Buy Me A Coffee</a></li>
<li><a href="https://cohost.org/marc-beninca">CoHost</a></li>
<li><a href="https://dev.to/marc_beninca">Dev</a></li>
<li><a href="https://diaspora-fr.org/people/00f4f8e04b11013b46b20025900e4586">Diaspora</a></li>
<li><a href="https://dlive.tv/marc.beninca">Dlive</a></li>
<li><a href="https://flattr.com/@marc.beninca">Flattr</a></li>
<li><a href="https://giftapp.com/marc_beninca">GiftApp</a></li>
<li><a href="https://kick.com/marc_beninca">Kick</a></li>
<li><a href="https://hashnode.com/@marc-beninca">HashNode</a></li>
<li><a href="https://medium.com/@marc-beninca">Medium</a></li>
<li><a href="https://marc-beninca.micro.blog/about">MicroBlog</a></li>
<li><a href="https://minds.com/marc_beninca">Minds</a></li>
<li><a href="https://odysee.com/@marc.beninca">Odysee</a></li>
<li><a href="https://paypal.me/MarcBeninca">PayPal</a></li>
<li><a href="https://peertube.iriseden.eu/a/marc_beninca">PeerTube</a></li>
<li><a href="https://pinterest.com/marc_beninca">Pinterest</a></li>
<li><a href="https://marcbeninca.podia.com">Podia</a></li>
<li><a href="https://app.revolt.chat/invite/01FREKCG3P2P0YMAHQSCPSW4GD">Revolt</a></li>
<li><a href="https://tiktok.com/@marc.beninca">TikTok</a></li>
<li><a href="https://twtxt.net/user/marc_beninca">YarnSocial</a></li>
</ul>
<ul>
<li><a href="https://gitee.com/marc_beninca">Gitee</a></li>
<li><a href="https://notabug.org/marc.beninca">NotABug</a></li>
<li><a href="https://pagure.io/user/marc-beninca">Pagure</a></li>
<li><a href="https://rocketgit.com/marc.beninca">RocketGit</a></li>
<li><a href="https://sr.ht/~marc_beninca/rwx.work/sources">SourceHut</a></li>
</ul>
<ul>
<li>Gforge</li>
</ul>
</section>
<!----------------------------------------------------------------------------->
<section id="tilde">
{nav('tilde')}
<ul>
<!--<li><a href="https://aussies.space/~mspe">aussies.space</a></li>-->
<li><a href="https://mspe.u.blinkenshell.org">blinkenshell.org</a></li>
<li><a href="https://ctrl-c.club/~mspe">ctrl-c.club</a></li>
<li><a href="https://mspe.dimension.sh">dimension.sh</a></li>
<li><a href="https://mspe.envs.net">envs.net</a></li>
<li><a href="https://mspe.fr.tild3.org">fr.tild3.org</a></li>
<li><a href="https://freeshell.de/~mspe">freeshell.de</a></li>
<li><a href="https://heathens.club/~mspe">heathens.club</a></li>
<li><a href="https://mspe.hextilde.xyz">hextilde.xyz</a></li>
<li><a href="https://mspe.insomnia247.nl">insomnia247.nl</a></li>
<li><a href="https://mspe.p.projectsegfau.lt">projectsegfau.lt</a></li>
<li><a href="https://mspe.remotes.club">remotes.club</a></li>
<li><a href="https://rw.rs/~mspe">rw.rs</a></li>
<li><a href="https://squiggle.city/~mspe">squiggle.city</a></li>
<!--<li><a href="https://thunix.net/~mspe">thunix.net</a></li>-->
<li><a href="https://mspe.tilde.cafe">tilde.cafe</a></li>
<li><a href="https://tilde.club/~mspe">tilde.club</a></li>
<li><a href="https://tilde.fun/~mspe">tilde.fun</a></li>
<li><a href="https://tilde.green/~mspe">tilde.green</a></li>
<li><a href="https://tilde.guru/~mspe">tilde.guru</a></li>
<li><a href="https://mspe.tilde.institute">tilde.institute</a></li>
<li><a href="https://tilde.pink/~mspe">tilde.pink</a></li>
<li><a href="https://mspe.tilde.team">tilde.team</a></li>
<li><a href="https://tilde.town/~mspe">tilde.town</a></li>
<li><a href="https://mspe.tildevarsh.in">tildevarsh.in</a></li>
<li><a href="https://trash.town/~mspe">trash.town</a></li>
<li><a href="https://mspe.vern.cc">vern.cc</a></li>
</ul>
</section>
<!----------------------------------------------------------------------------->
<section id="ed">
{nav('ed')}
<ul>
<li><a href="https://cnam.marc.beninca.link">CNAM</a></li>
</ul>
</section>
<!----------------------------------------------------------------------------->
<section id="lib">
{nav('lib')}
<ul>
<li><a href="https://marc-beninca.8b.io">8bio</a></li>
<li><a href="https://allmylinks.com/marc-beninca">AllMyLinks</a></li>
<li><a href="https://beacons.ai/marc.beninca">Beacons</a></li>
<li><a href="https://bioin.link/marc.beninca">BioInLink</a></li>
<li><a href="https://marc_beninca.bio.link">Bio.Link</a></li>
<li><a href="https://biolinky.co/marcbeninca">BioLinky</a></li>
<li><a href="https://marc_beninca.c8ke.com">C8ke</a></li>
<li><a href="https://campsite.bio/marc.beninca">CampSite</a></li>
<li><a href="https://marc-beninca.carrd.co">Carrd</a></li>
<li><a href="https://direct.me/marc_beninca">DirectMe</a></li>
<li><a href="https://everlink.tools/marc.beninca">EverLink</a></li>
<li><a href="https://feedlink.io/marcbeninca">FeedLink</a></li>
<li><a href="https://flow.page/marc.beninca">FlowPage</a></li>
<li><a href="https://heylink.me/marc.beninca">HeyLinkMe</a></li>
<li><a href="https://hy.page/marcbeninca">HyPage</a></li>
<li><a href="https://ichi.gg/marc.beninca">Ichi.GG</a></li>
<li><a href="https://linkfly.to/marc-beninca">LinkFly</a></li>
<li><a href="https://instabio.cc/marc-beninca">LinkInBio</a></li>
<li><a href="https://linkpluto.com/marc-beninca">LinkPluto</a></li>
<li><a href="https://linkpop.com/marc-beninca">LinkPop</a></li>
<li><a href="https://linkr.bio/marc.beninca">Linkr.Bio</a></li>
<li><a href="https://linksight.me/marc_beninca">LinkSight</a></li>
<li><a href="https://linktr.ee/marc.beninca">LinkTree</a></li>
<li><a href="https://lnk.bio/marc.beninca">Lnk.Bio</a></li>
<li><a href="https://lu.ma/marc.beninca">Luma</a></li>
<li><a href="https://nano.site/marc.beninca">NanoSite</a></li>
<li><a href="https://marcbeninca.podia.com">Podia</a></li>
<li><a href="https://solo.to/marc.beninca">SoloTo</a></li>
<li><a href="https://marc-beninca.start.page">StartPage</a></li>
<li><a href="https://tap.bio/marc.beninca">Tap.Bio</a></li>
<li><a href="https://marc-beninca.taplink.ws">TapLink</a></li>
<li><a href="https://url.bio/marc_beninca">URL.Bio</a></li>
<li><a href="https://wlo.link/@marc_beninca">Willow</a></li>
<li><a href="https://withkoji.com/@marc.beninca">WithKoji</a></li>
<li><a href="https://zaap.bio/marc.beninca">Zaap</a></li>
</ul>
</section>
<!----------------------------------------------------------------------------->
</main></body></html>
'''
# {link_text}
with open(page_file, 'bw') as f:
f.write(page_text.encode('u8'))
if __name__ == '__main__':
main()