取消 [[頁名]] 與 [[顯示文字|頁名]] 兩種同 wiki 寫法,不再分「同存取庫」與 「跨存取庫」兩條規則。那種寫法只在自己那個 wiki 內解析,寫錯不報錯,畫面上 看起來像普通文字或死連結,巡不到也修不了。 連結寫進頁面前先過 jsc-gitea 的 link-check.sh,結束碼 0 才寫。驗證一律走 API, 不看網頁狀態碼:私有存取庫的網頁網址對未登入請求一律回 404,拿狀態碼判會把 好連結判成壞的。認證失敗回 7,與死連結的 1 分開,免得金鑰一過期就把還在的頁 整批判死。
5.8 KiB
name, description
| name | description |
|---|---|
| html-export | Export one Gitea wiki page or issue as a single self-contained HTML file. Parse the link with tools/gitea-link.sh, resolve that kind's layout and style through tools/html-style.sh (kind, then DEFAULT, then the built-in report/minimal), then render with tools/html-render.sh, which puts the markdown through Gitea's own renderer and inlines every asset. A request without a wiki or issue link stops the skill immediately: never guess the repository, the page or the issue number. Use when a page or issue has to leave Gitea as a document; not for choosing which template a kind uses - that is jsc-gitea:html-style. |
html-export — a wiki page or issue becomes one HTML file
The link is the only input. The output is one file that opens anywhere, with no external asset.
Steps
-
Link gate. Run
tools/gitea-link.sh parse {url}. Exit 3, or no link in the request: stop and report it. Exit 2 is a usage error — fix the arguments and call again. Never fall back to the working directory's remote or to a page name the user mentioned in passing. This gate runs first because it stops the whole skill more often than any other check, and it costs no API call. Completion condition:kindiswikiorissue, andrepopluspageorindexare known. -
Host gate. Confirm
GITEA_HOSTholds a value in the current shell; ask for it per thejsc-ask:askrules when it does not.GITEA_TOKENneeds no inventory —tools/gitea.shresolves it, retries once with the tea CLI login token, and exits 7 when neither works. Completion condition:GITEA_HOSTholds a value. -
Run these three tracks at the same time. They are independent, so start them in one batch rather than one after another; only the issue branch of track B waits, and only for track A's
labelsline.- Track A — content. Wiki page:
jsc-gitea:wikiwiki-get {repo} {page}for the markdown, pluswiki-url {repo} {page}for the source URL; route its exit codes by that skill's table (4 = no such page, 7 = the key is invalid, 8 = other API failure), and every one of them stops this skill with the page name in the report. Issue:tools/issue.sh show {repo} {index}, which returns title, labels and body from one API call — never calltitle,bodyandlabels-ofseparately on the same issue. Exit 1 means the issue could not be read: stop and report the issue number; exit 2 is a usage error, so fix the arguments and call again. - Track B — template. Wiki page:
tools/html-style.sh key wiki {page}. Issue:tools/html-style.sh key issue {repo} {index} --labels {the names from track A's labels line}, which spends no extra API call; the labels line arrives before the body, so this track starts well before track A finishes. The script owns both derivation rules — the page-name prefix, and trying each label in order until one is configured. It prints{key}<TAB>{reason}; keep the reason, it is how the report says which prefix or label produced the key. Exit 1 means the labels could not be read: report that first, then continue withISSUE:DEFAULTand say in the report that the template was picked without labels. Exit 2 is a usage error — fix the arguments and call again. Then runtools/html-style.sh get {key}, which always printslayout<TAB>style<TAB>source. Read the third column and report it:projectorglobalmeans the user configured this kind;defaultmeans it fell back to the DEFAULT row;builtinmeans nothing is configured at all andreport/minimalwas used. Fordefaultandbuiltin, tell the user in one line thatjsc-gitea:html-stylecan set this kind's own template. - Track C — destination. Ask per the
jsc-ask:askrules where the file goes, proposing./.jsc/html/{page-or-issue}.html. State the impact scope: a path inside a repository gets committed unless it is ignored.
Completion condition: the markdown and the document title are in hand, exactly one kind key is chosen with the reason that produced it, the layout, style and source are reported, and the user has confirmed one output path.
- Track A — content. Wiki page:
-
Prepare the markdown — this step MUST run as a sub agent. Links are written as
[text](absolute URL), so pages that follow the current rule need no conversion. An older page can still carry a wiki-internal link: turn it into an absolute URL fromwiki-url, because the renderer does not resolve it and it would ship as literal brackets. Strip personal data — an exported file travels further than the page it came from. Leave everything else exactly as written; this step never rewrites the content. Completion condition: every link in the file is[text](absolute URL), and the diff against the source is limited to link conversion and personal-data removal. -
Render:
tools/html-render.sh --markdown {file} --title {title} --layout {layout} --style {style} --source-url {absolute URL} --out {path}. Route every exit code: 0 → the path it printed is the finished file; 1 → Gitea's renderer or the write failed, so report it and stop, with no half-rendered file left behind; 2 → a usage error or a missing markdown file, so fix the arguments and call again; 4 → the layout or style template file is gone, so report which pair was asked for and send the user tojsc-gitea:html-stylerather than editing the configuration by hand. Completion condition: the file exists, and the report names its path, the layout, the style and where that pair came from.
Rules
- One link, one file. Batch export is a loop the caller runs, not something this skill decides on its own.
- The rendered file inlines CSS and scripts on purpose: it is usually sent to someone outside Gitea, and an external asset breaks on their machine.
- The layout and style are never chosen by inspecting the content. The configuration decides, and
jsc-gitea:html-styleowns the configuration.