You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
456 B
14 lines
456 B
var documents = require("./documents");
|
|
|
|
function convertElementToRawText(element) {
|
|
if (element.type === "text") {
|
|
return element.value;
|
|
} else if (element.type === documents.types.tab) {
|
|
return "\t";
|
|
} else {
|
|
var tail = element.type === "paragraph" ? "\n\n" : "";
|
|
return (element.children || []).map(convertElementToRawText).join("") + tail;
|
|
}
|
|
}
|
|
|
|
exports.convertElementToRawText = convertElementToRawText;
|
|
|