Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/71269
Change subject: Also annotate empty annotations
......................................................................
Also annotate empty annotations
The converter wasn't setting .annotations on meta items created to
represent empty annotations, which meant that HTML like
<i>Foo<b></b></i> would end up as <i>Foo</i><b></b> in the linmod.
Change-Id: I13d7d9820beeee1e8c3673e08051361d6c6ac4cd
---
M modules/ve/dm/ve.dm.Converter.js
M modules/ve/test/dm/ve.dm.example.js
2 files changed, 24 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/69/71269/1
diff --git a/modules/ve/dm/ve.dm.Converter.js b/modules/ve/dm/ve.dm.Converter.js
index 47ed400..8f24d4d 100644
--- a/modules/ve/dm/ve.dm.Converter.js
+++ b/modules/ve/dm/ve.dm.Converter.js
@@ -600,6 +600,10 @@
// Empty annotation, create a
meta item
childDataElements =
this.createDataElements( ve.dm.AlienMetaItem, childDomElements );
childDataElements.push( {
'type': '/' + childDataElements[0].type } );
+ // Annotate meta item
+ if (
!context.annotations.isEmpty() ) {
+
childDataElements[0].annotations = context.annotations.getIndexes().slice();
+ }
}
data = data.concat( childDataElements );
// Clear wrapped whitespace
diff --git a/modules/ve/test/dm/ve.dm.example.js
b/modules/ve/test/dm/ve.dm.example.js
index 3525253..f2e7823 100644
--- a/modules/ve/test/dm/ve.dm.example.js
+++ b/modules/ve/test/dm/ve.dm.example.js
@@ -1307,6 +1307,26 @@
{ 'type': '/internalList' }
]
},
+ 'empty annotation inside nonempty annotation': {
+ 'html': '<body><p><i>Foo<b></b></i></p></body>',
+ 'data': [
+ { 'type': 'paragraph' },
+ [ 'F', [ ve.dm.example.italic ] ],
+ [ 'o', [ ve.dm.example.italic ] ],
+ [ 'o', [ ve.dm.example.italic ] ],
+ {
+ 'type': 'alienMeta',
+ 'attributes': {
+ 'domElements': $( '<b></b>' ).toArray()
+ },
+ 'annotations': [ ve.dm.example.italic ]
+ },
+ { 'type': '/alienMeta' },
+ { 'type': '/paragraph' },
+ { 'type': 'internalList' },
+ { 'type': '/internalList' }
+ ]
+ },
'empty annotation with comment': {
'html': '<body><p>Foo<b><!-- Bar --></b>Baz</p></body>',
'data': [
--
To view, visit https://gerrit.wikimedia.org/r/71269
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I13d7d9820beeee1e8c3673e08051361d6c6ac4cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits