Append DOI fields to project bibliography entries

.format_bib_entry ignored the doi field, so the arXiv first reference lost its
doi:10.1109/... suffix. Append doi:<value> when present and extend the server
bib test fixture/assertions.

Test count stays 1078.
This commit is contained in:
gloamxun committed 2026-10-28 00:54:05 +08:00
1 parent eb2cb561bd
commit 1b0f4c8ab3
3 files changed
+7 -2

No files matched your search

+1 -1
View File
@@ -149,7 +149,7 @@ PDF was rendered page-by-page next to the route-D output.
| Table | booktabs rules, `Size (µm)`, `~100`, `10^6` | centred with rules; `Size (µm)`, `~100`, `10⁶` |
| Figure | framed rule box above the caption | centred framed rule body (raster) on page 3 |
| Display equation | fully typeset fraction/product/sum | approximate body; fraction box uses full extents, subscripts attach even after a space, and the tag sits at the right margin |
| References | author-year, italic venue, DOI link | author-year entries; plain venue text, no DOI |
| References | author-year, italic venue, DOI link | author-year entries; DOI appended when present in the .bib |
| Float order | figure/table on page 3 with section 3.4 | figure/table on page 3 above 3.3/3.4 |
After this comparison, the PDF page origin was fixed: the PDF writer had
+4
View File
@@ -1471,6 +1471,10 @@ fn format_bib_entry(fields: &[(String, String)]) -> Option<String> {
entry.push_str(", ");
entry.push_str(publisher);
}
if let Some(doi) = field("doi") {
entry.push_str(". doi:");
entry.push_str(doi);
}
Some(entry)
}
+2 -1
View File
@@ -1223,7 +1223,7 @@ fn project_preview_resolves_bibtex() {
"text/plain; charset=utf-8",
);
assert_eq!(put.status, 200, "{}", put.text());
let bib = "@article{alpha,\n title={Alpha entry},\n author={Doe, Jane},\n year={2024}\n}\n";
let bib = "@article{alpha,\n title={Alpha entry},\n author={Doe, Jane},\n year={2024},\n doi={10.1000/test}\n}\n";
let put = server.request(
"PUT",
"/api/projects/hello/file?path=refs.bib",
@@ -1255,6 +1255,7 @@ fn project_preview_resolves_bibtex() {
assert!(text.contains("References"), "{text}");
assert!(text.contains("Doe,2024"), "{text}");
assert!(text.contains("Alphaentry"), "{text}");
assert!(text.contains("doi:10.1000/test"), "{text}");
assert!(!text.contains("[?]"), "{text}");
}