From e8029bf415b6b64f7434ddf9e7aecd99d463846a Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 28 Jul 2022 19:50:55 +0400 Subject: [PATCH] Extract and Highlight org-mode tags in HTML render of search results --- src/interface/web/index.html | 7 +++++++ src/interface/web/org.js | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/interface/web/index.html b/src/interface/web/index.html index ea620f42..6c8f7fd7 100644 --- a/src/interface/web/index.html +++ b/src/interface/web/index.html @@ -177,6 +177,13 @@ span.task-status.done { background-color: #06a77d; } + span.task-tag { + color: white; + padding: 3.5px 3.5px 0; + margin-right: 5px; + border-radius: 5px; + background-color: #bbb; + } diff --git a/src/interface/web/org.js b/src/interface/web/org.js index a220a228..4bb5c902 100644 --- a/src/interface/web/org.js +++ b/src/interface/web/org.js @@ -1500,6 +1500,18 @@ var Org = (function () { }) + childText; } + // Parse task tags + taskTagsRegex = /:([\w:]+):/g + taskTagsMatch = childText.match(taskTagsRegex); + taskTags = taskTagsMatch && taskTagsMatch[0].split(":").slice(1,-1); + childText = childText.replace(taskTagsRegex, ""); + + if (taskTags) { + taskTags.forEach(tag => { + childText += this.inlineTag("span", tag, { "class": "task-tag" }) + }); + } + if (sectionNumberText) { childText = this.inlineTag("span", sectionNumberText, { "class": "section-number"