Default project previews and PDFs to route-D
uses_route_d still treated v1 as the default unless TEXRRA_ENGINE=route-d was set, so only the flat /preview endpoint had switched. Make route-D the default there too: an explicit engine parameter still wins, TEXRRA_ENGINE=v1 forces the old pipeline, and a route-D error now falls through to the v1 compiler instead of answering 422 (both preview and PDF). Because route-D follows pdfLaTeX's Letter default for geometry-less documents, the two server tests that asserted the v1 A4 page now ask for ?engine=v1 or expect 215.9mm. A new test starts a server without the environment variable and checks a project preview uses route-D's italic math face with no literal $.
This commit is contained in:
1 parent
a56d441513
commit
371f05baaa
4 files changed
+48
-23
No files matched your search
+12
-11
@@ -1299,13 +1299,13 @@ fn handle_project_request(
|
||||
if let Some(json) = route_d_cached_preview(&key) {
|
||||
return respond_json(request, 200, &preview_without_changes(&json));
|
||||
}
|
||||
return match route_d::project_preview_json_with_images(id, &expanded, &images) {
|
||||
match route_d::project_preview_json_with_images(id, &expanded, &images) {
|
||||
Ok(json) => {
|
||||
store_route_d_preview(key, json.clone());
|
||||
respond_json(request, 200, &json)
|
||||
return respond_json(request, 200, &json);
|
||||
}
|
||||
Err(error) => respond_api_error(request, 422, &error),
|
||||
};
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
match compiler.preview_json(&source, &file_name) {
|
||||
Ok(json) => respond_json(request, 200, &json),
|
||||
@@ -1329,13 +1329,13 @@ fn handle_project_request(
|
||||
if let Some(pdf) = route_d_cached_pdf(&key) {
|
||||
return respond_pdf_with_cache(request, pdf, "hit");
|
||||
}
|
||||
return match route_d::pdf_bytes_with_images(&expanded, &images) {
|
||||
match route_d::pdf_bytes_with_images(&expanded, &images) {
|
||||
Ok(pdf) => {
|
||||
store_route_d_pdf(key, &pdf);
|
||||
respond_pdf_with_cache(request, pdf, "miss")
|
||||
return respond_pdf_with_cache(request, pdf, "miss");
|
||||
}
|
||||
Err(error) => respond(request, 422, "text/plain; charset=utf-8", &error),
|
||||
};
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
match compiler.compile(&source, &file_name) {
|
||||
Ok(pdf) => respond_pdf(request, pdf),
|
||||
@@ -1384,14 +1384,15 @@ fn project_json(info: &projects::ProjectInfo) -> String {
|
||||
}
|
||||
|
||||
/// Chooses the renderer for a request. An explicit `engine` query parameter
|
||||
/// wins, then the deployment-wide `TEXRRA_ENGINE` default, then v1.
|
||||
/// wins, then `TEXRRA_ENGINE=v1` forces the old pipeline, and route-D is the
|
||||
/// default (with a v1 fallback when route-D rejects the source).
|
||||
fn uses_route_d(url: &str) -> bool {
|
||||
match query_param(url, "engine").as_deref() {
|
||||
Some("route-d") => true,
|
||||
Some(_) => false,
|
||||
None => std::env::var("TEXRRA_ENGINE")
|
||||
.map(|engine| engine == "route-d")
|
||||
.unwrap_or(false),
|
||||
.map(|engine| engine != "v1")
|
||||
.unwrap_or(true),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user