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