主要功能: - 修改RequirementModal支持12个订单班选择 - 添加OrderClassIconMap图标映射组件 - Store中添加selectedOrderClass状态管理 - WorkflowPage支持传递orderClass参数 - web_result添加URL参数切换功能 - 创建order-class-handler.js动态处理页面主题 技术改进: - 创建软链接关联订单班数据目录 - 生成wenlu.json和food.json数据结构 - 删除重复的web_result目录 - 添加测试页面test-order-class.html 影响范围: - 展会策划系统现支持12个订单班 - 结果展示页面自动适配不同订单班主题 - 用户可选择不同行业生成对应方案 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
88 lines
3.0 KiB
JavaScript
88 lines
3.0 KiB
JavaScript
'use strict';
|
|
|
|
var identity = require('../nodes/identity.js');
|
|
var stringify = require('./stringify.js');
|
|
var stringifyComment = require('./stringifyComment.js');
|
|
|
|
function stringifyDocument(doc, options) {
|
|
const lines = [];
|
|
let hasDirectives = options.directives === true;
|
|
if (options.directives !== false && doc.directives) {
|
|
const dir = doc.directives.toString(doc);
|
|
if (dir) {
|
|
lines.push(dir);
|
|
hasDirectives = true;
|
|
}
|
|
else if (doc.directives.docStart)
|
|
hasDirectives = true;
|
|
}
|
|
if (hasDirectives)
|
|
lines.push('---');
|
|
const ctx = stringify.createStringifyContext(doc, options);
|
|
const { commentString } = ctx.options;
|
|
if (doc.commentBefore) {
|
|
if (lines.length !== 1)
|
|
lines.unshift('');
|
|
const cs = commentString(doc.commentBefore);
|
|
lines.unshift(stringifyComment.indentComment(cs, ''));
|
|
}
|
|
let chompKeep = false;
|
|
let contentComment = null;
|
|
if (doc.contents) {
|
|
if (identity.isNode(doc.contents)) {
|
|
if (doc.contents.spaceBefore && hasDirectives)
|
|
lines.push('');
|
|
if (doc.contents.commentBefore) {
|
|
const cs = commentString(doc.contents.commentBefore);
|
|
lines.push(stringifyComment.indentComment(cs, ''));
|
|
}
|
|
// top-level block scalars need to be indented if followed by a comment
|
|
ctx.forceBlockIndent = !!doc.comment;
|
|
contentComment = doc.contents.comment;
|
|
}
|
|
const onChompKeep = contentComment ? undefined : () => (chompKeep = true);
|
|
let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);
|
|
if (contentComment)
|
|
body += stringifyComment.lineComment(body, '', commentString(contentComment));
|
|
if ((body[0] === '|' || body[0] === '>') &&
|
|
lines[lines.length - 1] === '---') {
|
|
// Top-level block scalars with a preceding doc marker ought to use the
|
|
// same line for their header.
|
|
lines[lines.length - 1] = `--- ${body}`;
|
|
}
|
|
else
|
|
lines.push(body);
|
|
}
|
|
else {
|
|
lines.push(stringify.stringify(doc.contents, ctx));
|
|
}
|
|
if (doc.directives?.docEnd) {
|
|
if (doc.comment) {
|
|
const cs = commentString(doc.comment);
|
|
if (cs.includes('\n')) {
|
|
lines.push('...');
|
|
lines.push(stringifyComment.indentComment(cs, ''));
|
|
}
|
|
else {
|
|
lines.push(`... ${cs}`);
|
|
}
|
|
}
|
|
else {
|
|
lines.push('...');
|
|
}
|
|
}
|
|
else {
|
|
let dc = doc.comment;
|
|
if (dc && chompKeep)
|
|
dc = dc.replace(/^\n+/, '');
|
|
if (dc) {
|
|
if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')
|
|
lines.push('');
|
|
lines.push(stringifyComment.indentComment(commentString(dc), ''));
|
|
}
|
|
}
|
|
return lines.join('\n') + '\n';
|
|
}
|
|
|
|
exports.stringifyDocument = stringifyDocument;
|