From eb5b908d0cba1959673b0bebcee1c629bd29d7d2 Mon Sep 17 00:00:00 2001 From: litlighilit Date: Sat, 4 Jan 2025 03:42:30 +0800 Subject: [PATCH] doc(index): add link to homepage --- .github/workflows/docs.yml | 2 +- src/pylib.nim | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b0a105cd1..040ce595f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -27,7 +27,7 @@ jobs: with: nim-version: ${{ env.nim-version }} - name: genDoc - run: nimble testDoc --index:on --project ${{ env.git-url-arg }} --outdir:${{ env.deploy-dir }} + run: nimble testDoc --index:on --project ${{ env.git-url-arg }} --outdir:${{ env.deploy-dir }} -d:homepage="${{ github.event.repository.homepage }}" - name: genLibDoc run: nimble testLibDoc ${{ env.git-url-arg }} --outdir:${{ env.lib-deploy-dir }} - name: "Copy to index.html" diff --git a/src/pylib.nim b/src/pylib.nim index 3dd1296cd..eabe2d023 100755 --- a/src/pylib.nim +++ b/src/pylib.nim @@ -14,14 +14,19 @@ when defined(nimdoc): import std/strformat macro doc(s: static[string]): untyped = newCommentStmtNode s + template hs(s): string = "https://" & s const - RepoUrl = "https://github.com/nimpylib/pylib" + RepoUrl = hs"github.com/nimpylib/pylib" ReadmeUrl = RepoUrl & "?tab=readme-ov-file#nimpylib" WikiUrl = RepoUrl & "/wiki" template link(name, url: string): string = "[" & name & "](" & url & ")" + const + homepage{.strdefine.} = hs"nimpylib.github.io/pylib" + doc "> Welcome to **NimPyLib** :sub:`" & Version & "`" # Nim's Markdown is RST-extended - doc fmt"""- link to {link("repo", ReadmeUrl)}, {link("wiki", WikiUrl)}""" + doc fmt"""- link to {link("repo", ReadmeUrl)}, {link("wiki", WikiUrl)} +""" & link("home", homepage) ## .. include:: ../doc/pylib.md doc ".. warning:: " & WarnLeniOps