pub struct PublishedPages(/* private fields */);Expand description
Where each source document is actually published: the file the site serves, keyed by the source markdown’s file name.
[rewrite_doc_link] used to derive a link’s target from the link’s own
spelling — ../BUILD_PLAN_V2.md → ../BUILD_PLAN_V2.html — which is correct
only while every document is served under its own stem. Site pages ended
that: a page is published as its declared site-page: slug, and a slug is
URL-safe by construction ([a-z0-9-]+), so docs/BUILD_PLAN_V2.md is served
as build-plan-v2.html. The rewrite then pointed four correct repository
links at a page that is never emitted — issue #446, live on roteiro.dev.
So the served name is looked up rather than guessed. The renderer is handed the index of what the site emits, which is the only thing that knows the answer.
Keyed by file name rather than by full path because the site mirrors the
repository’s layout — docs/*.md at the root, docs/adr/*.md under adr/ —
so a link’s directory hops are already correct and only the final segment can
differ. A file name claimed by two published documents is recorded as
ambiguous and left unrewritten: guessing which one a link meant is how a
link silently points at the wrong page, which is worse than the 404 it
replaces.
Implementations§
Source§impl PublishedPages
impl PublishedPages
Sourcepub fn publish(&mut self, source_file: &str, served_as: &str)
pub fn publish(&mut self, source_file: &str, served_as: &str)
Record that source_file (a markdown file name, e.g. BUILD_PLAN_V2.md)
is served as served_as (e.g. build-plan-v2.html).
A second, differing claim on one file name makes it ambiguous; see the type’s documentation for why that is left unrewritten.
Trait Implementations§
Source§impl Clone for PublishedPages
impl Clone for PublishedPages
Source§fn clone(&self) -> PublishedPages
fn clone(&self) -> PublishedPages
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PublishedPages
impl Debug for PublishedPages
Source§impl Default for PublishedPages
impl Default for PublishedPages
Source§fn default() -> PublishedPages
fn default() -> PublishedPages
impl Eq for PublishedPages
Source§impl PartialEq for PublishedPages
impl PartialEq for PublishedPages
impl StructuralPartialEq for PublishedPages
Auto Trait Implementations§
impl Freeze for PublishedPages
impl RefUnwindSafe for PublishedPages
impl Send for PublishedPages
impl Sync for PublishedPages
impl Unpin for PublishedPages
impl UnsafeUnpin for PublishedPages
impl UnwindSafe for PublishedPages
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.