Replace compilation with a temporary script.
This commit is contained in:
		
							parent
							
								
									4ec59a1414
								
							
						
					
					
						commit
						d27b64bd40
					
				|  | @ -2,3 +2,4 @@ | ||||||
| .vscode/ | .vscode/ | ||||||
| build/ | build/ | ||||||
| data/ | data/ | ||||||
|  | cv.typ | ||||||
|  |  | ||||||
|  | @ -23,12 +23,7 @@ args = ["trash", "build"] | ||||||
| [tasks.compile] | [tasks.compile] | ||||||
| clear = true | clear = true | ||||||
| dependencies = ["ensure-build-dir"] | dependencies = ["ensure-build-dir"] | ||||||
| command = "typst" | script = "./compile-cv.zsh" | ||||||
| args = [ |  | ||||||
|   "compile", |  | ||||||
|   "cv-${CV_LANG}.typ", |  | ||||||
|   "build/CV-Bauke-${CV_LANG}.pdf" |  | ||||||
| ] |  | ||||||
| 
 | 
 | ||||||
| # Ensure that the build directory exists.
 | # Ensure that the build directory exists.
 | ||||||
| [tasks.ensure-build-dir] | [tasks.ensure-build-dir] | ||||||
|  | @ -41,4 +36,4 @@ args = ["-p", "build"] | ||||||
| [tasks.watch] | [tasks.watch] | ||||||
| clear = true | clear = true | ||||||
| command = "watchexec" | command = "watchexec" | ||||||
| args = ["-e", "toml,typ", "--no-vcs-ignore", "makers build"] | args = ["-e", "toml,typ", "-i", "cv.typ", "--no-vcs-ignore", "makers build"] | ||||||
|  |  | ||||||
|  | @ -0,0 +1,20 @@ | ||||||
|  | #!/usr/bin/env zsh | ||||||
|  | 
 | ||||||
|  | # There's currently no way in Typst to provide values from the CLI in some way | ||||||
|  | # so until the next version lands and https://github.com/typst/typst/pull/2894 | ||||||
|  | # becomes available, a script that renders a template has to be it for now. | ||||||
|  | 
 | ||||||
|  | # Define options based on environment variables or use default values. | ||||||
|  | include_links=${CV_INCLUDE_LINKS:-"true"} | ||||||
|  | language=${CV_LANG:-"en"} | ||||||
|  | 
 | ||||||
|  | typst_template="#import \"main.typ\": cv | ||||||
|  | 
 | ||||||
|  | #cv( | ||||||
|  |   include_links: $include_links, | ||||||
|  |   language: \"$language\", | ||||||
|  | )" | ||||||
|  | 
 | ||||||
|  | echo $typst_template > cv.typ | ||||||
|  | 
 | ||||||
|  | typst compile cv.typ "build/CV-Bauke-$CV_LANG.pdf" | ||||||
		Reference in New Issue