fix(export_docs): Gitea wiki link targets and INDEX.md pages

Strip .md from internal links, merge folder INDEX bodies, rewrite out-of-wiki repo paths to Gitea src URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
mihailkudravcev
2026-07-29 13:37:34 +03:00
parent a455cd8085
commit cd79549c27
4 changed files with 100 additions and 7 deletions
+12
View File
@@ -14,6 +14,8 @@ if str(TOOL_ROOT) not in sys.path:
from export1c_help import __status__, __version__ # noqa: E402
from export1c_help.docs_export import ( # noqa: E402
RepoLinkContext,
_git_web_base,
build_docs_output,
clean_docs_wiki,
collect_docs,
@@ -119,6 +121,15 @@ def cmd_push(args: argparse.Namespace) -> int:
src = top
slug = re.sub(r"[^\w.\-]+", "-", top.name, flags=re.UNICODE).strip("-") or "repo"
folder = validate_folder(args.folder)
repo_remote = git_remote_url(src if src_input is None else git_toplevel(src) or src, remote=args.remote)
repo_root = git_toplevel(src) or src
repo_ctx: RepoLinkContext | None = None
if repo_remote:
repo_ctx = RepoLinkContext(
root=repo_root.resolve(),
web_base=_git_web_base(repo_remote),
branch=args.branch,
)
except (ResolveError, ValueError) as exc:
print(f"error: {exc}", file=sys.stderr)
return 1
@@ -150,6 +161,7 @@ def cmd_push(args: argparse.Namespace) -> int:
folder=folder,
flat_root=not args.no_flat_root,
clean=True,
repo=repo_ctx,
)
print(
f"collect: md={build_stats.markdown_files}, attachments={build_stats.attachment_files}, "