mirror of
https://github.com/danbulant/introductionToProgramming
synced 2026-05-19 04:18:32 +00:00
experiment with formatting
This commit is contained in:
parent
a475669d50
commit
94711b2ec7
6 changed files with 60 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
*.zip
|
||||
*.pdf
|
||||
*.pdf
|
||||
result*
|
||||
5
DEVELOP.md
Normal file
5
DEVELOP.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
When a command runner is desired in the function, query functionality can be used.
|
||||
|
||||
In `common/common.typ`, there's a `runCommand` function.
|
||||
|
||||
This can be queried using `typst query --input prequery-fallback=true --field value doc.typ '<cmd>'`. For more info see https://typst.app/universe/package/prequery.
|
||||
4
build.nu
4
build.nu
|
|
@ -10,4 +10,6 @@ each { |folder|
|
|||
let zip = ("../" + $folder + ".zip")
|
||||
rm -f $zip
|
||||
7z a $zip *
|
||||
}
|
||||
}
|
||||
|
||||
typst compile main.typ
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
#import "@preview/prequery:0.2.0": prequery
|
||||
|
||||
#let template(doc) = [
|
||||
#set page(height: auto)
|
||||
#show link: underline
|
||||
#set quote(block: true)
|
||||
#doc
|
||||
]
|
||||
#let template(doc) = context {
|
||||
if target() != "html" {
|
||||
set page(height: auto)
|
||||
}
|
||||
show link: underline
|
||||
set quote(block: true)
|
||||
doc
|
||||
}
|
||||
|
||||
#let embedClass(name: str, label: none) = {
|
||||
show figure: set block(width: 100%)
|
||||
|
|
@ -14,4 +17,18 @@
|
|||
#figure(caption: name, kind: "Class", supplement: [Class], raw(read("../" + name + ".java"), lang:"java", block: true))
|
||||
#label
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
#let runCommand(cmd: str, ..args) = prequery(
|
||||
(data: cmd, path: args.pos().at(0)),
|
||||
<cmd>,
|
||||
() => {
|
||||
let output = read(..args)
|
||||
raw(block: true, output)
|
||||
},
|
||||
fallback: [
|
||||
```
|
||||
...
|
||||
```
|
||||
]
|
||||
)
|
||||
23
main.typ
Normal file
23
main.typ
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#set document(
|
||||
title: "Introduction to Programming - Exercise solutions",
|
||||
author: "Daniel Bulant"
|
||||
)
|
||||
|
||||
= Introduction to Programming
|
||||
|
||||
Collection of solutions to programming exercises as part of Introduction to Programming (EN), taught by Magnus Madsen.
|
||||
|
||||
#outline()
|
||||
|
||||
#outline(
|
||||
title: [Classes],
|
||||
target: figure.where(kind: "Class")
|
||||
)
|
||||
|
||||
#{
|
||||
let count = 5;
|
||||
for week in range(1, count + 1) {
|
||||
let a = "./week" + str(week) + "/doc.typ"
|
||||
include a
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,11 @@
|
|||
pkgs.mkShell rec {
|
||||
buildInputs = with pkgs; [
|
||||
jdk
|
||||
typst
|
||||
];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
jre
|
||||
];
|
||||
|
||||
TYPST_FEATURES = "html";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue