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) 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(): def main():
root = os.path.dirname(os.path.realpath(__file__)) root = os.path.dirname(os.path.realpath(__file__))
link_gv = os.path.join(root, 'link.gv') link_gv = os.path.join(root, 'link.gv')
@ -35,29 +54,13 @@ def main():
</header><main> </header><main>
<!-----------------------------------------------------------------------------> <!----------------------------------------------------------------------------->
<section id="home"> {nav('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>
<!-----------------------------------------------------------------------------> <!----------------------------------------------------------------------------->
<section id="home"> <section id="home">
<nav> {nav('home')}
<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>
Home Home
@ -67,13 +70,7 @@ Home
<section id="id"> <section id="id">
<nav> {nav('id')}
<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>
<img src="marc.jpeg" /> <img src="marc.jpeg" />
@ -214,13 +211,7 @@ Home
<section id="tilde"> <section id="tilde">
<nav> {nav('tilde')}
<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>
<ul> <ul>
<!--<li><a href="https://aussies.space/~mspe">aussies.space</a></li>--> <!--<li><a href="https://aussies.space/~mspe">aussies.space</a></li>-->
@ -258,13 +249,7 @@ Home
<section id="ed"> <section id="ed">
<nav> {nav('ed')}
<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>
<ul> <ul>
<li><a href="https://cnam.marc.beninca.link">CNAM</a></li> <li><a href="https://cnam.marc.beninca.link">CNAM</a></li>
@ -276,13 +261,7 @@ Home
<section id="lib"> <section id="lib">
<nav> {nav('lib')}
<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>
<ul> <ul>
<li><a href="https://marc-beninca.8b.io">8bio</a></li> <li><a href="https://marc-beninca.8b.io">8bio</a></li>