Skip to content

Commit 072b336

Browse files
authored
doc: create pages folder
doc: create pages folder
2 parents 588ae71 + 71814f6 commit 072b336

22 files changed

Lines changed: 1105 additions & 8 deletions

‎.github/workflows/pages.yml‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy GitHub Pages
2+
on:
3+
push:
4+
branches: [main]
5+
paths:
6+
['pages/**', 'src/**', 'public/**', 'package.json', 'bun.lock', '.github/workflows/pages.yml']
7+
workflow_dispatch:
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: true
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
env:
19+
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 22
28+
- uses: oven-sh/setup-bun@v2
29+
with:
30+
bun-version: 1.3.14
31+
- run: bun install --frozen-lockfile
32+
- uses: actions/configure-pages@v5
33+
- run: bun run vite build --config pages/vite.config.mjs
34+
- uses: actions/upload-pages-artifact@v3
35+
with:
36+
path: dist-pages
37+
- id: deployment
38+
uses: actions/deploy-pages@v4

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,4 @@ __marimo__/
247247
# Local editor rules and code index
248248
.cursor/
249249
.codegraph/
250+
dist-pages/

‎.prettierignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ doc/**/*-baseline.json
1111
doc/**/*-optimized.json
1212
doc/**/*-result.json
1313
doc/**/*-results.json
14+
pages/
15+
dist-pages/

‎README.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ Read scientific documents in any language, with realtime translation, on any pla
2525

2626
## Recent updates
2727

