新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
30 lines
697 B
JavaScript
30 lines
697 B
JavaScript
'use strict';
|
|
|
|
const Parser = require('./parser');
|
|
const Serializer = require('./serializer');
|
|
|
|
// Shorthands
|
|
exports.parse = function parse(html, options) {
|
|
const parser = new Parser(options);
|
|
|
|
return parser.parse(html);
|
|
};
|
|
|
|
exports.parseFragment = function parseFragment(fragmentContext, html, options) {
|
|
if (typeof fragmentContext === 'string') {
|
|
options = html;
|
|
html = fragmentContext;
|
|
fragmentContext = null;
|
|
}
|
|
|
|
const parser = new Parser(options);
|
|
|
|
return parser.parseFragment(html, fragmentContext);
|
|
};
|
|
|
|
exports.serialize = function(node, options) {
|
|
const serializer = new Serializer(node, options);
|
|
|
|
return serializer.serialize();
|
|
};
|