fix: render full bibliography

This commit is contained in:
Maciej Jur 2024-05-02 11:07:49 +02:00
parent 4446ca744d
commit 4889ce541e
Signed by: kamov
GPG key ID: 191CBFF5F72ECAFD
9 changed files with 70 additions and 53 deletions

10
Cargo.lock generated
View file

@ -898,6 +898,7 @@ dependencies = [
"tree-sitter-python",
"tree-sitter-regex",
"tree-sitter-rust",
"tree-sitter-scheme",
"tree-sitter-toml",
"tree-sitter-typescript",
]
@ -1117,6 +1118,15 @@ dependencies = [
"tree-sitter",
]
[[package]]
name = "tree-sitter-scheme"
version = "0.6.0"
source = "git+https://github.com/6cdh/tree-sitter-scheme?rev=85b6188fb77c03dfb01d13e58e2844450506860c#85b6188fb77c03dfb01d13e58e2844450506860c"
dependencies = [
"cc",
"tree-sitter",
]
[[package]]
name = "tree-sitter-toml"
version = "0.20.0"

View file

@ -34,5 +34,6 @@ tree-sitter-md = "0.1"
tree-sitter-python = "0.20"
tree-sitter-regex = "0.20"
tree-sitter-rust = "0.20"
tree-sitter-scheme = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "85b6188fb77c03dfb01d13e58e2844450506860c" }
tree-sitter-toml = "0.20"
tree-sitter-typescript = "0.20"

View file

@ -11,22 +11,22 @@ date: 2023-12-17T12:47:29.753Z
あくる日、親に引かれている橇で乗っている嬉しそうな子供を見た。
あらゆる公園が白くなって、白すぎて見えた。
![白すぎる公園](@assets/posts/hisasiburi-no-toukou/IMG_20231204_105929.jpg)
![白すぎる公園](IMG_20231204_105929.jpg)
その時から雪が全部解けちゃった。
最近、ヴロツワフではクリスマスマーケットが始まっているので、見に行った。
そこでたくさんの人がいて、いろんな出店もあり、色々なものを買って楽しむことができた。
![眩しいクリスマスライト](@assets/posts/hisasiburi-no-toukou/IMG_20231209_182036.jpg)
![眩しいクリスマスライト](IMG_20231209_182036.jpg)
もっと進んでいくと、大きなレストランみたいなビルに出くわしたんだ。
あのビルでは、「グジャニエッツ」という飲み物を買って楽しむことができた。
![グジャニエッツのビル](@assets/posts/hisasiburi-no-toukou/IMG_20231209_183410.jpg)
![グジャニエッツのビル](IMG_20231209_183410.jpg)
グジャニエッツとは、ポーランドの伝統的な温かいスパイス入りの飲み物。
通常は赤ワインやオレンジ、シナモン、クローブが使われる。
クリスマスマーケットってとても素晴らしいイベントの一つだけど、値段が高く過ぎるからあんまり買い物しなかったwww
クリスマスマーケットってとても素晴らしいイベントの一つだけど、
値段が高く過ぎるからあんまり買い物しなかったwww

View file

