fix(接口定义): 修复xml 格式化没有数据时出现换行问题
This commit is contained in:
parent
0ae630c5f4
commit
cab191ae2a
|
@ -93,7 +93,7 @@ export function formatXml(text) {
|
|||
//去掉多余的空格
|
||||
text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
|
||||
return name + ' ' + props.replace(/\s+(\w+=)/g, " $1");
|
||||
}).replace(/>\s*?</g, ">\n<");
|
||||
});
|
||||
//把注释编码
|
||||
text = text.replace(/<!--(.+?)-->/g, function ($0, text) {
|
||||
var ret = '<!--' + escape(text) + '-->';
|
||||
|
|
Loading…
Reference in New Issue