28-
| Date | Feature | Contributor |
29-
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
30-
| 2026-10-05 | [support custom language codes and streamline regression tests](https://github.com/PDFMathTranslate/PDFMathReader/commit/7ead51359470f680471be1b387f6a4083072d57b) | [@reycn](https://github.com/reycn) |
28+
| Date | Feature | Contributor |
29+
| --- | --- | --- |
30+
| 2026-10-06 | [build Vue Pages showcase with cached reader translations](https://github.com/PDFMathTranslate/PDFMathReader/commit/052d8575eeb84bc8f7f20f913d1156340ab7e837) | [@reycn](https://github.com/reycn) |
31+
| 2026-10-05 | [support custom language codes and streamline regression tests](https://github.com/PDFMathTranslate/PDFMathReader/commit/7ead51359470f680471be1b387f6a4083072d57b) | [@reycn](https://github.com/reycn) |
3132
| 2026-10-05 | [add information categories, release updates and provider availability](https://github.com/PDFMathTranslate/PDFMathReader/commit/1da70d073f778ad300901503e5dd41cf91c8318e) | [@reycn](https://github.com/reycn) |
32-
| 2026-10-05 | [improve settings, diagnostics and reader UX](https://github.com/PDFMathTranslate/PDFMathReader/commit/eadc9f1b89f2edfaec8ab9f97b3af522c4617494) | [@reycn](https://github.com/reycn) |
33-
| 2026-10-05 | [configure kernel translation services and developer diagnostics](https://github.com/PDFMathTranslate/PDFMathReader/commit/7dc5fac3c5d67260fe82672ba768d62122022c71) | [@reycn](https://github.com/reycn) |
34-
| 2026-10-05 | [localize existing advanced settings](https://github.com/PDFMathTranslate/PDFMathReader/commit/3310855be06bf3bd171b2210b0206785ce3c60d3) | [@reycn](https://github.com/reycn) |
35-
| 2026-10-05 | [expand translation languages by kernel with localized names](https://github.com/PDFMathTranslate/PDFMathReader/commit/add0d56890830dab44b612c1134fea47f3f52ab1) | [@reycn](https://github.com/reycn) |
36-
| 2026-10-05 | [reduce background resource usage and default to reading mode](https://github.com/PDFMathTranslate/PDFMathReader/commit/1abd72352f0fc8e59130e5a151244ab0adf869c2) | [@reycn](https://github.com/reycn) |
33+
| 2026-10-05 | [improve settings, diagnostics and reader UX](https://github.com/PDFMathTranslate/PDFMathReader/commit/eadc9f1b89f2edfaec8ab9f97b3af522c4617494) | [@reycn](https://github.com/reycn) |
34+
| 2026-10-05 | [configure kernel translation services and developer diagnostics](https://github.com/PDFMathTranslate/PDFMathReader/commit/7dc5fac3c5d67260fe82672ba768d62122022c71) | [@reycn](https://github.com/reycn) |
35+
| 2026-10-05 | [localize existing advanced settings](https://github.com/PDFMathTranslate/PDFMathReader/commit/3310855be06bf3bd171b2210b0206785ce3c60d3) | [@reycn](https://github.com/reycn) |
36+
| 2026-10-05 | [expand translation languages by kernel with localized names](https://github.com/PDFMathTranslate/PDFMathReader/commit/add0d56890830dab44b612c1134fea47f3f52ab1) | [@reycn](https://github.com/reycn) |
3737

3838
## Quick start
3939

‎pages/.nojekyll‎

Whitespace-only changes.

‎pages/OfficialWebsite.vue‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<script setup>
2+
import { ref } from 'vue';
3+
import icon from './assets/icon-512.png';
4+
const reader = ref(null);
5+
const readerUrl = new URL('./reader.html', location.href).href;
6+
const settingsUrl = new URL('./reader.html?settingsWindow=1&section=general', location.href).href;
7+
const releaseUrl = 'https://github.com/PDFMathTranslate/PDFMathReader/releases/latest';
8+
function replay() {
9+
if (reader.value) reader.value.src = readerUrl + '?replay=' + Date.now();
10+
}
11+
</script>
12+
<template>
13+
<header class="site-header">
14+
<a class="brand" href="#"><img :src="icon" alt="" />PDFMathReader</a>
15+
<nav aria-label="官网导航">
16+
<a href="#reader">阅读体验</a><a href="#how">运行原理</a><a href="#settings">设置</a>
17+
</nav>
18+
<a class="download-link" :href="releaseUrl">下载</a>
19+
</header>
20+
<main>
21+
<section class="hero">
22+
<h1>跨越语言。<br /><span>专注阅读。</span></h1>
23+
<p class="intro">译文逐段呈现,公式与图表保持原样。</p>
24+
<div class="actions">
25+
<a class="primary" href="#reader">体验阅读器 ↓</a
26+
><a class="secondary" :href="releaseUrl">下载应用</a>
27+
</div>
28+
<p class="platforms">macOS · Windows · Linux</p>
29+
</section>
30+
<section id="reader" class="demo-section">
31+
<div class="reader-frame">
32+
<div class="window-traffic-lights" aria-hidden="true"><i></i><i></i><i></i></div>
33+
<iframe
34+
ref="reader"
35+
:src="readerUrl"
36+
title="PDFMathReader 实际 Vue 阅读器演示"
37+
allow="clipboard-write"
38+
></iframe>
39+
</div>
40+
<div class="demo-footer">
41+
<p>默认阅读模式,可在设置中切换为对照模式。</p>
42+
<button @click="replay">重播翻译 ↻</button>
43+
</div>
44+
<p class="demo-note">示例使用预置译文;个人文档与完整翻译服务请使用桌面应用。</p>
45+
</section>
46+
<section id="how" class="how-section">
47+
<div class="section-intro">
48+
<h2>翻译在进行。<br /><span>阅读不等待。</span></h2>
49+
<p>渲染、分析与翻译独立推进,当前页面优先呈现。</p>
50+
</div>
51+
<div class="pipeline">
52+
<article>
53+
<span>01</span>
54+
<h3>页面渲染</h3>
55+
<p>按需加载视野附近的页面。</p>
56+
</article>
57+
<article>
58+
<span>02</span>
59+
<h3>版面分析</h3>
60+
<p>识别段落,保留公式与图表。</p>
61+
</article>
62+
<article>
63+
<span>03</span>
64+
<h3>翻译调度</h3>
65+
<p>优先翻译正在阅读的内容。</p>
66+
</article>
67+
<article>
68+
<span>04</span>
69+
<h3>原位呈现</h3>
70+
<p>译文回到原位,保持阅读连贯。</p>
71+
</article>
72+
</div>
73+
</section>
74+
<section id="settings" class="settings-section">
75+
<div class="section-intro">
76+
<h2>你的阅读。<br /><span>你的偏好。</span></h2>
77+
<p>调整外观、翻译与阅读方式,变化即刻同步到上方阅读器。</p>
78+
</div>
79+
<div class="settings-frame">
80+
<div class="window-traffic-lights" aria-hidden="true"><i></i><i></i><i></i></div>
81+
<iframe :src="settingsUrl" title="PDFMathReader 实际设置工作区" loading="lazy"></iframe>
82+
</div>
83+
</section>
84+
</main>
85+
<footer>
86+
<p>PDFMathReader <span>macOS · Windows · Linux</span></p>
87+
<div>
88+
<a href="https://github.com/PDFMathTranslate/PDFMathReader">GitHub ↗</a
89+
><a href="https://github.com/PDFMathTranslate/PDFMathReader/blob/main/LICENSE">License</a>
90+
</div>
91+
</footer>
92+
</template>

‎pages/README.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# PDFMathReader website
2+
3+
The website is a Vite multi-page build. `pages/index.html` is the website entry
4+
and `pages/reader.html` mounts the real Vue reader application from `src/`.
5+
The reader uses prepared local demonstration data, so the Pages site does not
6+
require an API key or a running backend.
7+
8+
## Local preview
9+
10+
Install the repository dependencies once, then start the Pages development
11+
server from the repository root:
12+
13+
```sh
14+
bun install --frozen-lockfile
15+
node node_modules/vite/bin/vite.js --config pages/vite.config.mjs --host 127.0.0.1 --port 4173
16+
```
17+
18+
Open <http://127.0.0.1:4173/> for the website or
19+
<http://127.0.0.1:4173/reader.html> for the reader. The settings-window view
20+
uses the same reader entry with `?settingsWindow=1`.
21+
22+
## Production build
23+
24+
From the repository root:
25+
26+
```sh
27+
bun run vite build --config pages/vite.config.mjs
28+
```
29+
30+
The build writes `dist-pages/`. The Vite config uses relative asset paths and
31+
copies `public/`, including the reader's sample PDF and symbol assets, into the
32+
same output so project-site URLs work without a custom domain.
33+
34+
## Playground
35+
36+
The sample document and Chinese/Japanese translations are authored demonstration
37+
content, not live machine translation. During the Vite build, layout paragraphs
38+
and `data/translations.json` are validated and compiled into a bundled translation
39+
cache (including English originals). Missing translations fail the build.
40+
41+
The real reader consumes these entries as cache hits, without translation latency
42+
or network requests to a translation backend. Unsupported languages and paragraphs
43+
never fall back to a live provider. Clearing the demonstration cache keeps the
44+
bundled entries available. Settings synchronize preferences across both frames.
45+
Download buttons lead to the latest published GitHub release.
46+
47+
## Deployment
48+
49+
`.github/workflows/pages.yml` installs the root Bun lockfile, builds with the
50+
Pages Vite config, uploads `dist-pages/` as a GitHub Pages artifact, and deploys
51+
changes to `pages/**` after they reach `main`. In the repository's
52+
**Settings → Pages**, select **GitHub Actions** as the publishing source.

‎pages/assets/demo.gif‎

8.61 MB
Loading

‎pages/assets/icon-512.png‎

184 KB
Loading

‎pages/assets/icon.png‎

6.83 MB
Loading

0 commit comments

Comments
 (0)