Files
Agent-n8n/web_frontend/food-order-demo/node_modules/prismjs/components/prism-smarty.js
Yep_Q c3eb7125cc feat: 创建食品订单班演示系统基础框架
详细说明:
- 基于文旅订单班框架复制创建food-order-demo项目
- 修改端口配置为4174避免冲突
- 更新LandingPage为青莳轻食主题(绿色健康风格)
- 重新定义7个食品行业专业Agent:
  * 市场研究专家:轻食市场分析、客群画像
  * 营养配方师:营养成分配比、低卡高蛋白设计
  * 供应链管理专家:有机食材供应、溯源体系
  * 品牌策划师:品牌定位、店铺空间布局
  * 财务分析师:投资预算、ROI分析
  * 运营管理专家:运营流程、品控标准
  * 食品创业导师:中央协调、方案整合
- 创建专用启动脚本start.sh
- 验证系统可正常运行在端口4174
- 实现代码复用率90%,符合预期目标

影响文件: web_frontend/food-order-demo/
技术栈: React 18 + TypeScript + Tailwind CSS + Zustand
2025-09-28 10:32:44 +08:00

132 lines
3.0 KiB
JavaScript

(function (Prism) {
Prism.languages.smarty = {
'comment': {
pattern: /^\{\*[\s\S]*?\*\}/,
greedy: true
},
'embedded-php': {
pattern: /^\{php\}[\s\S]*?\{\/php\}/,
greedy: true,
inside: {
'smarty': {
pattern: /^\{php\}|\{\/php\}$/,
inside: null // see below
},
'php': {
pattern: /[\s\S]+/,
alias: 'language-php',
inside: Prism.languages.php
}
}
},
'string': [
{
pattern: /"(?:\\.|[^"\\\r\n])*"/,
greedy: true,
inside: {
'interpolation': {
pattern: /\{[^{}]*\}|`[^`]*`/,
inside: {
'interpolation-punctuation': {
pattern: /^[{`]|[`}]$/,
alias: 'punctuation'
},
'expression': {
pattern: /[\s\S]+/,
inside: null // see below
}
}
},
'variable': /\$\w+/
}
},
{
pattern: /'(?:\\.|[^'\\\r\n])*'/,
greedy: true
},
],
'keyword': {
pattern: /(^\{\/?)[a-z_]\w*\b(?!\()/i,
lookbehind: true,
greedy: true
},
'delimiter': {
pattern: /^\{\/?|\}$/,
greedy: true,
alias: 'punctuation'
},
'number': /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,
'variable': [
/\$(?!\d)\w+/,
/#(?!\d)\w+#/,
{
pattern: /(\.|->|\w\s*=)(?!\d)\w+\b(?!\()/,
lookbehind: true
},
{
pattern: /(\[)(?!\d)\w+(?=\])/,
lookbehind: true
}
],
'function': {
pattern: /(\|\s*)@?[a-z_]\w*|\b[a-z_]\w*(?=\()/i,
lookbehind: true
},
'attr-name': /\b[a-z_]\w*(?=\s*=)/i,
'boolean': /\b(?:false|no|off|on|true|yes)\b/,
'punctuation': /[\[\](){}.,:`]|->/,
'operator': [
/[+\-*\/%]|==?=?|[!<>]=?|&&|\|\|?/,
/\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,
/\b(?:and|eq|gt?e|gt|lt?e|lt|mod|neq?|not|or)\b/
]
};
Prism.languages.smarty['embedded-php'].inside.smarty.inside = Prism.languages.smarty;
Prism.languages.smarty.string[0].inside.interpolation.inside.expression.inside = Prism.languages.smarty;
var string = /"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'/;
var smartyPattern = RegExp(
// comments
/\{\*[\s\S]*?\*\}/.source +
'|' +
// php tags
/\{php\}[\s\S]*?\{\/php\}/.source +
'|' +
// smarty blocks
/\{(?:[^{}"']|<str>|\{(?:[^{}"']|<str>|\{(?:[^{}"']|<str>)*\})*\})*\}/.source
.replace(/<str>/g, function () { return string.source; }),
'g'
);
// Tokenize all inline Smarty expressions
Prism.hooks.add('before-tokenize', function (env) {
var smartyLiteralStart = '{literal}';
var smartyLiteralEnd = '{/literal}';
var smartyLiteralMode = false;
Prism.languages['markup-templating'].buildPlaceholders(env, 'smarty', smartyPattern, function (match) {
// Smarty tags inside {literal} block are ignored
if (match === smartyLiteralEnd) {
smartyLiteralMode = false;
}
if (!smartyLiteralMode) {
if (match === smartyLiteralStart) {
smartyLiteralMode = true;
}
return true;
}
return false;
});
});
// Re-insert the tokens after tokenizing
Prism.hooks.add('after-tokenize', function (env) {
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'smarty');
});
}(Prism));