Jelajahi Sumber

✨ (tpl-builder): 模板生成器迁到 v6,补全 Markup/Templates 的全部可手写模板

v4 只有 article、video 两个,v6 原来是 mock。现在按后端各模板的 params()
声明生成表单与代码,共 20 个(toggle、anno-* 内部模板不在列);预览走
/v3/markup-previews,与阅读页一致。从文章 / 章节入口打开时预填 article 页签。
弹窗高度不超出浏览器,模板列表与修改区同高、各自滚动。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 2 hari lalu
induk
melakukan
edb865d727

+ 72 - 0
dashboard-test/src/tests/tpl-builder.spec.ts

@@ -0,0 +1,72 @@
+import { test, expect } from '@playwright/test';
+import { collect } from '../lib/collect.js';
+
+/**
+ * 模板生成器(components/tpl-builder,后端 Markup/Templates 的全部可手写模板):
+ * 从文章阅读工具栏的「获取引用模版」打开,article 页签按这篇文章预填;切到其它模板填参数,代码随之变化,
+ * 预览走 v3 /markup-previews(后端渲染,与阅读页一致)。
+ */
+test('文章「获取引用模版」:预填 article 模板,切换模板生成代码并预览', async ({ page }) => {
+  const log = collect(page);
+  const list = page.waitForResponse((r) => /\/api\/v2\/article\?/.test(r.url()));
+  await page.goto('workspace/article', { waitUntil: 'networkidle' });
+  const rows = (await (await list).json()).data?.rows ?? [];
+  if (rows.length === 0) test.skip(true, '测试账号没有文章');
+  // 打开第一篇文章,阅读工具栏「更多」→「获取引用模版」
+  await page.goto(`workspace/article/${rows[0].uid}`, { waitUntil: 'networkidle' });
+  await page.getByRole('img', { name: 'more' }).first().click();
+  const preview1 = page.waitForResponse((r) => r.url().includes('/api/v3/markup-previews'));
+  await page.getByRole('menuitem', { name: '获取引用模版' }).click();
+
+  const dialog = page.getByRole('dialog').filter({ hasText: '模板生成器' });
+  await expect(dialog).toBeVisible();
+  const code = dialog.locator('textarea[readonly]');
+
+  // 弹窗不超出浏览器;换模板时修改区高度不变(内容多的 article 与内容少的 quality 同高)
+  const viewport = page.viewportSize()!.height;
+  const panelHeight = async () => (await dialog.locator('.tpl-builder-panel').boundingBox())!.height;
+
+  // article:按入口预填 type 与 id
+  await expect(code).toHaveValue(/^\{\{article\|type=article\|id=[0-9a-f-]{36}/);
+  expect((await preview1).status()).toBe(200);
+  await page.waitForTimeout(500); // 等弹窗的打开动画结束再量
+  const box = (await dialog.boundingBox())!;
+  expect(box.y + box.height).toBeLessThanOrEqual(viewport);
+  const articleHeight = await panelHeight();
+
+  // quality:缺省 pending,改成 featured,预览出标签
+  await dialog.getByRole('menuitem', { name: /quality/ }).click();
+  await expect(code).toHaveValue('{{quality|pending}}');
+  expect(await panelHeight()).toBe(articleHeight);
+  await dialog.locator('.ant-select').first().click();
+  const featured = page.waitForResponse(
+    (r) => r.url().includes('/api/v3/markup-previews') && (r.request().postData() ?? '').includes('featured'),
+  );
+  await page.locator('.ant-select-item-option', { hasText: 'featured' }).click();
+  await expect(code).toHaveValue('{{quality|featured}}');
+  const res = await featured;
+  expect(res.status()).toBe(200);
+  const body = (await res.json()).data.body;
+  expect(JSON.stringify(body)).toContain('"name":"quality"');
+  await expect(dialog.locator('.ant-tag').last()).toBeVisible();
+
+  // note:正文放第一个位置参数,其余写名字
+  await dialog.getByRole('menuitem', { name: /note/ }).click();
+  await dialog.locator('textarea:not([readonly])').first().fill('脚注正文 a=b');
+  await dialog.getByRole('textbox').nth(1).fill('*');
+  await expect(code).toHaveValue('{{note|脚注正文 a=b|trigger=*}}');
+
+  // mermaid:生成围栏
+  await dialog.getByRole('menuitem', { name: /mermaid/ }).click();
+  const mermaid = page.waitForResponse(
+    (r) => r.url().includes('/api/v3/markup-previews') && (r.request().postData() ?? '').includes('mermaid'),
+  );
+  await dialog.locator('textarea:not([readonly])').first().fill('graph LR\n  A --> B');
+  await expect(code).toHaveValue('```mermaid\ngraph LR\n  A --> B\n```');
+  expect(JSON.stringify((await (await mermaid).json()).data.body)).toContain('"name":"mermaid"');
+  // mermaid 异步渲染出的图(不是图标的 svg)
+  await expect(dialog.locator('svg[aria-roledescription]')).toBeVisible();
+
+  await page.screenshot({ path: 'testlog/assets/tpl-builder.png', fullPage: true });
+  log.dump('模板生成器');
+});

+ 19 - 0
dashboard-v6/src/api/markup.ts

@@ -0,0 +1,19 @@
+// src/api/markup.ts
+import { api, unwrapQuiet } from "./client";
+import type { paths } from "./schema";
+import type { MarkupNode } from "../components/markup/types";
+
+/* ─── v3 源码预览:把还没保存的 markdown 渲染成节点树(模板生成器的预览) ─── */
+
+export type MarkupPreviewInput = NonNullable<
+  paths["/v3/markup-previews"]["post"]["requestBody"]
+>["content"]["application/json"];
+
+/**
+ * 预览一段源码。失败不弹提示(unwrapQuiet):边输入边预览,由调用方在预览区里显示错误。
+ */
+export const previewMarkup = async (
+  input: MarkupPreviewInput,
+): Promise<MarkupNode[]> =>
+  unwrapQuiet(await api.POST("/v3/markup-previews", { body: input })).data
+    ?.body ?? [];

+ 0 - 29
dashboard-v6/src/components/tpl-builder/ArticleTpl.tsx

@@ -1,29 +0,0 @@
-import type { JSX } from "react";
-import type { ArticleType } from "../../api/article";
-import type { TDisplayStyle } from "../../types/template";
-
-interface IWidget {
-  type?: ArticleType;
-  articleId?: string;
-  title?: string;
-  style?: TDisplayStyle;
-  channel?: string | null;
-}
-
-export const ArticleTplMock = ({ title }: IWidget) => {
-  return <span>{"ArticleTplMock" + title}</span>;
-};
-
-interface IModalWidget {
-  open?: boolean;
-  type?: ArticleType;
-  articleId?: string;
-  channelsId?: string | null;
-  title?: string;
-  style?: TDisplayStyle;
-  trigger?: JSX.Element;
-  onClose?: () => void;
-}
-export const ArticleTplModalMock = ({ trigger }: IModalWidget) => {
-  return <>{trigger}</>;
-};

+ 135 - 33
dashboard-v6/src/components/tpl-builder/TplBuilder.tsx

@@ -1,66 +1,168 @@
-import { useEffect, useState } from "react";
-import { Modal, Tabs } from "antd";
+import { useMemo, useState } from "react";
+import { Divider, Input, Menu, Modal, Typography } from "antd";
+import { useIntl } from "react-intl";
+
 import type { ArticleType } from "../../api/article";
-import { ArticleTplMock } from "./ArticleTpl";
-import { VideoTplMock } from "./VideoTpl";
+import TplForm from "./TplForm";
+import TplPreview from "./TplPreview";
+import {
+  buildTplCode,
+  initialValues,
+  TEMPLATES,
+  tplKey,
+  type TplValues,
+} from "./templates";
+
+const { Paragraph, Text } = Typography;
+
+/** article 模板的 type 能取的值;入口传来的其它类型(series、term…)按 article 处理 */
+const ARTICLE_TYPES: string[] = ["article", "chapter", "para", "anthology"];
+
+/** 弹窗内容区高度:视口减去上边距 20、标题约 40、上下内边距 40、下边距 20 */
+const BODY_HEIGHT = "calc(100vh - 140px)";
 
 interface IWidget {
   trigger?: React.ReactNode;
   open?: boolean;
+  /** 从文章 / 章节入口打开时:article 模板预填的类型、id、标题、channel */
   tpl?: ArticleType;
   articleId?: string;
+  /** channel uid,多个用 `_` 连接(与阅读页地址的 channel 参数相同) */
   channelsId?: string | null;
   title?: string;
   onClose?: () => void;
 }
+
+/**
+ * 模板生成器:选模板 → 填参数 → 得到模板代码(可复制)与后端渲染的预览。
+ * 能生成的模板见 ./templates.ts(与后端 App\Services\Markup\Templates 对应)。
+ */
 const TplBuilderWidget = ({
   trigger,
   open = false,
   tpl,
   articleId,
+  channelsId,
+  title,
   onClose,
 }: IWidget) => {
-  const [isModalOpen, setIsModalOpen] = useState(open);
+  const intl = useIntl();
+  /** 点 trigger 打开的;受控打开(open)由调用方在 onClose 里关 */
+  const [innerOpen, setInnerOpen] = useState(false);
+  const [active, setActive] = useState("article");
 
-  useEffect(() => {
-    setIsModalOpen(open);
-  }, [open]);
+  /** 每个模板各自的参数值,切换页签不丢 */
+  const prefilled = useMemo<Record<string, TplValues>>(() => {
+    const all = Object.fromEntries(
+      TEMPLATES.map((spec) => [spec.name, initialValues(spec)]),
+    );
+    if (articleId) {
+      all.article = {
+        ...all.article,
+        type: tpl && ARTICLE_TYPES.includes(tpl) ? tpl : "article",
+        id: articleId,
+        title,
+        channel: channelsId ?? undefined,
+      };
+    }
+    return all;
+  }, [tpl, articleId, title, channelsId]);
+  // 入口换了文章 / 章节就丢掉改过的值,回到新的预填值
+  const [state, setState] = useState({ base: prefilled, values: prefilled });
+  const values = state.base === prefilled ? state.values : prefilled;
+  const setValues = (next: Record<string, TplValues>) =>
+    setState({ base: prefilled, values: next });
 
-  const showModal = () => {
-    setIsModalOpen(true);
-  };
+  const spec = TEMPLATES.find((t) => t.name === active) ?? TEMPLATES[0];
+  const current = values[spec.name] ?? {};
+  const code = buildTplCode(spec, current);
+
+  /** 预览按哪些 channel 渲染:表单里填的优先,其次是入口传来的 */
+  const previewChannels = (current.channel ?? channelsId ?? "")
+    .split(/[_,]/)
+    .filter((c) => c !== "");
 
   const handleCancel = () => {
-    if (onClose) {
-      onClose();
-    } else {
-      setIsModalOpen(false);
-    }
+    setInnerOpen(false);
+    onClose?.();
+  };
+
+  const tabLabel = (name: string) => {
+    const id = `tpl-builder.tpl.${tplKey(name)}`;
+    return intl.messages[id] ? `${intl.formatMessage({ id })} ${name}` : name;
   };
 
+  const panel = (
+    <div>
+      {intl.messages[`tpl-builder.desc.${tplKey(spec.name)}`] ? (
+        <Paragraph type="secondary">
+          {intl.formatMessage({ id: `tpl-builder.desc.${tplKey(spec.name)}` })}
+        </Paragraph>
+      ) : null}
+      <TplForm
+        spec={spec}
+        values={current}
+        onChange={(v) => setValues({ ...values, [spec.name]: v })}
+      />
+      <Divider titlePlacement="start" plain>
+        {intl.formatMessage({ id: "tpl-builder.code" })}
+      </Divider>
+      <Input.TextArea
+        value={code}
+        readOnly
+        autoSize={{ minRows: 1, maxRows: 8 }}
+        style={{ fontFamily: "monospace" }}
+      />
+      <Text copyable={{ text: code }}>
+        {intl.formatMessage({ id: "buttons.copy" })}
+      </Text>
+      <Divider titlePlacement="start" plain>
+        {intl.formatMessage({ id: "buttons.preview" })}
+      </Divider>
+      <TplPreview code={code} channels={previewChannels} />
+    </div>
+  );
+
   return (
     <>
-      <span onClick={showModal}>{trigger}</span>
+      <span onClick={() => setInnerOpen(true)}>{trigger}</span>
       <Modal
-        style={{ top: 20 }}
-        width={900}
+        style={{ top: 20, paddingBottom: 0 }}
+        width={1000}
         footer={false}
-        title="template builder"
-        open={isModalOpen}
+        title={intl.formatMessage({ id: "tpl-builder.title" })}
+        open={open || innerOpen}
         onCancel={handleCancel}
       >
-        <Tabs
-          tabPosition="left"
-          defaultActiveKey="article"
-          items={[
-            {
-              label: "article",
-              key: "article",
-              children: <ArticleTplMock articleId={articleId} type={tpl} />,
-            }, // 务必填写 key
-            { label: "video", key: "video", children: <VideoTplMock /> },
-          ]}
-        />
+        {/*
+          弹窗不超出浏览器:内容区高度 = 视口 − 弹窗上下边距、标题与内边距。
+          模板列表与修改区同高、各自滚动,换模板时修改区高度不变。
+          不用竖排 Tabs:限高后它把放不下的页签收进「更多」下拉,二十个模板大半看不见。
+        */}
+        <div style={{ display: "flex", height: BODY_HEIGHT }}>
+          <Menu
+            mode="inline"
+            selectedKeys={[spec.name]}
+            onClick={({ key }) => setActive(key)}
+            style={{ width: 200, flexShrink: 0, overflowY: "auto" }}
+            items={TEMPLATES.map((t) => ({
+              key: t.name,
+              label: tabLabel(t.name),
+            }))}
+          />
+          {/* 只渲染当前模板:预览会请求后端 */}
+          <div
+            className="tpl-builder-panel"
+            style={{
+              flex: 1,
+              minWidth: 0,
+              overflowY: "auto",
+              padding: "0 8px 0 24px",
+            }}
+          >
+            {panel}
+          </div>
+        </div>
       </Modal>
     </>
   );

+ 175 - 0
dashboard-v6/src/components/tpl-builder/TplForm.tsx

@@ -0,0 +1,175 @@
+import { Button, Form, Input, InputNumber, Select, Space } from "antd";
+import { FolderOpenOutlined } from "@ant-design/icons";
+import { useIntl } from "react-intl";
+
+import { useAppSelector } from "../../hooks";
+import { currentUser } from "../../reducers/current-user";
+import ArticleListModal from "../article/ArticleListModal";
+import ChannelTableModal from "../channel/ChannelTableModal";
+import AttachmentDialog from "../attachment/AttachmentDialog";
+import {
+  isVisible,
+  tplKey,
+  type TplField,
+  type TplSpec,
+  type TplValues,
+} from "./templates";
+
+interface IWidget {
+  spec: TplSpec;
+  values: TplValues;
+  onChange: (values: TplValues) => void;
+}
+
+/**
+ * 一个模板的参数表单。受控:值由 TplBuilder 按模板分别保存,切换页签不丢。
+ */
+const TplForm = ({ spec, values, onChange }: IWidget) => {
+  const intl = useIntl();
+  const user = useAppSelector(currentUser);
+
+  /** 参数的显示名:先找模板专用的(同名参数在不同模板里意思不同,如 text),再找通用的 */
+  const label = (field: TplField) => {
+    const own = `tpl-builder.field.${tplKey(spec.name)}.${field.name}`;
+    const id = intl.messages[own] ? own : `tpl-builder.field.${field.name}`;
+    return intl.messages[id]
+      ? `${intl.formatMessage({ id })} (${field.name})`
+      : field.name;
+  };
+
+  const set = (name: string, value: string | undefined) =>
+    onChange({ ...values, [name]: value });
+
+  const control = (field: TplField) => {
+    const value = values[field.name];
+    const text = (
+      <Input
+        value={value}
+        placeholder={field.placeholder}
+        allowClear
+        onChange={(e) => set(field.name, e.target.value)}
+      />
+    );
+    switch (field.kind) {
+      case "select":
+        return (
+          <Select
+            value={value}
+            allowClear={!field.required}
+            style={{ width: 200 }}
+            options={field.options?.map((o) => ({ value: o, label: o }))}
+            onChange={(v: string | undefined) => set(field.name, v)}
+          />
+        );
+      case "textarea":
+        return (
+          <Input.TextArea
+            value={value}
+            placeholder={field.placeholder}
+            autoSize={{ minRows: 3, maxRows: 10 }}
+            onChange={(e) => set(field.name, e.target.value)}
+          />
+        );
+      case "number":
+        return (
+          <InputNumber
+            value={value === undefined || value === "" ? null : Number(value)}
+            min={0}
+            style={{ width: 200 }}
+            onChange={(v) =>
+              set(field.name, v === null ? undefined : String(v))
+            }
+          />
+        );
+      case "article":
+        return (
+          <Space.Compact style={{ width: "100%" }}>
+            {text}
+            {/* 只有 type=article 能从文章列表里挑;章节、段落的 id 是经文坐标 */}
+            {(values.type ?? "article") === "article" ? (
+              <ArticleListModal
+                studioName={user?.realName}
+                multiple={false}
+                trigger={
+                  <Button
+                    icon={<FolderOpenOutlined />}
+                    title={intl.formatMessage({
+                      id: "tpl-builder.select.article",
+                    })}
+                  />
+                }
+                onSelect={(id: string, title: string) =>
+                  onChange({
+                    ...values,
+                    id,
+                    title: values.title ? values.title : title,
+                  })
+                }
+              />
+            ) : null}
+          </Space.Compact>
+        );
+      case "channel":
+        return (
+          <Space.Compact style={{ width: "100%" }}>
+            {text}
+            <ChannelTableModal
+              trigger={
+                <Button
+                  icon={<FolderOpenOutlined />}
+                  title={intl.formatMessage({
+                    id: "tpl-builder.select.channel",
+                  })}
+                />
+              }
+              onSelect={(channel) => set(field.name, channel.id)}
+            />
+          </Space.Compact>
+        );
+      case "attachment":
+        return (
+          <Space.Compact style={{ width: "100%" }}>
+            {text}
+            <AttachmentDialog
+              trigger={
+                <Button
+                  icon={<FolderOpenOutlined />}
+                  title={intl.formatMessage({
+                    id: "tpl-builder.select.attachment",
+                  })}
+                />
+              }
+              onSelect={(file) =>
+                onChange({
+                  ...values,
+                  [field.name]: file.url,
+                  title: values.title ? values.title : file.title,
+                })
+              }
+            />
+          </Space.Compact>
+        );
+      default:
+        return text;
+    }
+  };
+
+  return (
+    <Form layout="vertical" size="small">
+      {spec.fields
+        .filter((f) => isVisible(f, values))
+        .map((field) => (
+          <Form.Item
+            key={field.name}
+            label={label(field)}
+            required={field.required}
+            style={{ marginBottom: 8 }}
+          >
+            {control(field)}
+          </Form.Item>
+        ))}
+    </Form>
+  );
+};
+
+export default TplForm;

+ 77 - 0
dashboard-v6/src/components/tpl-builder/TplPreview.tsx

@@ -0,0 +1,77 @@
+import { useEffect, useState } from "react";
+import { Alert, Spin } from "antd";
+import { useIntl } from "react-intl";
+
+import { previewMarkup } from "../../api/markup";
+import { ApiError } from "../../api/error";
+import MarkupView from "../markup/MarkupView";
+import type { MarkupNode } from "../markup/types";
+
+/** 停止输入多久后才请求预览 */
+const DEBOUNCE_MS = 500;
+
+const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+
+interface IWidget {
+  code: string;
+  /** 预览时按哪些 channel 查术语、读译文(非 uuid 的忽略) */
+  channels?: string[];
+}
+
+/**
+ * 模板代码的预览:交给后端渲染(`POST /v3/markup-previews`),与保存后在阅读页看到的一致。
+ */
+const TplPreview = ({ code, channels = [] }: IWidget) => {
+  const intl = useIntl();
+  const [nodes, setNodes] = useState<MarkupNode[]>([]);
+  const [error, setError] = useState<string>();
+  const [loading, setLoading] = useState(false);
+
+  const channelKey = channels.filter((c) => UUID.test(c)).join(",");
+
+  useEffect(() => {
+    let active = true;
+    const timer = setTimeout(() => {
+      setLoading(true);
+      previewMarkup({
+        content: code,
+        channels: channelKey === "" ? undefined : channelKey.split(","),
+      })
+        .then((result) => {
+          if (!active) return;
+          setNodes(result);
+          setError(undefined);
+        })
+        .catch((e: unknown) => {
+          if (!active) return;
+          setNodes([]);
+          setError(
+            e instanceof ApiError
+              ? e.message
+              : intl.formatMessage({ id: "tpl-builder.preview.failed" }),
+          );
+        })
+        .finally(() => active && setLoading(false));
+    }, DEBOUNCE_MS);
+    return () => {
+      active = false;
+      clearTimeout(timer);
+    };
+  }, [code, channelKey, intl]);
+
+  if (error) {
+    return <Alert type="warning" showIcon message={error} />;
+  }
+  return (
+    <Spin spinning={loading}>
+      <div style={{ minHeight: 40 }}>
+        <MarkupView
+          nodes={nodes}
+          placeholder={intl.formatMessage({ id: "tpl-builder.preview.empty" })}
+        />
+      </div>
+    </Spin>
+  );
+};
+
+export default TplPreview;

+ 0 - 21
dashboard-v6/src/components/tpl-builder/VideoTpl.tsx

@@ -1,21 +0,0 @@
-import type { JSX } from "react";
-import type { TDisplayStyle } from "../../types/template";
-
-interface IWidget {
-  url?: string;
-  title?: string;
-  style?: TDisplayStyle;
-}
-export const VideoTplMock = ({ title }: IWidget) => {
-  return <>{title}</>;
-};
-
-interface IModalWidget {
-  url?: string;
-  title?: string;
-  style?: TDisplayStyle;
-  trigger?: JSX.Element;
-}
-export const VideoTplModalMock = ({ trigger }: IModalWidget) => {
-  return <>{trigger}</>;
-};

+ 328 - 0
dashboard-v6/src/components/tpl-builder/templates.ts

@@ -0,0 +1,328 @@
+/**
+ * 模板生成器能生成的模板。与后端 `App\Services\Markup\Templates` 一一对应:
+ * 模板名、参数名取自各模板的 `params()`,取值范围取自它的注释与前端组件。
+ *
+ * 不在这里的:`toggle`(`- <div>…</div>` 列表项由解析器自动生成)、内部模板 `anno-*`(程序注入)、
+ * `unknown`(没登记的名字)。别名 `n`(= note)只生成正式名字。
+ */
+
+/** 表单控件 */
+export type TplFieldKind =
+  | "text"
+  | "textarea"
+  | "number"
+  | "select"
+  /** 文本框 + 选文章 */
+  | "article"
+  /** 文本框 + 选 channel */
+  | "channel"
+  /** 文本框 + 从网盘选文件 */
+  | "attachment";
+
+export interface TplField {
+  /** 参数名(后端 ParamSpec 的键) */
+  name: string;
+  kind: TplFieldKind;
+  /** select 的取值 */
+  options?: string[];
+  /** 缺省值:表单初始值,也是后端的默认值(与它相同时不写进代码) */
+  defaultValue?: string;
+  placeholder?: string;
+  required?: boolean;
+  /** 只在别的参数取某些值时显示 */
+  visibleWhen?: { field: string; values: string[] };
+}
+
+export interface TplSpec {
+  /** 模板名(`{{名字|…}}`);`Tpl:` 是用户自定义模板 */
+  name: string;
+  fields: TplField[];
+  /** 不走 `{{名字|k=v}}` 的,自己拼代码 */
+  build?: (values: TplValues) => string;
+}
+
+export type TplValues = Record<string, string | undefined>;
+
+/** 前端 DisplayWrapper 支持的显示方式(types/template.ts 的 TDisplayStyle) */
+const DISPLAY_STYLES = ["modal", "card", "toggle", "link", "window", "popover"];
+
+const style = (defaultValue?: string): TplField => ({
+  name: "style",
+  kind: "select",
+  options: DISPLAY_STYLES,
+  defaultValue,
+});
+
+export const TEMPLATES: TplSpec[] = [
+  {
+    name: "article",
+    fields: [
+      {
+        name: "type",
+        kind: "select",
+        options: ["article", "chapter", "para", "anthology"],
+        defaultValue: "article",
+        required: true,
+      },
+      { name: "id", kind: "article", placeholder: "uuid / book-para" },
+      {
+        name: "book",
+        kind: "number",
+        visibleWhen: { field: "type", values: ["chapter"] },
+      },
+      {
+        name: "paragraphs",
+        kind: "number",
+        visibleWhen: { field: "type", values: ["chapter"] },
+      },
+      { name: "title", kind: "text" },
+      { name: "channel", kind: "channel" },
+      {
+        name: "anthology",
+        kind: "text",
+        placeholder: "uuid",
+        visibleWhen: { field: "type", values: ["article"] },
+      },
+      style(),
+    ],
+  },
+  {
+    name: "para",
+    fields: [
+      { name: "id", kind: "text", placeholder: "book-para", required: true },
+      { name: "title", kind: "text" },
+      style(),
+    ],
+  },
+  {
+    name: "sent",
+    fields: [
+      {
+        name: "id",
+        kind: "text",
+        placeholder: "book-para-start-end",
+        required: true,
+      },
+      { name: "channel", kind: "channel" },
+      {
+        name: "text",
+        kind: "select",
+        options: ["both", "origin", "translation"],
+        defaultValue: "both",
+      },
+    ],
+  },
+  {
+    name: "quote",
+    fields: [
+      { name: "para", kind: "text", placeholder: "book-para", required: true },
+    ],
+  },
+  {
+    name: "ql",
+    fields: [
+      {
+        name: "type",
+        kind: "select",
+        // 印本版本(page_numbers.type,大小写不论);c 按章节路径取书名与章名
+        options: ["c", "p", "m", "v", "t", "o"],
+        required: true,
+      },
+      { name: "book", kind: "number" },
+      { name: "para", kind: "number" },
+      { name: "bookname", kind: "text" },
+      { name: "volume", kind: "number" },
+      { name: "page", kind: "number" },
+      { name: "title", kind: "text" },
+      style("modal"),
+    ],
+  },
+  {
+    name: "term",
+    fields: [
+      {
+        name: "word",
+        kind: "text",
+        placeholder: "word / word@tag / word#text",
+        required: true,
+      },
+    ],
+    // `[[word]]` 是 term 的简写,最常用
+    build: (v) => (v.word ? `[[${v.word}]]` : "[[]]"),
+  },
+  {
+    name: "g",
+    fields: [{ name: "word", kind: "text", required: true }],
+  },
+  {
+    name: "note",
+    fields: [
+      { name: "text", kind: "textarea", required: true },
+      { name: "trigger", kind: "text" },
+      { name: "cite", kind: "text" },
+      { name: "citelink", kind: "text", placeholder: "book-para-start-end" },
+    ],
+    // 正文放第一个位置参数:E2 方言下正文里出现 `|`、`a=b` 都不会被拆开
+    build: (v) => tplCode("note", omit(v, "text"), v.text ?? ""),
+  },
+  {
+    name: "qa",
+    fields: [
+      {
+        name: "id",
+        kind: "text",
+        placeholder: "discussion uuid",
+        required: true,
+      },
+      style(),
+    ],
+  },
+  {
+    name: "v",
+    fields: [
+      { name: "url", kind: "attachment", required: true },
+      { name: "title", kind: "text" },
+      style("modal"),
+    ],
+  },
+  {
+    name: "nissaya",
+    fields: [
+      { name: "pali", kind: "text", required: true },
+      { name: "meaning", kind: "text", placeholder: "meaning=meaning2" },
+    ],
+  },
+  {
+    name: "exercise",
+    fields: [
+      { name: "id", kind: "text", required: true },
+      { name: "title", kind: "text" },
+    ],
+  },
+  {
+    name: "ai",
+    fields: [
+      { name: "title", kind: "text" },
+      { name: "message", kind: "textarea" },
+      {
+        name: "style",
+        kind: "select",
+        options: ["block", "tag"],
+        defaultValue: "block",
+      },
+    ],
+  },
+  {
+    name: "category",
+    fields: [{ name: "name", kind: "text", required: true }],
+  },
+  {
+    name: "quality",
+    fields: [
+      {
+        name: "value",
+        kind: "select",
+        options: ["featured", "standard", "draft", "pending"],
+        defaultValue: "pending",
+        required: true,
+      },
+    ],
+    // 缺省值也要写出来:`{{quality}}` 读起来看不出是哪一档
+    build: (v) => `{{quality|${v.value ?? "pending"}}}`,
+  },
+  {
+    name: "ref",
+    fields: [{ name: "title", kind: "text" }],
+  },
+  {
+    name: "toc",
+    fields: [
+      { name: "levels", kind: "text", placeholder: "2-3", defaultValue: "2-3" },
+      { name: "title", kind: "text" },
+    ],
+  },
+  {
+    name: "dict-pref",
+    fields: [
+      { name: "page", kind: "number", defaultValue: "1" },
+      { name: "size", kind: "number", defaultValue: "100" },
+    ],
+  },
+  {
+    name: "mermaid",
+    fields: [
+      {
+        name: "text",
+        kind: "textarea",
+        placeholder: "graph LR\n  A --> B",
+        required: true,
+      },
+    ],
+    // 图表写成 ```mermaid 围栏,解析时转成 mermaid 模板
+    build: (v) => "```mermaid\n" + (v.text ?? "") + "\n```",
+  },
+  {
+    name: "Tpl:",
+    fields: [
+      { name: "name", kind: "text", required: true },
+      { name: "params", kind: "textarea", placeholder: "value\nname=value" },
+    ],
+    // 以文章为模板:参数原样交给 Mustache({{1}}、{{b}}),每行一个
+    build: (v) => {
+      const params = (v.params ?? "")
+        .split("\n")
+        .map((line) => line.trim())
+        .filter((line) => line !== "");
+      return `{{${["Tpl:" + (v.name ?? ""), ...params].join("|")}}}`;
+    },
+  },
+];
+
+const omit = (values: TplValues, name: string): TplValues => {
+  const rest = { ...values };
+  delete rest[name];
+  return rest;
+};
+
+/** `{{名字|位置参数|k=v|…}}`:空值与等于缺省值的参数不写 */
+const tplCode = (
+  name: string,
+  values: TplValues,
+  positional?: string,
+): string => {
+  const spec = TEMPLATES.find((t) => t.name === name);
+  const named = (spec?.fields ?? [])
+    .filter((f) => isVisible(f, values))
+    .filter((f) => {
+      const value = values[f.name];
+      if (value === undefined || value === "") return false;
+      // 必填的照写(后端没有缺省值);可选的等于缺省值就省掉
+      return f.required || value !== f.defaultValue;
+    })
+    .map((f) => `${f.name}=${values[f.name]}`);
+  const parts = [
+    name,
+    ...(positional !== undefined ? [positional] : []),
+    ...named,
+  ];
+  return `{{${parts.join("|")}}}`;
+};
+
+/** 模板名 → 文案键里的名字(`Tpl:` 去掉冒号) */
+export const tplKey = (name: string) => name.replace(":", "");
+
+export const isVisible = (field: TplField, values: TplValues): boolean =>
+  !field.visibleWhen ||
+  field.visibleWhen.values.includes(values[field.visibleWhen.field] ?? "");
+
+/** 按表单的值生成模板代码 */
+export const buildTplCode = (spec: TplSpec, values: TplValues): string =>
+  spec.build ? spec.build(values) : tplCode(spec.name, values);
+
+/** 表单初始值:各参数的缺省值 */
+export const initialValues = (spec: TplSpec): TplValues =>
+  Object.fromEntries(
+    spec.fields
+      .filter((f) => f.defaultValue !== undefined)
+      .map((f) => [f.name, f.defaultValue]),
+  );

+ 2 - 0
dashboard-v6/src/locales/en-US.ts

@@ -13,6 +13,7 @@ import pages from "./en-US/pages";
 import admin from "./en-US/admin";
 import adminStats from "./en-US/admin-stats";
 import search from "./en-US/search";
+import tplBuilder from "./en-US/tpl-builder";
 
 const items = {
   "columns.library.title": "Library",
@@ -79,6 +80,7 @@ const items = {
   ...admin,
   ...adminStats,
   ...search,
+  ...tplBuilder,
 };
 
 export default items;

+ 96 - 0
dashboard-v6/src/locales/en-US/tpl-builder.ts

@@ -0,0 +1,96 @@
+// Template builder (components/tpl-builder)
+const items = {
+  "tpl-builder.title": "Template builder",
+  "tpl-builder.code": "Code",
+  "tpl-builder.preview.empty": "Fill in the parameters to see a preview",
+  "tpl-builder.preview.failed": "Preview failed",
+  "tpl-builder.select.article": "Choose an article",
+  "tpl-builder.select.channel": "Choose a channel",
+  "tpl-builder.select.attachment": "Choose from attachments",
+
+  "tpl-builder.tpl.article": "Article / chapter",
+  "tpl-builder.tpl.para": "Paragraph",
+  "tpl-builder.tpl.sent": "Sentence",
+  "tpl-builder.tpl.quote": "Quote",
+  "tpl-builder.tpl.ql": "Page reference",
+  "tpl-builder.tpl.term": "Term",
+  "tpl-builder.tpl.g": "Grammar term",
+  "tpl-builder.tpl.note": "Footnote",
+  "tpl-builder.tpl.qa": "Q&A",
+  "tpl-builder.tpl.v": "Video",
+  "tpl-builder.tpl.nissaya": "Word gloss",
+  "tpl-builder.tpl.exercise": "Exercise",
+  "tpl-builder.tpl.ai": "AI notice",
+  "tpl-builder.tpl.category": "Category",
+  "tpl-builder.tpl.quality": "Quality",
+  "tpl-builder.tpl.ref": "References",
+  "tpl-builder.tpl.toc": "Contents",
+  "tpl-builder.tpl.dict-pref": "Dictionary prefixes",
+  "tpl-builder.tpl.mermaid": "Diagram",
+  "tpl-builder.tpl.Tpl": "Custom template",
+
+  "tpl-builder.desc.article":
+    "Embed an article, an anthology or a chapter / paragraph. A chapter can be given by book + paragraph instead of an id.",
+  "tpl-builder.desc.para": "Embed a paragraph; the id is book-paragraph.",
+  "tpl-builder.desc.sent":
+    "Embed a sentence; the id is book-paragraph-start-end. Without a channel, the content's own channel is used.",
+  "tpl-builder.desc.quote":
+    "Quote a paragraph, showing the title of its chapter.",
+  "tpl-builder.desc.ql":
+    "Cite a volume and page of a printed edition, either by book + paragraph or by book name, volume and page.",
+  "tpl-builder.desc.term":
+    "A term, written as the [[word]] shorthand. word@tag looks up by tag; word#text shows the given text instead of the translation.",
+  "tpl-builder.desc.g": "Look up a term in the system grammar glossary.",
+  "tpl-builder.desc.note":
+    "A footnote. The text may span lines and paragraphs and contain templates.",
+  "tpl-builder.desc.qa": "Embed a Q&A topic.",
+  "tpl-builder.desc.v":
+    "A video. Only http(s) and site-relative addresses are allowed.",
+  "tpl-builder.desc.nissaya": "Burmese word-by-word gloss.",
+  "tpl-builder.desc.ai":
+    "Mark AI-generated content: block is a quote block, tag is a small inline tag.",
+  "tpl-builder.desc.category": "A category tag.",
+  "tpl-builder.desc.quality": "Quality tag of a term or article.",
+  "tpl-builder.desc.ref":
+    "List the Pali works cited in this text, wherever it is placed.",
+  "tpl-builder.desc.toc": "Contents generated from the headings of this text.",
+  "tpl-builder.desc.dict-pref": "Dictionary prefix list.",
+  "tpl-builder.desc.mermaid":
+    "A mermaid diagram, written as a ```mermaid fence.",
+  "tpl-builder.desc.Tpl":
+    'Use the article titled "Tpl:name" as a template; parameters fill its text by position (1, 2…) or by name.',
+
+  "tpl-builder.field.type": "Type",
+  "tpl-builder.field.id": "id",
+  "tpl-builder.field.book": "Book",
+  "tpl-builder.field.paragraphs": "Paragraph",
+  "tpl-builder.field.para": "Paragraph",
+  "tpl-builder.field.title": "Title",
+  "tpl-builder.field.channel": "Channel",
+  "tpl-builder.field.anthology": "Anthology",
+  "tpl-builder.field.style": "Display as",
+  "tpl-builder.field.bookname": "Book name",
+  "tpl-builder.field.volume": "Volume",
+  "tpl-builder.field.page": "Page",
+  "tpl-builder.field.word": "Word",
+  "tpl-builder.field.trigger": "Marker text",
+  "tpl-builder.field.cite": "Source",
+  "tpl-builder.field.citelink": "Source location",
+  "tpl-builder.field.url": "Address",
+  "tpl-builder.field.pali": "Pali",
+  "tpl-builder.field.meaning": "Meaning",
+  "tpl-builder.field.message": "Message",
+  "tpl-builder.field.name": "Name",
+  "tpl-builder.field.value": "Quality",
+  "tpl-builder.field.levels": "Heading levels",
+  "tpl-builder.field.size": "Page size",
+  "tpl-builder.field.params": "Parameters",
+  "tpl-builder.field.sent.text": "Show",
+  "tpl-builder.field.note.text": "Text",
+  "tpl-builder.field.mermaid.text": "Diagram source",
+  "tpl-builder.field.quote.para": "Paragraph",
+  "tpl-builder.field.dict-pref.page": "Page",
+  "tpl-builder.field.ql.type": "Edition",
+};
+
+export default items;

+ 2 - 0
dashboard-v6/src/locales/zh-Hans.ts

@@ -13,6 +13,7 @@ import pages from "./zh-Hans/pages";
 import admin from "./zh-Hans/admin";
 import adminStats from "./zh-Hans/admin-stats";
 import search from "./zh-Hans/search";
+import tplBuilder from "./zh-Hans/tpl-builder";
 
 const items = {
   "columns.library.title": "藏经阁",
@@ -79,6 +80,7 @@ const items = {
   ...admin,
   ...adminStats,
   ...search,
+  ...tplBuilder,
 };
 
 export default items;

+ 91 - 0
dashboard-v6/src/locales/zh-Hans/tpl-builder.ts

@@ -0,0 +1,91 @@
+// 模板生成器(components/tpl-builder)文案
+const items = {
+  "tpl-builder.title": "模板生成器",
+  "tpl-builder.code": "代码",
+  "tpl-builder.preview.empty": "填好参数后在这里预览",
+  "tpl-builder.preview.failed": "预览失败",
+  "tpl-builder.select.article": "选择文章",
+  "tpl-builder.select.channel": "选择版本",
+  "tpl-builder.select.attachment": "从网盘选择",
+
+  "tpl-builder.tpl.article": "文章 / 章节",
+  "tpl-builder.tpl.para": "经文段落",
+  "tpl-builder.tpl.sent": "句子",
+  "tpl-builder.tpl.quote": "引用段落",
+  "tpl-builder.tpl.ql": "引用页码",
+  "tpl-builder.tpl.term": "术语",
+  "tpl-builder.tpl.g": "语法术语",
+  "tpl-builder.tpl.note": "脚注",
+  "tpl-builder.tpl.qa": "问答",
+  "tpl-builder.tpl.v": "视频",
+  "tpl-builder.tpl.nissaya": "逐词释义",
+  "tpl-builder.tpl.exercise": "练习",
+  "tpl-builder.tpl.ai": "AI 提示",
+  "tpl-builder.tpl.category": "分类",
+  "tpl-builder.tpl.quality": "质量",
+  "tpl-builder.tpl.ref": "参考文献",
+  "tpl-builder.tpl.toc": "目录",
+  "tpl-builder.tpl.dict-pref": "词典前缀",
+  "tpl-builder.tpl.mermaid": "图表",
+  "tpl-builder.tpl.Tpl": "自定义模板",
+
+  "tpl-builder.desc.article":
+    "嵌入一篇文章、文集或一个章节 / 段落。章节可以只给书号 + 段号,不填 id。",
+  "tpl-builder.desc.para": "嵌入一段经文,id 写成 书号-段号。",
+  "tpl-builder.desc.sent":
+    "嵌入一个句子,id 写成 书号-段号-起始词-结束词;不填 channel 用内容所属的版本。",
+  "tpl-builder.desc.quote": "引用一段经文,显示该段所在的章节标题。",
+  "tpl-builder.desc.ql":
+    "引用某个印本的册页。给书号 + 段号时按坐标查书名与页码;也可以直接写书名、册、页。",
+  "tpl-builder.desc.term":
+    "术语,生成 [[词]] 简写。词@tag 按 tag 查,词#文字 用指定文字代替译名。",
+  "tpl-builder.desc.g": "在系统语法术语表里查一个语法术语。",
+  "tpl-builder.desc.note": "脚注:正文可换行、可分段、可嵌模板。",
+  "tpl-builder.desc.qa": "嵌入一个问答话题。",
+  "tpl-builder.desc.v": "视频,地址只允许 http(s) 与站内路径。",
+  "tpl-builder.desc.nissaya": "缅文逐词释义。",
+  "tpl-builder.desc.ai":
+    "标出 AI 生成的内容。block 是引用块,tag 是行内小标签。",
+  "tpl-builder.desc.category": "分类标签。",
+  "tpl-builder.desc.quality": "术语 / 文章的质量标签。",
+  "tpl-builder.desc.ref": "列出本文引用到的巴利文献,写在哪里都能列全。",
+  "tpl-builder.desc.toc": "从本文的标题自动生成目录。",
+  "tpl-builder.desc.dict-pref": "词典前缀列表。",
+  "tpl-builder.desc.mermaid": "mermaid 图表,生成 ```mermaid 围栏。",
+  "tpl-builder.desc.Tpl":
+    "以标题为「Tpl:名字」的文章为模板,参数按位置(1、2…)或名字代入它的正文。",
+
+  "tpl-builder.field.type": "类型",
+  "tpl-builder.field.id": "id",
+  "tpl-builder.field.book": "书号",
+  "tpl-builder.field.paragraphs": "段号",
+  "tpl-builder.field.para": "段号",
+  "tpl-builder.field.title": "标题",
+  "tpl-builder.field.channel": "版本",
+  "tpl-builder.field.anthology": "文集",
+  "tpl-builder.field.style": "显示为",
+  "tpl-builder.field.bookname": "书名",
+  "tpl-builder.field.volume": "册",
+  "tpl-builder.field.page": "页",
+  "tpl-builder.field.word": "词",
+  "tpl-builder.field.trigger": "角标文字",
+  "tpl-builder.field.cite": "来源说明",
+  "tpl-builder.field.citelink": "来源坐标",
+  "tpl-builder.field.url": "地址",
+  "tpl-builder.field.pali": "巴利",
+  "tpl-builder.field.meaning": "意思",
+  "tpl-builder.field.message": "说明",
+  "tpl-builder.field.name": "名称",
+  "tpl-builder.field.value": "质量",
+  "tpl-builder.field.levels": "标题层级",
+  "tpl-builder.field.size": "每页条数",
+  "tpl-builder.field.params": "参数",
+  "tpl-builder.field.sent.text": "显示",
+  "tpl-builder.field.note.text": "正文",
+  "tpl-builder.field.mermaid.text": "图表源码",
+  "tpl-builder.field.quote.para": "段落",
+  "tpl-builder.field.dict-pref.page": "页码",
+  "tpl-builder.field.ql.type": "版本",
+};
+
+export default items;

+ 2 - 0
dashboard-v6/src/locales/zh-Hant.ts

@@ -13,6 +13,7 @@ import pages from "./zh-Hant/pages";
 import admin from "./zh-Hant/admin";
 import adminStats from "./zh-Hant/admin-stats";
 import search from "./zh-Hant/search";
+import tplBuilder from "./zh-Hant/tpl-builder";
 
 const items = {
   "columns.library.title": "藏經閣",
@@ -79,6 +80,7 @@ const items = {
   ...admin,
   ...adminStats,
   ...search,
+  ...tplBuilder,
 };
 
 export default items;

+ 91 - 0
dashboard-v6/src/locales/zh-Hant/tpl-builder.ts

@@ -0,0 +1,91 @@
+// 模板生成器(components/tpl-builder)文案
+const items = {
+  "tpl-builder.title": "模板生成器",
+  "tpl-builder.code": "代碼",
+  "tpl-builder.preview.empty": "填好參數後在這裡預覽",
+  "tpl-builder.preview.failed": "預覽失敗",
+  "tpl-builder.select.article": "選擇文章",
+  "tpl-builder.select.channel": "選擇版本",
+  "tpl-builder.select.attachment": "從網盤選擇",
+
+  "tpl-builder.tpl.article": "文章 / 章節",
+  "tpl-builder.tpl.para": "經文段落",
+  "tpl-builder.tpl.sent": "句子",
+  "tpl-builder.tpl.quote": "引用段落",
+  "tpl-builder.tpl.ql": "引用頁碼",
+  "tpl-builder.tpl.term": "術語",
+  "tpl-builder.tpl.g": "語法術語",
+  "tpl-builder.tpl.note": "腳註",
+  "tpl-builder.tpl.qa": "問答",
+  "tpl-builder.tpl.v": "視頻",
+  "tpl-builder.tpl.nissaya": "逐詞釋義",
+  "tpl-builder.tpl.exercise": "練習",
+  "tpl-builder.tpl.ai": "AI 提示",
+  "tpl-builder.tpl.category": "分類",
+  "tpl-builder.tpl.quality": "質量",
+  "tpl-builder.tpl.ref": "參考文獻",
+  "tpl-builder.tpl.toc": "目錄",
+  "tpl-builder.tpl.dict-pref": "詞典前綴",
+  "tpl-builder.tpl.mermaid": "圖表",
+  "tpl-builder.tpl.Tpl": "自定義模板",
+
+  "tpl-builder.desc.article":
+    "嵌入一篇文章、文集或一個章節 / 段落。章節可以只給書號 + 段號,不填 id。",
+  "tpl-builder.desc.para": "嵌入一段經文,id 寫成 書號-段號。",
+  "tpl-builder.desc.sent":
+    "嵌入一個句子,id 寫成 書號-段號-起始詞-結束詞;不填 channel 用內容所屬的版本。",
+  "tpl-builder.desc.quote": "引用一段經文,顯示該段所在的章節標題。",
+  "tpl-builder.desc.ql":
+    "引用某個印本的冊頁。給書號 + 段號時按坐標查書名與頁碼;也可以直接寫書名、冊、頁。",
+  "tpl-builder.desc.term":
+    "術語,生成 [[詞]] 簡寫。詞@tag 按 tag 查,詞#文字 用指定文字代替譯名。",
+  "tpl-builder.desc.g": "在系統語法術語表裡查一個語法術語。",
+  "tpl-builder.desc.note": "腳註:正文可換行、可分段、可嵌模板。",
+  "tpl-builder.desc.qa": "嵌入一個問答話題。",
+  "tpl-builder.desc.v": "視頻,地址只允許 http(s) 與站內路徑。",
+  "tpl-builder.desc.nissaya": "緬文逐詞釋義。",
+  "tpl-builder.desc.ai":
+    "標出 AI 生成的內容。block 是引用塊,tag 是行內小標籤。",
+  "tpl-builder.desc.category": "分類標籤。",
+  "tpl-builder.desc.quality": "術語 / 文章的質量標籤。",
+  "tpl-builder.desc.ref": "列出本文引用到的巴利文獻,寫在哪裡都能列全。",
+  "tpl-builder.desc.toc": "從本文的標題自動生成目錄。",
+  "tpl-builder.desc.dict-pref": "詞典前綴列表。",
+  "tpl-builder.desc.mermaid": "mermaid 圖表,生成 ```mermaid 圍欄。",
+  "tpl-builder.desc.Tpl":
+    "以標題為「Tpl:名字」的文章為模板,參數按位置(1、2…)或名字代入它的正文。",
+
+  "tpl-builder.field.type": "類型",
+  "tpl-builder.field.id": "id",
+  "tpl-builder.field.book": "書號",
+  "tpl-builder.field.paragraphs": "段號",
+  "tpl-builder.field.para": "段號",
+  "tpl-builder.field.title": "標題",
+  "tpl-builder.field.channel": "版本",
+  "tpl-builder.field.anthology": "文集",
+  "tpl-builder.field.style": "顯示為",
+  "tpl-builder.field.bookname": "書名",
+  "tpl-builder.field.volume": "冊",
+  "tpl-builder.field.page": "頁",
+  "tpl-builder.field.word": "詞",
+  "tpl-builder.field.trigger": "角標文字",
+  "tpl-builder.field.cite": "來源說明",
+  "tpl-builder.field.citelink": "來源坐標",
+  "tpl-builder.field.url": "地址",
+  "tpl-builder.field.pali": "巴利",
+  "tpl-builder.field.meaning": "意思",
+  "tpl-builder.field.message": "說明",
+  "tpl-builder.field.name": "名稱",
+  "tpl-builder.field.value": "質量",
+  "tpl-builder.field.levels": "標題層級",
+  "tpl-builder.field.size": "每頁條數",
+  "tpl-builder.field.params": "參數",
+  "tpl-builder.field.sent.text": "顯示",
+  "tpl-builder.field.note.text": "正文",
+  "tpl-builder.field.mermaid.text": "圖表源碼",
+  "tpl-builder.field.quote.para": "段落",
+  "tpl-builder.field.dict-pref.page": "頁碼",
+  "tpl-builder.field.ql.type": "版本",
+};
+
+export default items;