define(['libs/jquery-1.9.1.min'], function($) {\r
\r
+ 'use strict';\r
+\r
var transformations = {};\r
\r
transformations.fromXML = {\r
}\r
\r
transformations.toXML = {\r
- getXML: function(documentDescription) {\r
+ getXML: function(body) {\r
\r
- var inner = $(documentDescription.HTMLTree);\r
+ var inner = $(body);\r
var toret = $('<div></div>');\r
toret.append(inner);\r
\r
toret.append(div.contents());\r
return toret;\r
});\r
- \r
- var meta = $('<metadata></metadata>\n');\r
- _.each(_.keys(documentDescription.metadata), function(key) {\r
- meta.append('\n\t<dc:'+key+'>' + documentDescription.metadata[key] + '</dc:'+key+'>');\r
- });\r
- meta.append('\n');\r
- \r
- var metadata = toret.find('metadata');\r
- if(metadata.length === 0) {\r
- var section = toret.find('section');\r
- section = section.length ? $(section[0]) : null;\r
- if(section) {\r
- section.prepend(meta)\r
- }\r
- } else {\r
- metadata.replaceWith(meta);\r
- }\r
- \r
- \r
+\r
return vkbeautify.xml(toret.html());\r
}\r
}\r