From cbe3c1408838c98b7aeff80f276afb6f0a5102c2 Mon Sep 17 00:00:00 2001 From: Dominik Thalhammer Date: Thu, 4 Jul 2024 12:18:15 +0200 Subject: [PATCH] Add generated table of contents --- .github/workflows/deploy.yml | 2 +- grabrepos.py | 7 +++--- themes/b4/assets/scss/main.scss | 23 +++++++++++++++++-- themes/b4/layouts/_default/specification.html | 1 + 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a19aed3..60caefa 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ jobs: - name: Install requirements run: | pip install -r requirements.txt - wget https://github.com/gohugoio/hugo/releases/download/v0.102.3/hugo_extended_0.102.3_Linux-64bit.deb -O /tmp/hugo.deb + wget https://github.com/gohugoio/hugo/releases/download/v0.128.2/hugo_extended_0.128.2_linux-amd64.deb -O /tmp/hugo.deb sudo dpkg -i /tmp/hugo.deb - name: Build Website run: | diff --git a/grabrepos.py b/grabrepos.py index 557f4ee..d29c936 100755 --- a/grabrepos.py +++ b/grabrepos.py @@ -33,11 +33,10 @@ def dest_filepath(reponame, refname): return "spec-"+reponame+"-"+refname.replace(".","_") # Copy files to "docs/". Filter sections of file first. Add generated header to file. -def write_file(reponame, targetdir, srcdir, filename, data, tagname, date, absurl): +def write_file(reponame, targetdir, filename, data, tagname, date): # Generate version select box html code # Hide page in the left nav panel if not the latest header = "---\n" - header += "path: "+absurl+"\n" header += "source: "+filename+"\n" header += "version: "+tagname+"\n" header += "releasedate: "+date.strftime("%d. %B %Y")+"\n" @@ -114,7 +113,9 @@ def checkout_repo(targetdir, reponame, repourl, checkoutdir, update_repos): tagname = ref.name date = ref.commit.committed_datetime absurl = repourl.replace(".git","")+"/tree/"+ref.name - write_file(reponame, targetdir, localpath, mainfile, data, tagname, date, absurl) + write_file(reponame, targetdir, mainfile, data, tagname, date) + + shutil.copyfile(os.path.join(targetdir,dest_filepath(reponame, "develop")+".md"), os.path.join(targetdir,"_index.md")) refs = [] refs.extend(repo.tags) diff --git a/themes/b4/assets/scss/main.scss b/themes/b4/assets/scss/main.scss index 53246fd..b984a79 100644 --- a/themes/b4/assets/scss/main.scss +++ b/themes/b4/assets/scss/main.scss @@ -198,10 +198,13 @@ main pre { @media only screen and (min-width: 1500px) { .md-sidebar { display: block; - position: fixed; + position: absolute; top: 4.8rem; - overflow: hidden; + bottom: 0; + overflow-y: auto; + overflow-x: hidden; margin-left: 900px; + padding-right: 1rem; } } @@ -308,4 +311,20 @@ a.md-source:hover { table, h2+p, h3+p, h4+p, h5+p, code { page-break-inside: avoid; } +} + +*::-webkit-scrollbar { + width: 12px; +} + +*::-webkit-scrollbar-track { + border-radius: 8px; + background-color: #e7e7e7; + border: 1px solid #cacaca; + box-shadow: inset 0 0 6px rgba(0, 0, 0, .3); +} + +*::-webkit-scrollbar-thumb { + border-radius: 8px; + background-color: #363636; } \ No newline at end of file diff --git a/themes/b4/layouts/_default/specification.html b/themes/b4/layouts/_default/specification.html index 6cf0fb3..72d18ca 100644 --- a/themes/b4/layouts/_default/specification.html +++ b/themes/b4/layouts/_default/specification.html @@ -22,6 +22,7 @@

Homie: An MQTT Convention