graph, search, api_catalog pages: back/forward history stack (PanelNav/dpNav). File artifact paths open in external tabs via card.repo (Gitea source URL) or card.docs (cargo docs for .rs) — openFile/openFileInPanel removed from all pages. Tera | safe required for URL values inside <script> blocks (auto-escape of slashes). card.ncl: repo field added. insert_brand_ctx: injects card_repo/card_docs into Tera context. #[onto_api] proc-macro: source_file = file!() emitted; ApiRouteEntry.source_file populated in primary catalog handler. migration 0007-card-repo-field: check card.ncl for repo field; skip if absent.
31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
{
|
|
id = "0007",
|
|
slug = "card-repo-field",
|
|
description = "Add repo field to card.ncl for UI file-path navigation to the project repository",
|
|
check = {
|
|
tag = "NuCmd",
|
|
cmd = "let f = $\"($env.ONTOREF_PROJECT_ROOT)/card.ncl\"; if not ($f | path exists) { exit 0 }; let r = (do { ^rg -q 'repo\\s*=' $f } | complete); if $r.exit_code == 0 { exit 0 } else { exit 1 }",
|
|
expect_exit = 0,
|
|
},
|
|
instructions = "
|
|
Open card.ncl and add a repo field pointing to the project source repository.
|
|
The field must be a full URL (Gitea, GitHub, Sourcehut, etc.).
|
|
|
|
Example:
|
|
repo = \"https://repo.example.com/owner/project\",
|
|
|
|
The daemon injects this value as card_repo into every Tera template.
|
|
srcOpen() in graph, search, and api_catalog pages uses it to build the URL:
|
|
{repo}/src/branch/main/{path}
|
|
|
|
If the project also publishes cargo docs, add:
|
|
docs = \"https://docs.example.com/project\",
|
|
|
|
That value is injected as card_docs. For .rs file paths, srcOpen() opens
|
|
docs instead of the source file (cargo doc output is more useful than raw source).
|
|
|
|
Verify card.ncl still exports cleanly:
|
|
nickel export --import-path \"$NICKEL_IMPORT_PATH\" card.ncl > /dev/null && echo ok
|
|
",
|
|
}
|