mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Clean Results. Remove TOC, Heading Number and Property Drawers
This commit is contained in:
parent
965a93a2f2
commit
581b6097c7
1 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue