Files
pages/docs/presentations/build-pages-onepager.py
T
Anya Tokugawa aaa0e457bf docs(presentations): preserve exhibition slides and A4 handouts
Keep editable diagrams, handout builder and historical PDF outputs with a source/output index. Existing PDFs are preserved without regeneration.
2026-11-30 23:14:27 +09:00

534 lines
33 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Build the A4 technical handout and its editable vector diagrams.
Requires reportlab. Source: repository design/operations docs and sibling
pages-cli README + docs/neomutt.md, reviewed 2026-11-15.
All coordinates are points, measured from the top left. Diagram primitives
are emitted to both SVG and PDF so the standalone figures match the handout.
"""
from pathlib import Path
from html import escape
import math
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.colors import HexColor
from reportlab.lib.pagesizes import A4
ROOT = Path(__file__).resolve().parents[2]
OUT = ROOT / "output/pdf"
OUT.mkdir(parents=True, exist_ok=True)
INK, MUTED, LINE = "#172433", "#526171", "#b6c2cd"
ACCENT, PALE, WHITE = "#244d70", "#f1f5f8", "#ffffff"
FONT_DIR = Path("/usr/share/fonts/truetype")
pdfmetrics.registerFont(TTFont("Latin", str(FONT_DIR / "dejavu/DejaVuSans.ttf")))
pdfmetrics.registerFont(TTFont("LatinBold", str(FONT_DIR / "dejavu/DejaVuSans-Bold.ttf")))
pdfmetrics.registerFont(TTFont("Mono", str(FONT_DIR / "dejavu/DejaVuSansMono.ttf")))
pdfmetrics.registerFont(TTFont("JP", str(FONT_DIR / "droid/DroidSansFallbackFull.ttf")))
def runs(s, bold=False, mono=False):
current, buf = None, ""
for ch in s:
font = "JP" if ord(ch) > 0x2FFF else ("Mono" if mono else "LatinBold" if bold else "Latin")
if current is not None and font != current:
yield current, buf
buf = ""
current, buf = font, buf + ch
if buf:
yield current, buf
def width(s, size, bold=False, mono=False):
return sum(pdfmetrics.stringWidth(t, f, size) for f, t in runs(s, bold, mono))
class Drawing:
def __init__(self, w, h, title):
self.w, self.h, self.title, self.items = w, h, title, []
def box(self, x, y, w, h, fill=WHITE, stroke=LINE, radius=2):
self.items.append(("box", x, y, w, h, fill, stroke, radius))
def line(self, x1, y1, x2, y2, color=LINE, dashed=False):
self.items.append(("line", x1, y1, x2, y2, color, dashed))
def arrow(self, x1, y1, x2, y2, color=MUTED, dashed=False):
self.line(x1, y1, x2, y2, color, dashed)
a = math.atan2(y2-y1, x2-x1)
for delta in (-0.45, 0.45):
self.line(x2, y2, x2-4*math.cos(a+delta), y2-4*math.sin(a+delta), color)
def text(self, x, y, s, size=9, bold=False, color=INK, align="left", mono=False):
self.items.append(("text", x, y, s, size, bold, color, align, mono))
def pdf(self, c, x=0, y=0):
ph = A4[1]
for p in self.items:
if p[0] == "box":
_, bx, by, w, h, fill, stroke, r = p
c.setFillColor(HexColor(fill)); c.setStrokeColor(HexColor(stroke)); c.setLineWidth(.6)
c.roundRect(x+bx, ph-y-by-h, w, h, r, fill=1, stroke=1)
elif p[0] == "line":
_, x1,y1,x2,y2,col,dash=p
c.setStrokeColor(HexColor(col)); c.setLineWidth(.65); c.setDash([2,2] if dash else [])
c.line(x+x1,ph-y-y1,x+x2,ph-y-y2); c.setDash([])
else:
_, tx,ty,s,size,bold,col,align,mono=p
w=width(s,size,bold,mono)
tx -= w/2 if align=="center" else w if align=="right" else 0
c.setFillColor(HexColor(col))
for f,t in runs(s,bold,mono):
c.setFont(f,size); c.drawString(x+tx,ph-y-ty,t)
tx += pdfmetrics.stringWidth(t,f,size)
def svg(self, path):
a=[f'<svg xmlns="http://www.w3.org/2000/svg" width="{self.w}pt" height="{self.h}pt" viewBox="0 0 {self.w} {self.h}" role="img" aria-labelledby="title">',
f'<title id="title">{escape(self.title)}</title>', '<rect width="100%" height="100%" fill="white"/>']
for p in self.items:
if p[0]=="box":
_,x,y,w,h,fill,stroke,r=p
a.append(f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="{r}" fill="{fill}" stroke="{stroke}" stroke-width="0.6"/>')
elif p[0]=="line":
_,x1,y1,x2,y2,col,dash=p
d=' stroke-dasharray="2 2"' if dash else ''
a.append(f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" stroke="{col}" stroke-width="0.65"{d}/>')
else:
_,x,y,s,size,bold,col,align,mono=p
anchor={"left":"start","center":"middle","right":"end"}[align]
family="DejaVu Sans Mono,monospace" if mono else "DejaVu Sans,Noto Sans CJK JP,sans-serif"
a.append(f'<text x="{x}" y="{y}" font-family="{family}" font-size="{size}" font-weight="{700 if bold else 400}" text-anchor="{anchor}" fill="{col}">{escape(s)}</text>')
path.write_text('\n'.join(a)+"\n</svg>\n",encoding="utf-8")
def architecture():
d=Drawing(535,179,"Pages and pages-cli: application, extensions, APIs and storage")
for x,w,title,sub in [(0,163,"Web / PWA","Wiki · City · Organizer"),(186,163,"pages-cli / pages","Shell · $EDITOR · NeoMutt"),(372,163,"DAV clients","CalDAV · CardDAV")]:
d.box(x,0,w,32,PALE); d.text(x+8,13,title,9,True); d.text(x+8,25,sub,7.4,color=MUTED)
d.arrow(x+w/2,32,x+w/2,55)
d.text(91,46,"HTTPS",6.8,color=MUTED)
d.text(278,46,"HTTPS / Bearer",6.8,color=MUTED)
d.text(465,46,"HTTPS / DAV",6.8,color=MUTED)
d.box(0,55,535,70,WHITE,ACCENT)
d.text(10,70,"PagesWiki / Go application",10,True,ACCENT)
d.text(525,70,"Host-based routing / HTTP API",7.6,color=MUTED,align="right")
d.line(10,77,525,77)
components=[("Wiki / files","Editor · viewers · City Map"),("System extensions","Tasks · calendar · contacts · RSS"),("Integration / jobs","DAV · plugins · background jobs")]
for i,(name,role) in enumerate(components):
x=10+i*173; y=84
d.box(x,y,169,32,PALE,LINE)
d.text(x+7,y+13,name,8.7,True); d.text(x+7,y+25,role,7.1,color=MUTED)
d.arrow(130,125,130,145); d.arrow(403,125,403,145)
d.box(0,145,260,34,PALE); d.box(275,145,260,34,PALE)
d.text(9,159,"SQLite / PostgreSQL 17",9,True)
d.text(9,172,"Metadata · revisions · settings · indexes",7.5,color=MUTED)
d.text(284,159,"Persistent files",9,True)
d.text(284,172,"HTML · attachments · calendar / task data",7.5,color=MUTED)
return d
def domains():
d=Drawing(252,92,"Campus manages domains independently of application instances")
d.box(0,0,252,23,PALE)
d.text(126,15,"Campus / configuration controller",8.4,True,align="center")
d.arrow(60,23,60,42,dashed=True); d.arrow(192,23,192,42,dashed=True)
for x,label,hosts in [(0,"Instance A",["wiki.example.test","lab.example.test"]),(132,"Instance B",["team.example.test"])]:
d.box(x,42,120,49,WHITE,ACCENT); d.text(x+7,55,label,8.3,True)
for i,host in enumerate(hosts):
d.text(x+7,69+13*i,host,7,mono=True)
return d
def editing():
d=Drawing(252,92,"HTML and Markdown editing, conversion and preview")
for x,w,title,sub in [(0,76,"Markdown","editing"),(102,64,"HTML","stored content")]:
d.box(x,11,w,35,PALE); d.text(x+w/2,25,title,9,True,align="center"); d.text(x+w/2,38,sub,7,color=MUTED,align="center")
d.arrow(76,22,102,22); d.arrow(102,35,76,35)
d.text(87,7,"convert",6.4,align="center",color=MUTED)
d.box(192,11,60,35,PALE); d.text(222,25,"Viewer",8.6,True,align="center"); d.text(222,38,"Preview",7,color=MUTED,align="center")
d.arrow(166,29,192,29)
d.line(134,46,134,64); d.arrow(134,64,222,64)
d.text(0,83,"HTML fragments retained in Markdown",7.2,color=MUTED)
d.text(222,76,"Slides",7.7,True,align="center")
d.text(222,89,"Reveal.js",7,color=MUTED,align="center")
return d
def identity():
d=Drawing(252,79,"Paths resolve to a stable Page, immutable revisions and content hashes")
for y,label in [(0,"/guide/api"),(33,"/project/ref")]:
d.box(0,y,66,24,PALE); d.text(33,y+15,label,7,align="center",mono=True)
d.box(83,15,49,29,PALE); d.text(107.5,27,"Page",8,True,align="center"); d.text(107.5,38,"UUID",7,color=MUTED,align="center")
d.arrow(66,12,83,24); d.arrow(66,45,83,35)
d.box(147,15,47,29,PALE); d.text(170.5,27,"Revision",7.2,True,align="center"); d.text(170.5,38,"UUID / lang",6.2,color=MUTED,align="center")
d.arrow(132,29,147,29)
d.box(209,15,43,29,PALE); d.text(230.5,27,"Document",6.4,True,align="center"); d.text(230.5,38,"SHA-256",6.6,color=MUTED,align="center")
d.arrow(194,29,209,29)
d.text(0,74,"mutable address",7,color=MUTED)
d.text(83,74,"stable identity / immutable history",7,color=MUTED)
return d
def city():
d=Drawing(252,79,"Campus and Domain organize Quartier, Street, Spot and Pages")
d.text(0,9,"Campus",8.5,True); d.arrow(45,6,60,6); d.text(65,9,"Domain = FQDN / namespace",8.2,True)
boxes=[(0,72,"Quartier","/lab"),(90,72,"Street","/lab/web"),(180,72,"Spot","/lab/web/api")]
for x,w,title,sub in boxes:
d.box(x,24,w,32,PALE); d.text(x+w/2,37,title,8,True,align="center"); d.text(x+w/2,49,sub,6.6,color=MUTED,align="center",mono=True)
d.arrow(72,40,90,40); d.arrow(162,40,180,40)
d.arrow(216,56,216,66); d.text(216,77,"Pages",8,True,align="center")
d.text(0,76,"path boundaries / map navigation",7,color=MUTED)
return d
def body(d,x,y,lines,size=8.7,leading=13):
for i,s in enumerate(lines):
d.text(x,y+i*leading,s,size)
def section(d,y,number,title):
d.text(30,y,number,8.5,True,ACCENT)
d.text(51,y,title,10.3,True)
def technical_page():
page=Drawing(*A4,"Pages / pages-cli architecture handout")
page.text(30,33,"01 / TECHNICAL ARCHITECTURE",8,True,ACCENT)
page.text(565,33,"2026-11-15 / PagesWiki v0.18.0",7.6,color=MUTED,align="right")
page.text(30,64,"Pages",28,True)
page.text(137,64,"/ pages-cli",20,color=MUTED)
page.text(30,86,"Wiki・ファイル・タスク・予定を、ブラウザとターミナルで扱う。",10.7)
page.line(30,99,565,99,ACCENT)
section(page,117,"01","全体構成:Go製サーバー + Python製CLI + 形式別の表示・編集機能")
arch=architecture(); domain=domains(); editor=editing()
section(page,333,"02","ドメイン:サイトと配置先を分ける")
page.text(313,333,"03",8.5,True,ACCENT)
page.text(334,333,"エディタとトランスパイル",10.3,True)
body(page,30,456,["ドメインはFQDNごとのWiki。パス・設定・メンバーを分離。",
"キャンパスは複数ドメインと配置先インスタンスを管理。",
"一つのインスタンスに複数サイトを収容でき、別配置も可能。",
"配信するのは設定であり、記事の複製機能ではない。",
"HTTPのHostからサイトを選択。パスの重複はサイト間で許容。",
"設定配信は署名付き。配置先は参加・承認済みから選択。"],8.05,12.5)
body(page,313,456,["内蔵エディタはHTML/Markdown切替とライブプレビュー。",
"Wiki本文はHTMLで保存。編集時にMarkdownへ変換し、",
"Markdownで表せない属性・構造はHTMLのまま残す。",
"children・CSVマクロは編集時に保持し、表示時に展開。",
"同じ文書を通常ページ・印刷・Reveal.jsスライドで表示。",
"外部編集にはcode-server連携。vim.wasmは改善保留。"],8.05,12.5)
page.line(30,535,565,535)
section(page,556,"04","プラグイン:文書操作と機能追加")
page.text(313,556,"05",8.5,True,ACCENT)
page.text(334,556,"pages-cli:端末からの操作",10.3,True)
page.text(30,578,"表示・編集アダプタ",9,True,ACCENT)
body(page,30,595,["MIME・拡張子からビューア/エディタを選択する。",
"CSV・PDF・画像・動画・アーカイブ・Excalidraw等に対応。",
"外部エディタは別コンテナで動作し、ゲートウェイ経由で",
"ファイルを受け渡す。保存結果はWikiの履歴へ追加。"],8.05,12.5)
page.text(30,660,"システム拡張",9,True,ACCENT)
body(page,30,677,["タスク・カレンダー・連絡先・ブログ・日記・RSSを提供。",
"例:RSS記事をWiki/タスクへ、予定・連絡先をDAVで同期。",
"設定画面で有効/無効を切替。外部表示・編集サービスは",
"URL登録で追加できる。任意コードの動的ロードは未対応。"],8.05,12.5)
body(page,313,578,["独立リポジトリで配布するHTTPクライアント。実行名 pages。",
"対話シェル、$EDITOR/$PAGER、言語指定、OIDC承認。",
"タスクの作成・計画・作業時間記録・レポート、連絡先検索。",
"NeoMuttから本文をWikiへ保存し、関連タスクを作成する。"],8.05,12.5)
page.box(313,631,252,89,PALE)
for y,s in [(646,"pages login --oidc --no-browser"),(662,"pages edit /lab/guide --lang ja"),(678,"pages task from-mail < message.eml"),(694,"pages task start TASK_UUID"),(710,"pages task stop")]:
page.text(322,y,s,7.3,mono=True)
page.line(30,738,565,738)
page.text(30,755,"現行の制約",8.2,True,ACCENT)
body(page,30,770,["v0.18.0は単一書込インスタンス構成。PostgreSQL版は本文全文検索・外部エディタ連携・Web Push等が未対応。",
"内蔵エディタとInboxは利用可能。プラグインの利用可否はDB構成・追加サービスの配置に依存する。"],7.8,12)
page.line(30,798,565,798)
page.text(30,812,"設計資料:docs/design/ja/{campus-federation,viewer-editor,editor-resilience,extensions}.md",6.8,color=MUTED)
page.text(30,824,"構成制約:docs/operations/postgresql-migration.md | CLI:git.anya.jp/anya/pages-cli",6.8,color=MUTED)
for name,d in [("pages-system-architecture",arch),("pages-domain-deployment",domain),("pages-editor-conversion",editor)]:
d.svg(OUT/(name+".svg"))
return [(page,0,0),(arch,30,130),(domain,30,346),(editor,313,346)]
def city_navigation():
d=Drawing(535,128,"URL hierarchy as districts, streets and places: conceptual navigation")
d.box(0,0,535,127,WHITE,ACCENT)
d.text(12,17,"wiki.example.test",10,True)
d.text(523,17,"One domain / one city",8,color=MUTED,align="right")
for x,title,path,street,spot in [(12,"Research","/lab","/lab/web","/lab/web/api"),(187,"Operations","/ops","/ops/network","/ops/network/dns"),(362,"Projects","/projects","/projects/wiki","/projects/wiki/editor")]:
d.box(x,29,161,86,PALE)
d.text(x+9,44,title,9,True); d.text(x+152,44,path,7.2,align="right",mono=True)
d.line(x+10,62,x+151,62,LINE)
d.text(x+9,57,street,7.1,mono=True)
d.line(x+26,62,x+26,78,ACCENT)
d.box(x+11,79,139,25,WHITE)
d.text(x+80.5,95,spot,7,align="center",mono=True)
return d
def work_connections():
d=Drawing(252,79,"Email and RSS connect to Wiki, tasks and work records")
for x,title,sub in [(0,"Mail / RSS","capture"),(90,"Wiki + task","link"),(180,"Work log","report")]:
d.box(x,16,72,37,PALE)
d.text(x+36,31,title,8,True,align="center")
d.text(x+36,44,sub,7,color=MUTED,align="center")
d.arrow(72,34,90,34); d.arrow(162,34,180,34)
d.text(0,74,"NeoMutt / pages-cli / Web dashboard",7.2,color=MUTED)
return d
def multiple_contexts():
d=Drawing(252,79,"Two navigation paths open the same page")
for y,path in [(0,"/guide/api"),(35,"/project/ref")]:
d.box(0,y,83,26,PALE)
d.text(41.5,y+17,path,8,align="center",mono=True)
d.box(119,10,133,42,PALE)
d.text(185.5,28,"One page",10,True,align="center")
d.text(185.5,43,"Shared content / history",7,align="center",color=MUTED)
d.arrow(83,13,119,22); d.arrow(83,48,119,40)
d.text(0,76,"Multiple paths, no document copies",7.4,color=MUTED)
return d
def design_page():
p=Drawing(*A4,"Pages / pages-cli design choices")
p.text(30,33,"02 / DESIGN CONCEPT",8,True,ACCENT)
p.text(565,33,"2026-11-15 / PagesWiki",7.6,color=MUTED,align="right")
p.text(30,64,"Pages",28,True); p.text(137,64,"/ pages-cli",20,color=MUTED)
p.text(30,86,"URLの階層を街の案内図に。文書を日々の作業につなぐ。",10.7)
p.line(30,99,565,99,ACCENT)
section(p,117,"01","フォルダの階層に、地図という入口を重ねる")
town=city_navigation(); ident=multiple_contexts(); work=work_connections()
body(p,30,278,["Knowledge City Modelは、ドメインを街、URLの配下を街区(Quartier)・通り(Street)・拠点(Spot)として扱う。",
"検索語が浮かばないときも、分野や周辺のページから探せる。地図・ツリー・検索は同じ文書群の別の入口。",
"URLからの自動分類を起点に、名前や範囲を調整する。地図のためだけに別の分類体系を作り直さない。",
"用途や公開範囲が異なるサイトはドメインを分け、各サイトの設定・メンバーを個別に管理する。"],8.4,13)
p.text(565,263,"図は階層の概念図。実際のCity Map画面ではない。",6.6,color=MUTED,align="right")
section(p,337,"02","一つのページを複数の文脈に置く")
p.text(313,337,"03",8.5,True,ACCENT); p.text(334,337,"文書を作業の流れへ組み込む",10.3,True)
body(p,30,444,["手順書を「技術分野」と「プロジェクト」の両方から参照。",
"コピーではなく、複数のパスで同じページを指す。",
"内容を更新すれば、どちらの入口からも同じ版を読める。",
"「分類し直す」と「別の文書を作る」を分けることで、",
"整理のための複製や、コピー先だけの更新漏れを減らす。"],8.05,13)
body(p,313,444,["メールやRSSを読んだ場所から、Wiki保存とタスク化へ。",
"タスクから関連メモを開き、作業時間や予定と結び付ける。",
"予定・連絡先はCalDAV/CardDAVで既存アプリとも接続。",
"Webでは一覧・カレンダー・ウィジェット、端末では短い",
"コマンドを使い、作業環境に合わせて入口を選ぶ。"],8.05,13)
p.line(30,512,565,512)
section(p,534,"04","文書形式と、使う道具を固定しない")
p.text(30,558,"編集はMarkdown、表示は用途に合わせる",9.2,True,ACCENT)
body(p,30,578,["Wiki本文の保存形式はHTML。Markdownで書き、必要な部分はHTMLを残して編集できる。",
"文書をページ・印刷・スライドとして使い分ける。CSVや図は専用の表示・編集機能で扱う。"],8.6,14)
p.text(30,618,"プラグインは二つの役割に分ける",9.2,True,ACCENT)
p.box(30,631,252,61,PALE); p.box(313,631,252,61,PALE)
p.text(41,648,"文書の表示・編集",9,True)
body(p,41,665,["CSV表、Excalidraw、Reveal.js、外部エディタ。",
"同じ内容を、その形式に向いた道具で扱う。"],8.1,13)
p.text(324,648,"アプリケーション機能の追加",9,True)
body(p,324,665,["タスク、カレンダー、連絡先、ブログ、日記、RSS。",
"文書以外の画面・操作・設定を追加する。"],8.1,13)
body(p,30,715,["内蔵エディタで完結する使い方も、code-serverやpages-cliの $EDITOR を使う選択肢も用意する。",
"必要な機能を有効にして使う。外部サービスの配置・DB構成による対応範囲は技術編に記載。"],8.4,14)
p.line(30,748,565,748)
p.text(30,766,"デザインの軸",8.5,True,ACCENT)
p.text(112,766,"街として探す / コピーせず参照する / 作業につなぐ / 道具を選ぶ",9.4,True)
p.line(30,798,565,798)
p.text(30,812,"設計資料:docs/design/ja/{principles,campus-federation,viewer-editor,extensions}.md / pages-cli README",6.8,color=MUTED)
p.text(30,824,"Knowledge City Model:『とある科学の超電磁砲』の学舎の園に着想。構成・実装制約は別紙「技術編」を参照。",6.8,color=MUTED)
for name,d in [("pages-design-city-navigation",town),("pages-design-multiple-paths",ident),("pages-design-workflow",work)]:
d.svg(OUT/(name+".svg"))
return [(p,0,0),(town,30,130),(ident,30,350),(work,313,350)]
def export_pdf(path, pages, title):
c=canvas.Canvas(str(path),pagesize=A4,pageCompression=1)
c.setTitle(title); c.setAuthor("PagesWiki project")
c.setSubject("Pages / pages-cli:技術構成とデザインの説明資料")
for drawings in pages:
for d,x,y in drawings:
d.pdf(c,x,y)
c.showPage()
c.save()
print(path)
def screen_layout():
d=Drawing(535,144,"Desktop information density and mobile touch layout: conceptual wireframes")
d.box(0,0,350,143,WHITE,ACCENT)
d.box(0,0,350,24,PALE,LINE)
d.text(8,16,"Pages",9,True)
d.box(54,5,140,14,WHITE)
d.text(61,15,"Search / command",7,color=MUTED)
d.text(341,15,"Plan Inbox Theme User",7,align="right")
d.box(7,31,70,104,PALE)
d.text(13,44,"Projects",8,True)
for i,s in enumerate(["All tasks","Wiki","Exhibition","Personal"]):
if i==2: d.box(11,76,61,16,"#dce8f0",LINE)
d.text(14,61+i*15,s,7.2)
d.text(87,43,"Status / Subject",7.5,True)
d.text(340,43,"Due / Wiki",7.5,True,align="right")
for i,(s,date) in enumerate([("Review API design","11-15"),("Prepare exhibit","11-16"),("Write deployment notes","11-17"),("Update diagrams","11-18")]):
y=50+i*20
if i==1: d.box(83,y,259,20,"#dce8f0",LINE)
d.text(88,y+13,s,7.4); d.text(337,y+13,date,7.2,align="right")
d.line(83,y+20,342,y+20)
d.box(374,0,161,143,WHITE,ACCENT)
d.box(374,0,161,24,PALE)
d.text(383,16,"Pages / Tasks",8.5,True)
for i,(s,sub) in enumerate([("Review API design","In progress / Nov 15"),("Prepare exhibit","To do / Nov 16")]):
y=32+i*52
d.box(382,y,145,44,PALE)
d.text(389,y+14,s,8,True); d.text(389,y+28,sub,7,color=MUTED)
d.text(389,y+39,"Edit Date Wiki",7)
return d
def theme_variants():
d=Drawing(535,70,"Same layout with light, dark and wallpaper-derived colors; illustrative palettes")
for x,label,bg,fg,accent in [(0,"LIGHT","#f1f5f8","#172433","#dce8f0"),(186,"DARK","#26303d","#e3eaf1","#405569"),(372,"WALLPAPER COLOR","#f0ebe5","#42392e","#d3c2ac")]:
d.box(x,0,163,69,bg)
d.text(x+8,14,label,7.5,True,fg)
d.box(x+8,22,147,15,accent,accent)
d.text(x+14,32,"Search / command",7,color=fg)
d.line(x+8,45,x+155,45,fg); d.line(x+8,54,x+109,54,fg)
d.text(x+8,64,"Same controls / layout",6.6,color=fg)
return d
def screen_page():
p=Drawing(*A4,"Pages / pages-cli screen and interaction design")
p.text(30,33,"03 / INTERFACE & INTERACTION",8,True,ACCENT)
p.text(565,33,"2026-11-15 / PagesWiki",7.6,color=MUTED,align="right")
p.text(30,64,"Pages",28,True); p.text(137,64,"/ pages-cli",20,color=MUTED)
p.text(30,86,"一覧で見渡し、キーで動かす。配色と入口は使う人に合わせる。",10.7)
p.line(30,99,565,99,ACCENT)
section(p,117,"01","デスクトップは一覧密度、モバイルはタッチ操作を優先")
layout=screen_layout(); themes=theme_variants()
p.text(30,285,"デスクトップ:プロジェクト+表形式の一覧",7.5,color=MUTED)
p.text(404,285,"モバイル:カード型の操作領域",7.5,color=MUTED)
body(p,30,304,["タスクは1行ずつ比較し、通常一覧では件名・状態・日付をその場で編集。キーボード一覧は別表示として用意。",
"設定・詳細だけをダイアログへ。ダッシュボードはウィジェットを並べ替え、サイズを変更できる。"],8.3,13)
section(p,343,"02","ショートカット:画面ごとの操作")
p.text(313,343,"03",8.5,True,ACCENT); p.text(334,343,"検索欄をコマンドの入口にも",10.3,True)
for i,(key,label) in enumerate([
("/ e ?","閲覧:検索 / 編集 / ヘルプ"),
("Ctrl+↑ / ↓","閲覧:親パス / 子ページ一覧"),
("j / k","タスク:次行 / 前行"),
("Ctrl+j / k","タスク:プロジェクト移動"),
("o / O / l","タスク:ソート / 逆順 / 絞込"),
("d / s","タスク:完了 / Pomodoro"),
("c / m / w","タスク:作成 / 編集 / Wiki")]):
y=363+18*i
p.box(30,y-10,80,15,PALE)
p.text(36,y,key,8,mono=True)
p.text(118,y,label,8.2)
p.text(30,492,"タスクの操作表は /v/plan/tasks/index が対象。",7.2,color=MUTED)
p.box(313,354,252,69,PALE)
for y,s in [(370,'add task "設計レビュー"'),(385,' project:Wiki cost:2h'),(406,'add cal 会議 from:... to:...')]:
p.text(322,y,s,8,mono=True)
body(p,313,442,["トップの検索候補からページへ直接移動。",
"add task / add cal でタスク・予定を作成する。",
"project: にはプロジェクト候補、cost: には見積時間。",
"予定は from: / to: に日時を入力する。"],8.1,13)
section(p,523,"04","テーマ:画面内で切替、トップの外観は個別に調整")
body(p,30,626,["ナビバーのテーマ選択は再読み込み不要。選択はブラウザに保持し、配色を変えても操作の配置は維持する。",
"トップの歯車から、壁紙のパス・濃さ、グラス効果の透明度を個人設定として変更できる。",
"壁紙の色から配色を調整するモードと強度も用意。配色と透明度はプレビューしてから保存する。"],8.4,14)
p.text(565,613,"配色比較は概念図。特定テーマのスクリーンショットではない。",6.7,color=MUTED,align="right")
section(p,695,"05","操作を切り替えても、入力の流れを保つ")
body(p,30,716,["内蔵エディタは本文とプレビューを並べ、非表示時は編集領域を広げる。タッチ端末ではVimモードを解除。",
"単キー操作は入力欄や開いたダイアログでは抑止。タスク一覧は ? から、その画面のキー操作を確認できる。",
"ターミナルでは pages の対話シェル・Tab補完・$EDITOR を利用。Webの短い操作とCLIのコマンドを併用する。"],8.2,14)
p.text(30,772,"図は画面構成の説明用。キーの役割は画面に依存し、ブラウザ/OSのキー割り当てと競合する場合がある。",7.3,color=MUTED)
p.line(30,798,565,798)
p.text(30,812,"実装参照:static/js/{viewer-shortcuts,task-index,home-command-parser,theme-picker,home-appearance}.js",6.7,color=MUTED)
p.text(30,824,"設計資料:docs/design/ja/{organizer-dashboard,calendar-mobile,editor-resilience}.md / pages-cli README",6.7,color=MUTED)
layout.svg(OUT/"pages-interface-layout.svg"); themes.svg(OUT/"pages-interface-themes.svg")
return [(p,0,0),(layout,30,130),(themes,30,537)]
def main():
tech=technical_page(); design=design_page(); interface=screen_page(); discussion=discussion_page()
export_pdf(OUT/"pages-pages-cli-discussion-a4-ja.pdf",[discussion],"Pages / pages-cli - ディスカッション")
export_pdf(OUT/"pages-pages-cli-four-sheets-a4-ja.pdf",[tech,design,interface,discussion],"Pages / pages-cli - 技術・デザイン・画面設計・ディスカッション")
def discussion_page():
p=Drawing(*A4,"Discussion: what else do you want from a Wiki?")
p.text(30,33,"04 / DISCUSSION",8,True,ACCENT)
p.text(565,33,"2026-11-15 / PagesWiki",7.6,color=MUTED,align="right")
p.text(30,64,"Pages",28,True); p.text(137,64,"/ pages-cli",20,color=MUTED)
p.text(30,91,"あなたはWikiに、あと何が欲しいですか?",17,True)
p.line(30,105,565,105,ACCENT)
p.text(30,123,"気になる機能に○を。機能の追加だけでなく、使いにくさ・不要な機能の意見も歓迎。",9)
p.box(30,138,252,28,PALE)
p.box(313,138,252,28,PALE)
p.text(41,157,"追加している機能",11,True,ACCENT)
p.text(271,157,"実装あり",7.5,color=MUTED,align="right")
p.text(324,157,"追加予定・検討中",11,True,ACCENT)
p.text(554,157,"時期未定",7.5,color=MUTED,align="right")
existing=[
("文書の編集","HTML/Markdown、下書き、履歴復元、言語別編集"),
("探す・整理する","検索、ツリー、City Map、ブックマーク"),
("ファイルを扱う","CSV表編集、PDF・画像・動画・アーカイブ閲覧"),
("図・発表資料","Excalidraw表示、Reveal.jsスライド・プレビュー"),
("タスクと作業記録","親子タスク、日別計画、Pomodoro、実績集計"),
("予定と連絡先","カレンダー、アドレス帳、CalDAV/CardDAV"),
("情報収集・発信","RSS/FreshRSS連携、ブログ・日記、記事のRSS配信"),
("端末・メールとの接続","pages-cli、$EDITOR、NeoMuttからWiki保存・タスク化"),
("画面のカスタマイズ","テーマ、壁紙、ショートカット、ウィジェット配置"),
("サイト管理・ログイン","複数ドメイン、グループ、公開設定、OIDC/LDAP"),
]
planned=[
("コメント・評価","インラインコメント、スレッド、いいね、品質評価"),
("共同編集・編集体験","同時編集、見たまま編集の検討(現在は保留)"),
("共有・公開の拡充","期限付き共有URL、承認UI、権限の一覧表示"),
("図表・記法の追加","Draw.io、nwdiag、ODS、他Wiki記法の取り込み"),
("チームの仕事管理","共有タスク、日課、チケット管理、共有アドレス帳"),
("さらに情報を集める","IMAP取り込み、他Wiki・外部検索、Linkding連携"),
("外部ストレージ","S3互換、WebDAV、SSHFS等との連携"),
("用途別の管理機能","料理レシピ、IPアドレス、DNS、資産管理"),
("プラグイン・運用の拡充","第三者プラグイン実行、冗長化、自動切替、監視"),
("既存機能をもっと使いやすく","検索・大容量データ・同期互換性・モバイルの改善"),
]
for x,items in [(30,existing),(313,planned)]:
for i,(title,detail) in enumerate(items):
y=184+i*31
p.box(x+2,y-7,6,6,WHITE,LINE,0)
p.text(x+16,y,title,9,True)
p.text(x+16,y+13,detail,7.8)
if i<9: p.line(x,y+20,x+252,y+20,"#e1e7ec")
body(p,30,498,["左欄は一部機能を含む実装一覧で、全環境での提供を保証するものではありません。DB構成による制約は技術編へ。",
"右欄は設計TODO・既存機能の拡充候補です。実装や提供時期の確約ではなく、優先順位を議論するための一覧です。"],7.2,11)
p.line(30,521,565,521)
section(p,542,"01","どんな場面で使いたい?")
p.text(30,562,"個人メモ / チームの手順書 / プロジェクト / 調査・学習 / 公開ブログ / その他",9)
p.text(30,581,"今使っているツールと、そこで困っていることは?",8.6,color=MUTED)
p.line(30,601,565,601,LINE)
section(p,626,"02","一覧にないものは? 逆に、いらないものは?")
p.text(30,646,"外せない機能、つなぎたいサービス、変えたい操作、Wikiに持たせたくない役割。",9)
p.line(30,670,565,670,LINE)
p.line(30,691,565,691,LINE)
section(p,717,"03","一つだけ先に実装するなら?")
p.text(30,739,"欲しい機能:",9,True); p.line(91,743,282,743,LINE)
p.text(313,739,"解決したい困りごと:",9,True); p.line(408,743,565,743,LINE)
p.text(30,771,"機能名だけでなく、「誰が・いつ・何に困るか」を教えてください。",10,True,ACCENT)
p.line(30,798,565,798)
p.text(30,812,"参照:docs/design/ja/implementation-backlog.md、extensions.md、organizer-dashboard.md、各機能設計書",6.7,color=MUTED)
p.text(30,824,"展示・対話用シート。予定には未着手・保留を含みます。一般的なWikiへの要望も、Pages固有の要望も歓迎します。",6.7,color=MUTED)
return [(p,0,0)]
if __name__ == "__main__":
main()