syntax highlighting

This commit is contained in:
leo 2023-03-04 17:15:57 +01:00
parent fc88cd5943
commit 6e8c41af46
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB

View File

@ -10,7 +10,9 @@ in : a relative path as given by GITEA_PREFIX_SRC (https://docs.gitea.io/en-us/c
return : The name of the folder containing the cloned repo
"""
# Prefix for the path where repository are saved, can be an url
PATH_PREFIX = "/var/lib/gitea/git/repositories"
# Prefix for where we will clone the repos
CACHE_FOLDER_PATH = "/var/lib/gitea/markdown_cache"
import sys
@ -33,5 +35,4 @@ if not os.path.isdir(CACHE_FOLDER_PATH):
if not os.path.isdir(repo_name):
subprocess.run(["git", "clone", repo_path, repo_name], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
subprocess.run(["asciidoctor", "-s", "-a", "showtitle", "--out-file=-", f"--base-dir={repo_name}", "-"])
subprocess.run(["asciidoctor", "-a", "showtitle", "-a", "source-highlighter=highlight.js", "--out-file=-", f"--base-dir={repo_name}", "-"])