This commit is contained in:
Marc Beninca 2023-06-27 13:00:29 +02:00
parent 5a70e84617
commit 6a74eb8729

View file

@ -8,6 +8,25 @@ 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')
@ -35,29 +54,13 @@ def main():
</header><main>
<!----------------------------------------------------------------------------->
<section id="home">
<nav>
<a href="#home">Home</a>
<a href="#id">Identity</a>
<a href="#tilde">~</a>
<a href="#ed">Education</a>
<a href="#lib">LinkInBio</a>
</nav>
</section>
{nav('home')}
<!----------------------------------------------------------------------------->
<section id="home">
<nav>
<a class="active" href="#home">Home</a>
<a href="#id">Identity</a>
<a href="#tilde">~</a>
<a href="#ed">Education</a>
<a href="#lib">LinkInBio</a>
</nav>
{nav('home')}
Home
@ -67,13 +70,7 @@ Home
<section id="id">
<nav>
<a href="#home">Home</a>
<a class="active" href="#id">Identity</a>
<a href="#tilde">~</a>
<a href="#ed">Education</a>
<a href="#lib">LinkInBio</a>
</nav>
{nav('id')}
<img src="marc.jpeg" />
@ -214,13 +211,7 @@ Home
<section id="tilde">
<nav>
<a href="#home">Home</a>
<a href="#id">Identity</a>
<a class="active" href="#tilde">~</a>
<a href="#ed">Education</a>
<a href="#lib">LinkInBio</a>
</nav>
{nav('tilde')}
<ul>
<!--<li><a href="https://aussies.space/~mspe">aussies.space</a></li>-->
@ -258,13 +249,7 @@ Home
<section id="ed">
<nav>
<a href="#home">Home</a>
<a href="#id">Identity</a>
<a href="#tilde">~</a>
<a class="active" href="#ed">Education</a>
<a href="#lib">LinkInBio</a>
</nav>
{nav('ed')}
<ul>
<li><a href="https://cnam.marc.beninca.link">CNAM</a></li>
@ -276,13 +261,7 @@ Home
<section id="lib">
<nav>
<a href="#home">Home</a>
<a href="#id">Identity</a>
<a href="#tilde">~</a>
<a href="#ed">Education</a>
<a class="active" href="#lib">LinkInBio</a>
</nav>
{nav('lib')}
<ul>
<li><a href="https://marc-beninca.8b.io">8bio</a></li>