Based on work from citation-style-language/styles. It is thus licensed under: CC BY-SA 3.0 Deed.
I created it as an answer to typst/typst#3293.
/// Inserts a slice at a specific location in a vec. | |
pub fn insert_slice_at<T: Copy>(vec: &mut Vec<T>, index: usize, slice: &[T]) { | |
unsafe { | |
assert!(index <= vec.len()); | |
vec.reserve(slice.len()); | |
let insert_ptr = vec.as_mut_ptr().offset(index as isize); | |
std::ptr::copy( | |
insert_ptr, | |
insert_ptr.offset(slice.len() as isize), | |
vec.len() - index, |
#let data = ( | |
books: ( | |
(title: "The Final Empire", author: "Brandon Sanderson"), | |
(title: "The Sword of Kaigen", author: "M.L. Wang"), | |
), | |
query: 0, | |
) | |
#faux-jsonpath(data, "$.books[0].author") | |
#faux-jsonpath(data, "$.books[$.query].title") |
{ | |
"luckyBangUrl": "https://kagi.com/search?q=!+%q", | |
"siteFormat": "site:%d", | |
"orOperator": "OR", | |
"bangPrefix": "!", | |
"luckyBang": "!", | |
"siteBangSep": "@", | |
"superLuckyBangPrefix": "!!", | |
"multiBangDelim": ";", | |
"multiSiteBangDelim": ",", |
# Extract an archive using 7-Zip. | |
export def main [ | |
file: path | |
--output (-o): path | |
] { | |
let extension = $file | path parse | get extension | |
let compressor = match $extension { | |
bz2 | tb2 | tbz | tbz2 | tz2 => "bzip2" | |
gz | taz | tgz => "gzip" | |
lz => "lzip" |
Based on work from citation-style-language/styles. It is thus licensed under: CC BY-SA 3.0 Deed.
I created it as an answer to typst/typst#3293.
#set list(indent: 2em) | |
#show list: li => block({ | |
for it in li.children { | |
let nesting = state("list-nesting", 0) | |
let indent = context h((nesting.get() + 1) * li.indent) | |
let marker = context { | |
let n = nesting.get() | |
li.marker.at(calc.rem(n, li.marker.len())) | |
} | |
let body = { |