diff --git a/modules/ve/ce/nodes/ve.ce.TextNode.js b/modules/ve/ce/nodes/ve.ce.TextNode.js
index 79cf851f32..8889fc6de2 100644
--- a/modules/ve/ce/nodes/ve.ce.TextNode.js
+++ b/modules/ve/ce/nodes/ve.ce.TextNode.js
@@ -57,93 +57,6 @@ ve.ce.TextNode.htmlCharacters = {
'\t': '➞'
};
-/**
- * List of annotation rendering implementations.
- *
- * Each supported annotation renderer must have an open and close property, each either a string or
- * a function which accepts a data argument.
- *
- * @static
- * @member
- */
-ve.ce.TextNode.annotationRenderers = {
- 'textStyle/italic': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/bold': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/underline': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/strike': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/small': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/big': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/span': {
- // TODO recognize attributes
- 'open': '',
- 'close': ''
- },
- 'textStyle/strong': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/emphasize': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/superScript': {
- 'open': '',
- 'close': ''
- },
- 'textStyle/subScript': {
- 'open': '',
- 'close': ''
- },
- 'link/ExtLink': {
- 'open': function ( data ) {
- return '';
- },
- 'close': ''
- },
- 'link/ExtLink/Numbered': {
- 'open': function ( data ) {
- return '';
- },
- 'close': ''
- },
- 'link/ExtLink/URL': {
- 'open': function ( data ) {
- return '';
- },
- 'close': ''
- },
- 'link/WikiLink': {
- 'open': function ( data ) {
- return '';
- },
- 'close': ''
- },
- 'link/unknown': {
- 'open': function () {
- return '';
- },
- 'close': ''
- }
-};
-
/* Methods */
/**
@@ -185,7 +98,6 @@ ve.ce.TextNode.prototype.onUpdate = function ( force ) {
ve.ce.TextNode.prototype.getHtml = function () {
var data = this.model.getDocument().getDataFromNode( this.model ),
htmlChars = ve.ce.TextNode.htmlCharacters,
- renderers = ve.ce.TextNode.annotationRenderers,
out = '',
i,
j,
@@ -241,13 +153,12 @@ ve.ce.TextNode.prototype.getHtml = function () {
function openAnnotations( annotations ) {
var out = '',
- annotation, i, arr;
+ annotation, i, arr, rendered;
arr = annotations.get();
for ( i = 0; i < arr.length; i++ ) {
annotation = arr[i];
- out += typeof renderers[annotation.type].open === 'function' ?
- renderers[annotation.type].open( annotation.data ) :
- renderers[annotation.type].open;
+ rendered = annotation.renderHTML();
+ out += ve.getOpeningHtmlTag( rendered.tag, rendered.attributes );
annotationStack.push( annotation );
}
return out;
@@ -259,9 +170,7 @@ ve.ce.TextNode.prototype.getHtml = function () {
arr = annotations.get();
for ( i = 0; i < arr.length; i++ ) {
annotation = arr[i];
- out += typeof renderers[annotation.type].close === 'function' ?
- renderers[annotation.type].close( annotation.data ) :
- renderers[annotation.type].close;
+ out += '' + annotation.renderHTML().tag + '>';
annotationStack.remove( annotation );
}
return out;