Clean Results. Remove TOC, Heading Number and Property Drawers

This commit is contained in:
Debanjum Singh Solanky 2022-07-28 05:55:10 +04:00
parent 965a93a2f2
commit 581b6097c7

View file

@ -52,6 +52,8 @@ var Org = (function () {
Syntax.define("comment", /^(\s*)#(.*)$/);
Syntax.define("line", /^(\s*)(.*)$/);
const propertyDrawer = /:PROPERTIES:(.*):END:/g;
// ------------------------------------------------------------
// Token
// ------------------------------------------------------------
@ -1282,7 +1284,9 @@ var Org = (function () {
var nodeText = this.convertNode(node, recordHeader, insideCodeElement);
nodesTexts.push(nodeText);
}
return this.combineNodesTexts(nodesTexts);
// Return entries without their property drawers
return this.combineNodesTexts(nodesTexts).replace(propertyDrawer, '');
},
convertHeaderBlock: function (headerBlock, recordHeader) {
@ -1416,7 +1420,7 @@ var Org = (function () {
convert: function () {
var title = this.orgDocument.title ? this.convertNode(this.orgDocument.title) : this.untitled;
var titleHTML = this.tag("h" + Math.max(Number(this.headerOffset), 1), title);
var contentHTML = this.convertNodes(this.orgDocument.nodes, true /* record headers */);
var contentHTML = this.convertNodes(this.orgDocument.nodes, false /* record headers */);
var toc = this.computeToc(this.documentOptions["toc"]);
var tocHTML = this.tocToHTML(toc);
@ -1427,7 +1431,7 @@ var Org = (function () {
tocHTML: tocHTML,
toc: toc,
toString: function () {
return titleHTML + tocHTML + "\n" + contentHTML;
return titleHTML + "\n" + contentHTML;
}
};
},