NativeElixirPdfUtilities.Validators.HtmlUrlValidator (native_elixir_pdf_utilities v1.1.0)
View SourcePrepares static document URLs independently of resource authorization.
The first HTML base[href] outside template and foreign trees supplies the
resolution base. :base_url supplies the fallback URL; local caller values
retain their existing directory meaning. Consumers must authorize resolved
resources against the original caller root, never against this context.
Anchor destinations are {:uri, url} or {:fragment, identifier}. The latter
requires final document target positions and must not be emitted as a URI.
This context contains no filesystem permissions and grants no access.
Summary
Functions
Admits an absolute initial input URL without granting resource access.
Classifies the HTML about:blank URL family without granting resource access.
Prepares the document's resolution base without changing caller permissions.
Prepares an authored base against an already validated document URL.
Resolves a static anchor into a URI or a same-document fragment destination.
Resolves a URL reference against a prepared base, without authorizing or reading it.
Prepares a resource reference for the existing authorized asset loader.
Tests an absolute initial URL input without a base or resource access.
Validates a base element's attributes and empty content.
Types
Functions
Admits an absolute initial input URL without granting resource access.
Classifies the HTML about:blank URL family without granting resource access.
@spec document_context( map(), keyword() ) :: {:ok, context()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Prepares the document's resolution base without changing caller permissions.
@spec document_context_from_url(map(), String.t() | nil) :: {:ok, context()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Prepares an authored base against an already validated document URL.
Unlike document_context/2, this preserves a child document's file URL as a
document URL. The caller supplies a validated parsed DOM and absolute fallback
URL, and retains ownership of authorization, document/tree identities and budgets.
@spec prepare_anchor(term(), context()) :: {:ok, destination()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Resolves a static anchor into a URI or a same-document fragment destination.
@spec resolve_reference(String.t(), String.t() | nil) :: {:ok, String.t()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Resolves a URL reference against a prepared base, without authorizing or reading it.
@spec resource_reference(String.t(), context()) :: {:ok, String.t()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Prepares a resource reference for the existing authorized asset loader.
@spec valid_initial_input_url?(term()) :: {:ok, boolean()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Tests an absolute initial URL input without a base or resource access.
@spec validate_base_element(map(), list()) :: :ok | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Validates a base element's attributes and empty content.