Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

refactor(engine): keep the moved docs' intra-doc links resolving (document, fill_sign)

alehel00596b69a6c4
diff --git a/crates/engine/src/document.rs b/crates/engine/src/document.rs
index 0c85f51af..7023caa55 100644
--- a/crates/engine/src/document.rs
+++ b/crates/engine/src/document.rs
@@ -59,7 +59,7 @@ pub struct Document {
/// XFA forms: what was approximated, rewritten or could not be written to the XFA data
/// (also in `info.warnings`, kept there when the document is re-read).
pub xfa_warnings: Vec<String>,
- /// What the last successful [`Session::apply`] wrote that its fonts can't draw: kept as typed,
+ /// What the last successful [`Session::apply`](crate::Session::apply) wrote that its fonts can't draw: kept as typed,
/// drawn with `?` in its place (see [`TextNotice`]). The interface shows it; tools return it.
pub edit_notices: Vec<TextNotice>,
}
@@ -440,7 +440,7 @@ impl Document {
}
/// A password restricts the document and it wasn't opened with the owner password: entering
- /// that password ([`Session::unlock`]) lifts the restrictions.
+ /// that password ([`Session::unlock`](crate::Session::unlock)) lifts the restrictions.
pub fn can_unlock(&self) -> bool {
self.editable() && self.permissions().is_some_and(|p| !unrestricted(&p))
}
@@ -629,7 +629,7 @@ pub fn display_bytes_for(bytes: Arc<Vec<u8>>, password: Option<&str>) -> Arc<Vec
/// The password to give the renderer (`inspect`, `PageRenderer`) for `bytes` opened with
/// `password`. The renderer authenticates only the user password of R2–R4 files, so for their
/// owner password this is the user password that owner authentication recovers; otherwise it is
-/// `password` itself. Render paths outside a [`Session`], such as the CLI, use this so the owner
+/// `password` itself. Render paths outside a [`Session`](crate::Session), such as the CLI, use this so the owner
/// password works there as it does in `doc_open`. A file that doesn't open with `password` keeps
/// it, so the renderer reports the same error it always did.
pub fn render_password_for(bytes: Arc<Vec<u8>>, password: Option<&str>) -> Option<String> {
diff --git a/crates/engine/src/fill_sign.rs b/crates/engine/src/fill_sign.rs
index 08739addf..1bd8c68d0 100644
--- a/crates/engine/src/fill_sign.rs
+++ b/crates/engine/src/fill_sign.rs
@@ -7,7 +7,7 @@ use crate::{Shape, script_outline, signature_image};
///
/// Left, centred and upright are as displayed on a page turned by `rotation` (its `/Rotate`):
/// the box runs along the displayed axes, like an image signature's
-/// ([`SignatureImage::rect`]), and the outlines are turned back so the name reads across.
+/// ([`SignatureImage::rect`](crate::SignatureImage::rect)), and the outlines are turned back so the name reads across.
pub fn typed_signature_shape(at: [f64; 2], text: &str, height: f64, rotation: i64) -> Option<Shape> {
let o = script_outline(text);
let [left, bottom, right, top] = o.bounds();