6 Commits
v0.7 ... v0.8

5 changed files with 78 additions and 21 deletions

View File

@@ -1,53 +1,81 @@
.PHONY: view_example .PHONY: view_example
view_example: example.pdf view_example: documentation.pdf
xdg-open $< xdg-open $<
.PHONY: watch_example .PHONY: watch_documentation
watch_example: watch_documentation:
typst watch --font-path template/fonts example.typ & xdg-open example.pdf typst watch --font-path template/fonts documentation.typ & xdg-open documentation.pdf
.PHONY: example .PHONY: documentation
example: example.pdf documentation: documentation.pdf
PACKDIR := pack/tultemplate2
BUNDLEDIR := pack/bundle
TO_PACK := $(shell find template -type f) template/LICENSE TO_PACK := $(shell find template -type f) template/LICENSE
PACK_TARGETS := $(TO_PACK:%=pack/tultemplate2/%) pack/tultemplate2/example.typ \ BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/Makefile
pack/tultemplate2/citations.bib PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib
.PHONY: pack .PHONY: pack
pack: pack/tultemplate2.zip pack: pack/tultemplate2.zip
.PHONY: bundle
bundle: $(BUNDLE_TARGETS)
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf pack rm -rf pack
rm -f example.pdf rm -f documentation.pdf
pack/tultemplate2.zip: $(PACK_TARGETS) pack/tultemplate2.zip: $(PACK_TARGETS)
@mkdir -p $(@D) @mkdir -p $(@D)
rm -f $@ rm -f $@
cd pack && zip -r tultemplate2.zip tultemplate2 cd pack && zip -r tultemplate2.zip tultemplate2
pack/tultemplate2/%: % $(PACKDIR)/%: %
ln -f $< $@
pack/tultemplate2/template/LICENSE: LICENSE
@mkdir -p $(@D) @mkdir -p $(@D)
ln -f $< $@ ln -f $< $@
pack/tultemplate2/template/tul_citace.csl: template/tul_citace.csl $(BUNDLEDIR)/citations.bib:
@mkdir -p $(@D)
touch $@
$(BUNDLEDIR)/Makefile: templategen.mk
@mkdir -p $(@D)
ln -f $< $@
$(PACKDIR)/template/LICENSE: LICENSE
@mkdir -p $(@D)
ln -f $< $@
$(BUNDLEDIR)/template/LICENSE: LICENSE
@mkdir -p $(@D)
ln -f $< $@
$(PACKDIR)/template/tul_citace.csl $(BUNDLEDIR)/template/tul_citace.csl: template/tul_citace.csl
@mkdir -p $(@D) @mkdir -p $(@D)
cat $< | sed 's/^\s*\(.*\)$$/\1/' | tr -d '\n' > $@ cat $< | sed 's/^\s*\(.*\)$$/\1/' | tr -d '\n' > $@
pack/tultemplate2/template/lang.json: template/lang.json $(PACKDIR)/template/lang.json: template/lang.json
@mkdir -p $(@D) @mkdir -p $(@D)
cat $< | jq -c > $@ cat $< | jq -c > $@
pack/tultemplate2/template/%: template/% $(BUNDLEDIR)/template/lang.json: template/lang.json
@mkdir -p $(@D)
cat $< | jq -c > $@
$(PACKDIR)/template/%: template/%
@mkdir -p $(@D)
ln -f $< $@
$(BUNDLEDIR)/template/%: template/%
@mkdir -p $(@D) @mkdir -p $(@D)
ln -f $< $@ ln -f $< $@
TEMPLATE_SRCS := $(shell find template -type f) TEMPLATE_SRCS := $(shell find template -type f)
%.pdf: %.typ $(TEMPLATE_SRCS) documentation.pdf: documentation.typ $(TEMPLATE_SRCS)
typst compile --font-path template/fonts $< typst compile --font-path template/fonts $<
include tests/make.mk include tests/make.mk

View File

@@ -21,3 +21,5 @@ That will compile the example document and view it.
> [!IMPORTANT] > [!IMPORTANT]
> This repo uses git lfs to pull fonts. Please set it up (or download a packed build from releases). > This repo uses git lfs to pull fonts. Please set it up (or download a packed build from releases).
> When running in CLI - you'll want to include the embedded fonts:
> `typst compile --font-path template/fonts example.typ`

View File

@@ -91,7 +91,7 @@ opravdu hodně vám to usnadní práci.
// tohle je podnadpis :) // tohle je podnadpis :)
#heading( #heading(
level: 3, level: 2,
range(1, 6).map((v) => range(1, v).map((_) => "pod").join("") + "nadpisy").join(", ") + ", ..." range(1, 6).map((v) => range(1, v).map((_) => "pod").join("") + "nadpisy").join(", ") + ", ..."
)<chained_subheading> )<chained_subheading>
@@ -422,8 +422,14 @@ Zde je ukázka definice příloh (je také použita na konci tohoto ukázkového
```typst ```typst
#attachments( #attachments(
attach_link("Zdrojový kód této šablony", "https://git.zumepro.cz/tul/tultemplate2"), attach_link(
attach_content("Testovací obsah vygenerovaný Typstem", [Sem lze psát _stylovaný_ obsah.]), "Zdrojový kód této šablony",
"https://git.zumepro.cz/tul/tultemplate2"
),
attach_content(
"Testovací obsah vygenerovaný Typstem",
[Sem lze psát _stylovaný_ obsah.]
),
) )
``` ```

View File

@@ -4,6 +4,7 @@
#let base_font = "Inter"; #let base_font = "Inter";
#let mono_font = "Noto Sans Mono"; #let mono_font = "Noto Sans Mono";
#let mono_font_compensation = 1.3em;
#let serif_font = "Merriweather"; #let serif_font = "Merriweather";
#let tul_logomark_size = 6.5em; #let tul_logomark_size = 6.5em;
@@ -71,10 +72,17 @@
}; };
// other // other
show raw: set text(font: mono_font); show raw: set text(font: mono_font, size: mono_font_compensation);
show raw.where(block: true): it => { show raw.where(block: true): it => {
block(it, fill: rgb("#eee"), inset: 1em) block(it, fill: rgb("#eee"), inset: 1em)
}; };
show link: it => {
if type(it.dest) == label or type(it.dest) == location {
it;
} else {
text(it, fill: faculty_color);
}
}
set highlight(fill: faculty_color.lighten(90%)); set highlight(fill: faculty_color.lighten(90%));
content content

13
templategen.mk Normal file
View File

@@ -0,0 +1,13 @@
THESIS_FILE := thesis
TYPST_FONTPATH := --font-path template/fonts
.PHONY: watch
watch: $(THESIS_FILE).pdf
xdg-open $< & typst watch $(TYPST_FONTPATH) $(THESIS_FILE).typ
.PHONY: view
view: $(THESIS_FILE).pdf
xdg-open $<
%.pdf: %.typ
typst compile $(TYPST_FONTPATH) $<