diff --git a/build.sh b/build.sh index d044041..00fe50e 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,20 @@ #!/bin/bash +echo "Building..." +# Get repo URL +REPOSITORY=`git remote -v | grep fetch | tail -1 | \ + sed "s|.*\(github.com\):|https://\1/|g" | \ + sed "s/\(.git\)\? (.*//g" | \ + sed "s|.*\(https://github.com/\)|\1|g" | \ + sed "s|.*\(https://github.com/\)|\1|g"` + +echo "Repository set to '$REPOSITORY'" + # loop through all the files in the directory: for file in src/*.typ do # run the compiler - typst compile --format=pdf "$file" --font-path src/fonts + typst compile --format=pdf "$file" --font-path src/fonts --input "repository=$REPOSITORY" done + +echo "... Done!" diff --git a/src/audit.typ b/src/audit.typ index b1249c7..0a589aa 100644 --- a/src/audit.typ +++ b/src/audit.typ @@ -9,8 +9,7 @@ #show: report.with( client: "XXXXX", title: "XXXXX", - repo: "XXXXX", - date: "XXXXX", + // date: "XXXXX", // Default: Today. audited_files: audited_files, ) diff --git a/src/templates/report.typ b/src/templates/report.typ index 61feeb5..6cf1c39 100644 --- a/src/templates/report.typ +++ b/src/templates/report.typ @@ -25,6 +25,8 @@ link(url, underline(text(fill: rgb("#007bff"), content))) } +#let repository = sys.inputs.at("repository", default: "GitHub remote") + #let create_table = (tuples) => { table( columns: 1, @@ -53,9 +55,9 @@ client: "", title: "", authors: (), - date: none, + date: datetime.today().display("[day] [month repr:long] [year]"), audited_files: (), - repo: "", + repo: repository, is_draft: true, body, ) = {