Revert "fix(compiler): xmb `<ph>` tags should not self close (#13413)"
This reverts commit 4b3d135193
.
closes #13463
This commit is contained in:
parent
8c27c62fab
commit
f238c8ac7a
|
@ -119,11 +119,11 @@ class _Visitor implements i18n.Visitor {
|
|||
}
|
||||
|
||||
visitPlaceholder(ph: i18n.Placeholder, context?: any): xml.Node[] {
|
||||
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name}, [], false)];
|
||||
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name})];
|
||||
}
|
||||
|
||||
visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): xml.Node[] {
|
||||
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name}, [], false)];
|
||||
return [new xml.Tag(_PLACEHOLDER_TAG, {name: ph.name})];
|
||||
}
|
||||
|
||||
serialize(nodes: i18n.Node[]): xml.Node[] {
|
||||
|
|
|
@ -18,8 +18,7 @@ class _Visitor implements IVisitor {
|
|||
const strAttrs = this._serializeAttributes(tag.attrs);
|
||||
|
||||
if (tag.children.length == 0) {
|
||||
return tag.canSelfClose ? `<${tag.name}${strAttrs}/>` :
|
||||
`<${tag.name}${strAttrs}></${tag.name}>`;
|
||||
return `<${tag.name}${strAttrs}/>`;
|
||||
}
|
||||
|
||||
const strChildren = tag.children.map(node => node.visit(this));
|
||||
|
@ -72,8 +71,8 @@ export class Tag implements Node {
|
|||
public attrs: {[k: string]: string} = {};
|
||||
|
||||
constructor(
|
||||
public name: string, unescapedAttrs: {[k: string]: string} = {}, public children: Node[] = [],
|
||||
public canSelfClose: boolean = true) {
|
||||
public name: string, unescapedAttrs: {[k: string]: string} = {},
|
||||
public children: Node[] = []) {
|
||||
Object.keys(unescapedAttrs).forEach((k: string) => {
|
||||
this.attrs[k] = _escapeXml(unescapedAttrs[k]);
|
||||
});
|
||||
|
|
|
@ -208,9 +208,9 @@ const XMB = `
|
|||
<ph name="ICU"/>
|
||||
</msg>
|
||||
<msg id="5868084092545682515">{VAR_SELECT, select, m {male} f {female} }</msg>
|
||||
<msg id="4851788426695310455"><ph name="INTERPOLATION"></ph></msg>
|
||||
<msg id="9013357158046221374">sex = <ph name="INTERPOLATION"></ph>></msg>
|
||||
<msg id="8324617391167353662"><ph name="CUSTOM_NAME"></ph></msg>
|
||||
<msg id="4851788426695310455"><ph name="INTERPOLATION"/></msg>
|
||||
<msg id="9013357158046221374">sex = <ph name="INTERPOLATION"/></msg>
|
||||
<msg id="8324617391167353662"><ph name="CUSTOM_NAME"/></msg>
|
||||
<msg id="7685649297917455806">in a translatable section</msg>
|
||||
<msg id="2387287228265107305">
|
||||
<ph name="START_HEADING_LEVEL1"><ex><h1></ex></ph>Markers in html comments<ph name="CLOSE_HEADING_LEVEL1"><ex></h1></ex></ph>
|
||||
|
|
|
@ -46,7 +46,7 @@ export function main(): void {
|
|||
<!ELEMENT ex (#PCDATA)>
|
||||
]>
|
||||
<messagebundle>
|
||||
<msg id="7056919470098446707">translatable element <ph name="START_BOLD_TEXT"><ex><b></ex></ph>with placeholders<ph name="CLOSE_BOLD_TEXT"><ex></b></ex></ph> <ph name="INTERPOLATION"></ph></msg>
|
||||
<msg id="7056919470098446707">translatable element <ph name="START_BOLD_TEXT"><ex><b></ex></ph>with placeholders<ph name="CLOSE_BOLD_TEXT"><ex></b></ex></ph> <ph name="INTERPOLATION"/></msg>
|
||||
<msg id="2981514368455622387">{VAR_PLURAL, plural, =0 {<ph name="START_PARAGRAPH"><ex><p></ex></ph>test<ph name="CLOSE_PARAGRAPH"><ex></p></ex></ph>} }</msg>
|
||||
<msg id="7999024498831672133" desc="d" meaning="m">foo</msg>
|
||||
<msg id="i" desc="d" meaning="m">foo</msg>
|
||||
|
|
Loading…
Reference in New Issue