SHA256
forked from course-team/tjhlp-gitea
feat: 新增 Gitea 定制机制(首页/中文语言/去 Gitea 化)与本地预览
不改 Go 代码、不 fork, 只用官方 CustomPath 覆盖层 + app.ini/env 配置: - custom/templates: 整文件覆盖 home.tmpl(落地页换成答疑平台介绍)与 base/head_navbar.tmpl(docs.gitea.com -> 站内提问指南、新增课程官网入口) - custom/public/assets/tjhlp/ask-guide.html: 站内提问指南静态页 - overrides/ + build.py: 由上游快照确定性生成整份 locale_zh-CN.json (工单 -> Issue 等 133 处), 带占位符校验; 缺失键会退回英文, 必须整份覆盖 - build.py 同时负责规范 custom/ 权限: 容器内 Gitea 以 git(982) 运行, 文件若为 600 只读挂载也会 permission denied 并拒绝启动(生产踩过) - upstream/<版本>/ + fetch-upstream.sh: 上游基线, 供升级时 diff 与重生成 - preview/: 独立 compose + preview.sh(up/check/reload/admin/reset), 与生产隔离(独立端口 2081/数据目录/sqlite), 用同一镜像版本验证效果 - website-linkage.md: 官网(VitePress)侧的联动改动提案
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>提问指南 - 同济大学高级语言程序设计课程</title>
|
||||
<!--
|
||||
静态页, 通过 Gitea 的 custom/public/assets/ 机制对外提供:
|
||||
customization/custom/public/assets/tjhlp/ask-guide.html
|
||||
-> {{AppSubUrl}}/assets/tjhlp/ask-guide.html
|
||||
Gitea 只对 custom/public 下的 robots.txt、.well-known/ 和 assets/ 做静态服务。
|
||||
本页不依赖 Gitea 的 JS/CSS, 可离线打开, 便于直接改文案。
|
||||
-->
|
||||
<style>
|
||||
:root { color-scheme: light dark; }
|
||||
body {
|
||||
margin: 0 auto; padding: 2.5rem 1.25rem 4rem; max-width: 46rem;
|
||||
font: 16px/1.75 -apple-system, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
|
||||
}
|
||||
h1 { font-size: 1.75rem; margin-bottom: .25rem; }
|
||||
h2 { font-size: 1.15rem; margin-top: 2.25rem; border-bottom: 1px solid #8884; padding-bottom: .35rem; }
|
||||
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #888280; padding: .1em .35em; border-radius: 4px; }
|
||||
.lead { color: #666; margin-top: 0; }
|
||||
table { border-collapse: collapse; width: 100%; }
|
||||
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid #8883; vertical-align: top; }
|
||||
.tip { border-left: 3px solid #3b82f6; background: #3b82f614; padding: .75rem 1rem; border-radius: 0 6px 6px 0; }
|
||||
ol, ul { padding-left: 1.4rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>提问指南</h1>
|
||||
<p class="lead">同济大学高级语言程序设计课程 · 课程答疑平台</p>
|
||||
|
||||
<div class="tip">
|
||||
提问规范以课程官网的<a href="https://cpp.tongji.sh/Website/ask-question/">《学会提问》</a>为准,
|
||||
本页是它在答疑平台里的速查版。遇到问题请先看
|
||||
<a href="https://cpp.tongji.sh/Website/faq/">官网常见问题</a>与
|
||||
<a href="https://cpp.tongji.sh/Website/">课程官网</a>上的作业说明。
|
||||
</div>
|
||||
|
||||
<h2>提问前</h2>
|
||||
<ol>
|
||||
<li>在答疑仓库的 Issue 列表里用关键词(题号、函数名、报错信息)搜索,确认没有人问过。</li>
|
||||
<li>自己先调试一遍:编译是否通过、报错信息是什么、最小复现是哪几行。</li>
|
||||
<li>确认问题出在<strong>课程要求</strong>或<strong>你的代码</strong>,而不是环境没有按要求配置。</li>
|
||||
</ol>
|
||||
|
||||
<h2>如何提问</h2>
|
||||
<p>在对应仓库点击 <code>创建 Issue</code>,选择合适的模板后按模板填写:</p>
|
||||
<ul>
|
||||
<li><strong>题目信息</strong>:作业编号、题号、题目要求的关键点。</li>
|
||||
<li><strong>相关代码</strong>:只贴必要片段,用代码块包裹,说明你期望的结果。</li>
|
||||
<li><strong>实际现象</strong>:完整报错信息或错误输出(不要只截图,文字更便于检索)。</li>
|
||||
<li><strong>已尝试的做法</strong>:查过什么资料、改过什么、结果如何。</li>
|
||||
</ul>
|
||||
<div class="tip">提问写得越具体,助教越容易直接定位问题;「我的代码不对,帮忙看看」这类问题通常只能得到「请补充信息」的回复。</div>
|
||||
|
||||
<h2>仓库与标签</h2>
|
||||
<table>
|
||||
<thead><tr><th>位置</th><th>用途</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><code>general</code></td><td>课程内容、环境配置等一般性问题</td></tr>
|
||||
<tr><td><code>hwNN</code></td><td>第 NN 次作业的特定问题</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>助教会用标签标记处理状态,常见含义:</p>
|
||||
<ul>
|
||||
<li><strong>重复</strong>:已有同样的问题,请到原 Issue 继续讨论。</li>
|
||||
<li><strong>待补充信息</strong>:描述不足以定位,请按提示补充。</li>
|
||||
<li><strong>已解决</strong>:问题已答复,请确认后自行关闭。</li>
|
||||
</ul>
|
||||
|
||||
<h2>其它</h2>
|
||||
<ul>
|
||||
<li>不要在 Issue 里粘贴完整的学号、密码等个人信息。</li>
|
||||
<li>作业截止前是提问高峰,助教按时间顺序处理,请耐心等待。</li>
|
||||
<li>与个人成绩、抄袭认定相关的事情请直接联系老师,不要发在公开 Issue 里。</li>
|
||||
</ul>
|
||||
|
||||
<h2>相关站点</h2>
|
||||
<ul>
|
||||
<li><a href="https://cpp.tongji.sh/Website/">课程官网</a>:课程信息、作业说明、环境配置、扩展阅读。</li>
|
||||
<li><a href="https://cpp.tongji.sh/Website/ask-question/">学会提问</a>:完整的提问规范,提问前请通读。</li>
|
||||
<li><a href="https://cpp.tongji.sh/Website/faq/">常见问题</a>:中文乱码、Visual Studio 配置等高频问题。</li>
|
||||
<li><a href="https://cpp.tongji.sh/Website/contact">联系我们</a>:网站问题与课程团队联系方式。</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,193 @@
|
||||
{{/*
|
||||
导航栏, 整文件覆盖 Gitea 内置 templates/base/head_navbar.tmpl。
|
||||
相对上游只改了两处: 未登录时的「帮助」和用户菜单里的「帮助」指向课程提问指南,
|
||||
不再外链 docs.gitea.com。上游基线见 upstream/<版本>/templates/base/head_navbar.tmpl,
|
||||
升级时请 diff 该基线后重新合并, 不要直接覆盖本文件。
|
||||
*/}}
|
||||
<nav id="navbar" aria-label="{{ctx.Locale.Tr "aria.navbar"}}">
|
||||
<div class="navbar-left">
|
||||
<!-- the logo -->
|
||||
<a class="item" id="navbar-logo" href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home_title"}}{{end}}">
|
||||
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
|
||||
</a>
|
||||
|
||||
<!-- mobile right menu, it must be here because in mobile view, each item is a flex column, the first item is a full row column -->
|
||||
<div class="ui secondary menu navbar-mobile-right only-mobile">
|
||||
{{template "base/head_navbar_icons" dict "PageGlobalData" .PageGlobalData}}
|
||||
<button class="item ui icon mini button tw-m-0" id="navbar-expand-toggle" aria-label="{{ctx.Locale.Tr "home.nav_menu"}}">{{svg "octicon-three-bars"}}</button>
|
||||
</div>
|
||||
|
||||
<!-- navbar links non-mobile -->
|
||||
{{if and .IsSigned .MustChangePassword}}
|
||||
{{/* No links */}}
|
||||
{{else if .IsSigned}}
|
||||
{{if not ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}}
|
||||
<a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubUrl}}/issues">{{ctx.Locale.Tr "issues"}}</a>
|
||||
{{end}}
|
||||
{{if not ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}}
|
||||
<a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubUrl}}/pulls">{{ctx.Locale.Tr "pull_requests"}}</a>
|
||||
{{end}}
|
||||
{{if not (and ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled)}}
|
||||
{{if .ShowMilestonesDashboardPage}}
|
||||
<a class="item{{if .PageIsMilestonesDashboard}} active{{end}}" href="{{AppSubUrl}}/milestones">{{ctx.Locale.Tr "milestones"}}</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "explore_title"}}</a>
|
||||
{{else if .IsLandingPageOrganizations}}
|
||||
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{ctx.Locale.Tr "explore_title"}}</a>
|
||||
{{else}}
|
||||
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "explore_title"}}</a>
|
||||
{{end}}
|
||||
|
||||
{{template "custom/extra_links" .}}
|
||||
|
||||
{{if not .IsSigned}}
|
||||
<a class="item" href="https://cpp.tongji.sh/Website/">课程官网</a>
|
||||
<a class="item" href="{{AppSubUrl}}/assets/tjhlp/ask-guide.html">提问指南</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<!-- the full dropdown menus -->
|
||||
<div class="navbar-right">
|
||||
{{if and .IsSigned .MustChangePassword}}
|
||||
<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
|
||||
<span class="text">
|
||||
{{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-1"}}
|
||||
<span class="only-mobile">{{.SignedUser.Name}}</span>
|
||||
<span class="not-mobile flex-text-block">{{svg "octicon-triangle-down"}}</span>
|
||||
</span>
|
||||
<div class="menu user-menu">
|
||||
<div class="header">
|
||||
{{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
<a class="item" href="{{AppSubUrl}}/user/logout">
|
||||
{{svg "octicon-sign-out"}}
|
||||
{{ctx.Locale.Tr "sign_out"}}
|
||||
</a>
|
||||
</div><!-- end content avatar menu -->
|
||||
</div><!-- end dropdown avatar menu -->
|
||||
{{else if .IsSigned}}
|
||||
{{template "base/head_navbar_icons" dict "ItemExtraClass" "not-mobile" "PageGlobalData" .PageGlobalData}}
|
||||
<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "create_new"}}">
|
||||
<span class="flex-text-block">
|
||||
{{svg "octicon-plus"}}
|
||||
<span class="not-mobile flex-text-block">{{svg "octicon-triangle-down"}}</span>
|
||||
<span class="only-mobile">{{ctx.Locale.Tr "create_new"}}</span>
|
||||
</span>
|
||||
<div class="menu">
|
||||
<a class="item" href="{{AppSubUrl}}/repo/create">
|
||||
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}
|
||||
</a>
|
||||
{{if not .DisableMigrations}}
|
||||
<a class="item" href="{{AppSubUrl}}/repo/migrate">
|
||||
{{svg "octicon-repo-push"}} {{ctx.Locale.Tr "new_migrate"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .SignedUser.CanCreateOrganization}}
|
||||
<a class="item" href="{{AppSubUrl}}/org/create">
|
||||
{{svg "octicon-organization"}} {{ctx.Locale.Tr "new_org"}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div><!-- end content create new menu -->
|
||||
</div><!-- end dropdown menu create new -->
|
||||
|
||||
<div class="ui dropdown jump item" data-tooltip-content="{{ctx.Locale.Tr "user_profile_and_more"}}">
|
||||
<span class="text tw-flex tw-items-center">
|
||||
<span class="navbar-avatar">
|
||||
{{ctx.AvatarUtils.Avatar .SignedUser 24 "tw-mr-2"}}
|
||||
{{if .IsAdmin}}{{svg "octicon-shield-check" 16 "navbar-admin-badge"}}{{end}}
|
||||
</span>
|
||||
<span class="only-mobile">{{.SignedUser.Name}}</span>
|
||||
<span class="not-mobile flex-text-block">{{svg "octicon-triangle-down"}}</span>
|
||||
</span>
|
||||
<div class="menu user-menu">
|
||||
<div class="header">
|
||||
{{ctx.Locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
<a class="item" href="{{.SignedUser.HomeLink}}">
|
||||
{{svg "octicon-person"}}
|
||||
{{ctx.Locale.Tr "your_profile"}}
|
||||
</a>
|
||||
{{if not .DisableStars}}
|
||||
<a class="item" href="{{.SignedUser.HomeLink}}?tab=stars">
|
||||
{{svg "octicon-star"}}
|
||||
{{ctx.Locale.Tr "your_starred"}}
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="item" href="{{AppSubUrl}}/notifications/subscriptions">
|
||||
{{svg "octicon-bell"}}
|
||||
{{ctx.Locale.Tr "notification.subscriptions"}}
|
||||
</a>
|
||||
<a class="{{if .PageIsUserSettings}}active {{end}}item" href="{{AppSubUrl}}/user/settings">
|
||||
{{svg "octicon-tools"}}
|
||||
{{ctx.Locale.Tr "your_settings"}}
|
||||
</a>
|
||||
<a class="item" href="{{AppSubUrl}}/assets/tjhlp/ask-guide.html">
|
||||
{{svg "octicon-question"}}
|
||||
提问指南
|
||||
</a>
|
||||
<a class="item" href="https://cpp.tongji.sh/Website/">
|
||||
{{svg "octicon-book"}}
|
||||
课程官网
|
||||
</a>
|
||||
{{if .IsAdmin}}
|
||||
<div class="divider"></div>
|
||||
<a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/-/admin">
|
||||
{{svg "octicon-server"}}
|
||||
{{ctx.Locale.Tr "admin_panel"}}
|
||||
</a>
|
||||
{{end}}
|
||||
<div class="divider"></div>
|
||||
<a class="item" href="{{AppSubUrl}}/user/logout">
|
||||
{{svg "octicon-sign-out"}}
|
||||
{{ctx.Locale.Tr "sign_out"}}
|
||||
</a>
|
||||
</div><!-- end content avatar menu -->
|
||||
</div><!-- end dropdown avatar menu -->
|
||||
{{else}}
|
||||
{{if .ShowRegistrationButton}}
|
||||
<a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up">
|
||||
{{svg "octicon-person"}}
|
||||
<span class="tw-ml-1">{{ctx.Locale.Tr "register"}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
<a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login">
|
||||
{{svg "octicon-sign-in"}}
|
||||
<span class="tw-ml-1">{{ctx.Locale.Tr "sign_in"}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
</div><!-- end full right menu -->
|
||||
|
||||
{{$activeStopwatch := and .PageGlobalData (call .PageGlobalData.GetActiveStopwatch)}}
|
||||
{{if $activeStopwatch}}
|
||||
<div class="active-stopwatch-popup tippy-target">
|
||||
<div class="flex-text-block tw-p-3">
|
||||
<a class="stopwatch-link flex-text-block muted" href="{{$activeStopwatch.IssueLink}}">
|
||||
{{svg "octicon-issue-opened" 16}}
|
||||
<span class="stopwatch-issue">{{$activeStopwatch.RepoSlug}}#{{$activeStopwatch.IssueIndex}}</span>
|
||||
</a>
|
||||
<div class="tw-flex tw-gap-1">
|
||||
<form class="stopwatch-commit form-fetch-action" method="post" action="{{$activeStopwatch.IssueLink}}/times/stopwatch/stop">
|
||||
<button
|
||||
type="submit"
|
||||
class="ui button mini compact basic icon tw-mr-0"
|
||||
data-tooltip-content="{{ctx.Locale.Tr "repo.issues.stop_tracking"}}"
|
||||
>{{svg "octicon-square-fill"}}</button>
|
||||
</form>
|
||||
<form class="stopwatch-cancel form-fetch-action" method="post" action="{{$activeStopwatch.IssueLink}}/times/stopwatch/cancel">
|
||||
<button
|
||||
type="submit"
|
||||
class="ui button mini compact basic icon tw-mr-0"
|
||||
data-tooltip-content="{{ctx.Locale.Tr "repo.issues.cancel_tracking"}}"
|
||||
>{{svg "octicon-trash"}}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</nav>
|
||||
{{template "base/head_banner"}}
|
||||
@@ -0,0 +1,82 @@
|
||||
{{/*
|
||||
首页落地页, 整文件覆盖 Gitea 内置 templates/home.tmpl。
|
||||
|
||||
维护约定:
|
||||
* 上游基线: customization/upstream/<版本>/templates/home.tmpl
|
||||
升级 Gitea 时先 diff 基线, 把上游的结构性改动合并回来, 再重做文案。
|
||||
* 文案直接写中文(平台只面向中文用户), 不复用 Gitea 的 startpage.* 文案,
|
||||
这样首页不再出现「一款极易搭建的自托管 Git 服务」之类的自我推销。
|
||||
* 只改文案/图标/链接, 保留原有 class 与结构, 避免升级后样式失效。
|
||||
* 课程官网地址 https://cpp.tongji.sh/Website/ 在本文件、base/head_navbar.tmpl、
|
||||
public/assets/tjhlp/ask-guide.html 以及 issue-templates 下两个 config.yaml 里
|
||||
各出现一次, 换域名/路径时这几处要一起改(见 customization/README.md「与官网联动」)。
|
||||
*/}}
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home_title"}}{{end}}" class="page-content home">
|
||||
<div class="tw-mb-8 tw-px-8">
|
||||
<div class="center">
|
||||
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{AppName}}">
|
||||
<div class="hero">
|
||||
<h1 class="ui icon header title tw-text-balance">
|
||||
{{AppName}}
|
||||
</h1>
|
||||
<h2 class="tw-text-balance">同济大学高级语言程序设计课程答疑平台</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui stackable middle very relaxed page grid">
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-search"}} 先搜索,再提问
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
大部分问题同学已经问过。提问前请先在
|
||||
<a href="{{AppSubUrl}}/explore/repos">课程答疑仓库</a>
|
||||
的 Issue 列表里搜索关键词,避免重复提问。
|
||||
</p>
|
||||
</div>
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-checklist"}} 按模板提问
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
新建 Issue 时请选择合适的模板,写清题号、相关代码、报错信息和已经尝试过的做法。
|
||||
提问规范见课程官网<a href="https://cpp.tongji.sh/Website/ask-question/">《学会提问》</a>,
|
||||
平台操作见<a href="{{AppSubUrl}}/assets/tjhlp/ask-guide.html">提问指南</a>。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui stackable middle very relaxed page grid">
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-repo"}} 浏览课程仓库
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
一般性问题放在 <code>general</code> 仓库,各次作业的问题放在对应的 <code>hwNN</code> 仓库,
|
||||
可在<a href="{{AppSubUrl}}/explore/repos">仓库列表</a>中查看。
|
||||
</p>
|
||||
</div>
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-comment-discussion"}} 助教在线答疑
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
助教会通过 Issue 回复,并用标签标记重复、已解决、待补充信息等问题。
|
||||
问题解决后请回复确认,便于我们归档。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui center aligned basic segment tw-px-8">
|
||||
<p class="large">
|
||||
相关站点:
|
||||
<a href="https://cpp.tongji.sh/Website/">课程官网</a> ·
|
||||
<a href="https://cpp.tongji.sh/Website/ask-question/">学会提问</a> ·
|
||||
<a href="https://cpp.tongji.sh/Website/faq/">常见问题</a> ·
|
||||
<a href="https://cpp.tongji.sh/Website/contact">联系我们</a>
|
||||
</p>
|
||||
<p>
|
||||
<small>本平台只用于课程答疑,课程通知、作业要求等以课程官网与课程群为准。</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
Reference in New Issue
Block a user