@ -241,41 +241,3 @@ scala
### Rust
rust
## Bibliography
:::bibtex
@inproceedings{10.1145/1238844.1238856,
author = {Hudak, Paul and Hughes, John and Peyton Jones, Simon and Wadler, Philip},
title = {A History of Haskell: Being Lazy with Class},
year = {2007},
isbn = {9781595937667},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/1238844.1238856},
doi = {10.1145/1238844.1238856},
abstract = {This paper describes the history of Haskell, including its genesis and principles, technical contributions, implementations and tools, and applications and impact.},
booktitle = {Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages},
pages = {1211255},
location = {San Diego, California},
series = {HOPL III}
}
@online{youtube,
title = {Escape from the ivory tower: the Haskell journey},
date = {2017},
organization = {Youtube},
author = {Simon {Peyton Jones}},
url = {https://youtu.be/re96UgMk6GQ},
}
@book{skinner2023effective,
title = {Effective Haskell: Solving Real-World Problems with Strongly Typed Functional Programming},
author = {Skinner, R.},
isbn = {9781680509342},
series = {Pragmatic Bookshelf},
year = {2023},
publisher = {O'Reilly Media}
}
:::

View file

@ -0,0 +1,32 @@
@inproceedings{10.1145/1238844.1238856,
author = {Hudak, Paul and Hughes, John and Peyton Jones, Simon and Wadler, Philip},
title = {A History of Haskell: Being Lazy with Class},
year = {2007},
isbn = {9781595937667},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/1238844.1238856},
doi = {10.1145/1238844.1238856},
abstract = {This paper describes the history of Haskell, including its genesis and principles, technical contributions, implementations and tools, and applications and impact.},
booktitle = {Proceedings of the Third ACM SIGPLAN Conference on History of Programming Languages},
pages = {1211255},
location = {San Diego, California},
series = {HOPL III}
}
@online{youtube,
title = {Escape from the ivory tower: the Haskell journey},
date = {2017},
organization = {Youtube},
author = {Simon {Peyton Jones}},
url = {https://youtu.be/re96UgMk6GQ},
}
@book{skinner2023effective,
title = {Effective Haskell: Solving Real-World Problems with Strongly Typed Functional Programming},
author = {Skinner, R.},
isbn = {9781680509342},
series = {Pragmatic Bookshelf},
year = {2023},
publisher = {O'Reilly Media}
}

View file

@ -1,4 +1,6 @@
use std::{collections::HashSet, fs::{self, File}, io::Write} ;
use std::collections::HashSet;
use std::fs::{self, File};
use std::io::Write;
use camino::{Utf8Path, Utf8PathBuf};
use glob::glob;

View file

@ -183,9 +183,7 @@ fn to_index<T>(item: PipelineItem) -> PipelineItem
_ => return item,
};
// FIXME: clean this up
let dir = meta.path.parent().unwrap();
let dir = dir.strip_prefix("content").unwrap();
let dir = meta.path.parent().unwrap().strip_prefix("content").unwrap();
let dir = match meta.path.file_stem().unwrap() {
"index" => dir.to_owned(),
name => dir.join(name),
@ -223,8 +221,7 @@ fn to_bundle(item: PipelineItem) -> PipelineItem {
_ => return item,
};
let dirs = meta.path.strip_prefix("content").unwrap().parent().unwrap();
let path = dirs.join(meta.path.file_name().unwrap()).to_owned();
let path = meta.path.strip_prefix("content").unwrap().to_owned();
match meta.path.extension() {
// any image
@ -308,7 +305,7 @@ fn main() {
kind: Asset {
kind: gen::AssetKind::Html(Box::new(|_| {
let data = std::fs::read_to_string("content/index.md").unwrap();
let (_, html, bib) = text::md::parse(&data, None);
let (_, html, _) = text::md::parse(&data, None);
html::home(Raw(html)).render().to_owned().into()
})).into(),
meta: gen::FileItem {

View file

@ -88,6 +88,9 @@ fn make_bib<'a, 'b>(stream: Vec<Event<'a>>, lib: &'b Library) -> (Vec<Event<'a>>
}
}
// add fake citation to make all entries show up
driver.citation(CitationRequest::from_items(lib.iter().map(CitationItem::with_entry).collect(), &STYLE, &LOCALE));
let res = driver.finish(BibliographyRequest { style: &STYLE, locale: None, locale_files: &LOCALE });
let mut n = 0;

View file

@ -24,14 +24,15 @@ pub static EXTENSIONS: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(||
("md", "markdown"),
("mdx", "markdown"),
("py", "python"),
("query", "query"),
// ("scm", "scheme"),
("scss", "scss"),
("query", "scheme"),
("scm", "scheme"),
("scss", "css"),
("ts", "javascript"),
("typescript", "javascript")
])
});
#[inline(always)]
fn config_for(
lang: Language,
highlights: &str,
@ -142,6 +143,15 @@ pub static CONFIGS: Lazy<HashMap<&'static str, HighlightConfiguration>> = Lazy::
"",
)
),
(
"scheme",
config_for(
tree_sitter_scheme::language(),
tree_sitter_scheme::HIGHLIGHTS_QUERY,
"",
"",
)
),
(
"toml",
config_for(