feat: write template
This commit is contained in:
commit
a0a6d2cf84
98 files changed
+6609
No files matched your search
+134
@@ -0,0 +1,134 @@
|
||||
// Execute: `git ls-files > ../../07_Anhang/source-paths.txt` while in the code directory
|
||||
#import "../pallete.typ": palette
|
||||
#import "@preview/shadowed:0.3.0": shadow
|
||||
|
||||
#let excluded = (
|
||||
"package-lock.json",
|
||||
"go.sum",
|
||||
".vscode",
|
||||
".husky",
|
||||
".npmrc",
|
||||
)
|
||||
|
||||
#let generated = (
|
||||
"package.json",
|
||||
"go.mod",
|
||||
"tsconfig.",
|
||||
"jestGlobalMocks.ts",
|
||||
"setupJest.ts",
|
||||
"jest.config.ts",
|
||||
"jest.config.js",
|
||||
"styles.scss",
|
||||
"index.html",
|
||||
".browserslistrc",
|
||||
".editorconfig",
|
||||
".prettierrc",
|
||||
".npmrc",
|
||||
".husky",
|
||||
"code-project",
|
||||
"eslint.config.mjs",
|
||||
"angular.json",
|
||||
"api.gen.go",
|
||||
".bru",
|
||||
)
|
||||
|
||||
#let generated-changed = (
|
||||
"angular.json",
|
||||
)
|
||||
|
||||
#let refs = (
|
||||
"schema.cql": "schema-cql",
|
||||
"kafka-startup.sh": "kafka-startup",
|
||||
"service_test.go": "journal-integrationtest",
|
||||
"auto-backup": "auto-backup",
|
||||
)
|
||||
|
||||
#let code(files: (), generated: generated, excluded: excluded) = {
|
||||
show figure.where(kind: raw): set block(breakable: true)
|
||||
|
||||
// Sort files by path
|
||||
let sorted-files = files.sorted(key: f => f.path)
|
||||
|
||||
for file in sorted-files {
|
||||
let path = file.path
|
||||
if excluded.any(ex => path.contains(ex)) {
|
||||
continue
|
||||
}
|
||||
|
||||
let content = file.content
|
||||
|
||||
let refkey = refs.keys().find(r => path.contains(r))
|
||||
let ref = if refkey != none { refs.at(refkey) } else { none }
|
||||
|
||||
let filetype = path.split(".").last()
|
||||
|
||||
let map = (
|
||||
kt: "kotlin",
|
||||
sh: "bash",
|
||||
ts: "typescript",
|
||||
scss: "css",
|
||||
html: "html",
|
||||
go: "go",
|
||||
mod: "gomod",
|
||||
gitignore: "gitignore",
|
||||
json: "json",
|
||||
"Dockerfile": "Dockerfile",
|
||||
cql: "sql",
|
||||
yaml: "yml",
|
||||
yml: "yml",
|
||||
example: "env", // .env.exampln
|
||||
md: "markdown",
|
||||
js: "js",
|
||||
mjs: "js",
|
||||
Makefile: "make",
|
||||
makefile: "make",
|
||||
)
|
||||
|
||||
if map.keys().contains(filetype) {
|
||||
filetype = map.at(filetype)
|
||||
} else {
|
||||
filetype = "text"
|
||||
}
|
||||
|
||||
[
|
||||
// #show heading: it => {
|
||||
// let h1 = query(metadata.where(value: path).before(here()))
|
||||
// if h1.len() != 0 and h1.first().location().position().y > page.height * .8 {
|
||||
// pagebreak()
|
||||
// }
|
||||
// it
|
||||
// }
|
||||
// #show figure: set block(breakable: true)
|
||||
//
|
||||
|
||||
|
||||
|
||||
#show heading.where(level: 3): it => {
|
||||
let threshold = 20%
|
||||
block(breakable: false, height: threshold, spacing: 0pt)
|
||||
v(-threshold)
|
||||
it
|
||||
}
|
||||
|
||||
#metadata(path)
|
||||
#heading(outlined: false, level: 3)[
|
||||
#path #if generated.any(gen => path.contains(gen)) { [ | Generiert ] }
|
||||
]
|
||||
|
||||
#figure(
|
||||
block(
|
||||
stroke: 0.5pt + palette.ui.border,
|
||||
width: 100%,
|
||||
inset: 5pt,
|
||||
fill: white,
|
||||
)[
|
||||
#set align(left)
|
||||
#raw(content, block: true, lang: filetype, align: start)
|
||||
],
|
||||
placement: none,
|
||||
caption: [Datei #path],
|
||||
)
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user