summaryrefslogtreecommitdiff
path: root/awk
diff options
context:
space:
mode:
authorLeon Rische <leon.rische@me.com>2020-09-15 23:50:56 +0200
committerLeon Rische <leon.rische@me.com>2020-09-15 23:50:56 +0200
commitbd488b1fdeebb629d60cf7d71f3bff208b39835a (patch)
tree0376900103e4ad55c0e248427b5ceebf8b2d4f1c /awk
parent9ffaaffb4b47599e8d4a612bc6f7bc1a2b5ab30b (diff)
Include file title in card index
Diffstat (limited to 'awk')
-rw-r--r--awk/index.awk12
1 files changed, 11 insertions, 1 deletions
diff --git a/awk/index.awk b/awk/index.awk
index f037bf6..99b0ec7 100644
--- a/awk/index.awk
+++ b/awk/index.awk
@@ -29,6 +29,7 @@ BEGIN {
BEGINFILE {
# Reset filetags
delete parent_tags;
+ file_title = "";
parent_tags[0] = "";
state = state_file;
@@ -43,7 +44,7 @@ ENDFILE {
}
}
-## Filetags
+## File Tags
match($0, /#\+FILETAGS:[ \t]+(.*)/, a) {
# Combine tags to handle multiple FILETAGS lines
@@ -51,6 +52,14 @@ match($0, /#\+FILETAGS:[ \t]+(.*)/, a) {
next;
}
+## File Title
+
+match($0, /#\+TITLE:[ \t]+(.*)/, a) {
+ # Combine tags to handle multiple FILETAGS lines
+ file_title = a[1]
+ next;
+}
+
## Heading Parsing
match($0, /^(\*+)[ \t]+(.*)$/, a) {
@@ -106,6 +115,7 @@ $0 ~ review_data_drawer {
if (file_needs_opening) {
print " (" \
":path " escape_string(FILENAME) \
+ " :title " (file_title ? escape_string(file_title) : "nil") \
" :cards (";
file_needs_opening = 0;
file_needs_closing = 1;