archivebox.core.templatetags.core_tags

Module Contents

Functions

_normalize_output_files

_coerce_output_file_size

_count_media_files

_list_media_files

_resolve_snapshot_output_file

_is_text_preview_path

_is_image_preview_path

_is_root_snapshot_output_path

_build_snapshot_files_url

_build_snapshot_preview_url

_render_text_preview

_render_fallback_card

_render_text_file_preview

split

index

file_size

result_list

Monkey patched result

result_list_tag

url_replace

admin_base_url

web_base_url

public_base_url

snapshot_base_url

snapshot_url

snapshot_preview_url

plugin_icon

Render the icon for a plugin.

plugin_card

Render the card template for an archive result.

output_card

plugin_full

Render the full template for an archive result.

plugin_name

Get the base name of a plugin (strips numeric prefix).

api_token

Return an API token string for the logged-in user, creating one if needed.

Data

register

_TEXT_PREVIEW_EXTS

_IMAGE_PREVIEW_EXTS

_MEDIA_FILE_EXTS

API

archivebox.core.templatetags.core_tags.register[source]

‘Library(…)’

archivebox.core.templatetags.core_tags._TEXT_PREVIEW_EXTS[source]

(‘.json’, ‘.jsonl’, ‘.txt’, ‘.csv’, ‘.tsv’, ‘.xml’, ‘.yml’, ‘.yaml’, ‘.md’, ‘.log’)

archivebox.core.templatetags.core_tags._IMAGE_PREVIEW_EXTS[source]

(‘.png’, ‘.jpg’, ‘.jpeg’, ‘.gif’, ‘.webp’, ‘.bmp’, ‘.ico’, ‘.avif’)

archivebox.core.templatetags.core_tags._MEDIA_FILE_EXTS[source]

None

archivebox.core.templatetags.core_tags._normalize_output_files(output_files: Any) dict[str, dict[str, Any]][source]
archivebox.core.templatetags.core_tags._coerce_output_file_size(value: Any) int | None[source]
archivebox.core.templatetags.core_tags._count_media_files(result) int[source]
archivebox.core.templatetags.core_tags._list_media_files(result) list[dict][source]
archivebox.core.templatetags.core_tags._resolve_snapshot_output_file(snapshot_dir: str | pathlib.Path | None, raw_output_path: str | None) pathlib.Path | None[source]
archivebox.core.templatetags.core_tags._is_text_preview_path(raw_output_path: str | None) bool[source]
archivebox.core.templatetags.core_tags._is_image_preview_path(raw_output_path: str | None) bool[source]
archivebox.core.templatetags.core_tags._is_root_snapshot_output_path(raw_output_path: str | None) bool[source]
archivebox.core.templatetags.core_tags._build_snapshot_files_url(snapshot_id: str, request=None) str[source]
archivebox.core.templatetags.core_tags._build_snapshot_preview_url(snapshot_id: str, path: str = '', request=None) str[source]
archivebox.core.templatetags.core_tags._render_text_preview(plugin: str, icon_html: str, snippet: str) str[source]
archivebox.core.templatetags.core_tags._render_fallback_card(plugin: str, icon_html: str, fallback_label: str) str[source]
archivebox.core.templatetags.core_tags._render_text_file_preview(snapshot_dir: str | pathlib.Path | None, raw_output_path: str | None, plugin: str, icon_html: str) str | None[source]
archivebox.core.templatetags.core_tags.split(value, separator: str = ',')[source]
archivebox.core.templatetags.core_tags.index(value, position)[source]
archivebox.core.templatetags.core_tags.file_size(num_bytes: int | float) str[source]
archivebox.core.templatetags.core_tags.result_list(cl)[source]

Monkey patched result

archivebox.core.templatetags.core_tags.result_list_tag(parser, token)[source]
archivebox.core.templatetags.core_tags.url_replace(context, **kwargs)[source]
archivebox.core.templatetags.core_tags.admin_base_url(context) str[source]
archivebox.core.templatetags.core_tags.web_base_url(context) str[source]
archivebox.core.templatetags.core_tags.public_base_url(context) str[source]
archivebox.core.templatetags.core_tags.snapshot_base_url(context, snapshot) str[source]
archivebox.core.templatetags.core_tags.snapshot_url(context, snapshot, path: str = '') str[source]
archivebox.core.templatetags.core_tags.snapshot_preview_url(context, snapshot, path: str = '') str[source]
archivebox.core.templatetags.core_tags.plugin_icon(plugin: str) str[source]

Render the icon for a plugin.

Usage: {% plugin_icon “screenshot” %}

archivebox.core.templatetags.core_tags.plugin_card(context, result) str[source]

Render the card template for an archive result.

Usage: {% plugin_card result %}

Context variables passed to template: - result: ArchiveResult object - snapshot: Parent Snapshot object - output_path: Path to output relative to snapshot dir (from embed_path()) - plugin: Plugin base name

archivebox.core.templatetags.core_tags.output_card(snapshot, output_path: str, plugin: str) str[source]
archivebox.core.templatetags.core_tags.plugin_full(context, result) str[source]

Render the full template for an archive result.

Usage: {% plugin_full result %}

archivebox.core.templatetags.core_tags.plugin_name(value: str) str[source]

Get the base name of a plugin (strips numeric prefix).

Usage: {{ result.plugin|plugin_name }}

archivebox.core.templatetags.core_tags.api_token(context) str[source]

Return an API token string for the logged-in user, creating one if needed.