From 581b6097c7b86c16573ab55b70bb1a6a00c3be35 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 28 Jul 2022 05:55:10 +0400 Subject: [PATCH] Clean Results. Remove TOC, Heading Number and Property Drawers --- src/interface/web/org.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/interface/web/org.js b/src/interface/web/org.js index 4e66cf6f..f43c956f 100644 --- a/src/interface/web/org.js +++ b/src/interface/web/org.js @@ -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; } }; },