summaryrefslogtreecommitdiff
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
parent9ffaaffb4b47599e8d4a612bc6f7bc1a2b5ab30b (diff)
Include file title in card index
-rw-r--r--awk/index.awk12
-rw-r--r--org-fc-awk.el3
2 files changed, 13 insertions, 2 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;
diff --git a/org-fc-awk.el b/org-fc-awk.el
index 07c64cb..70dcae6 100644
--- a/org-fc-awk.el
+++ b/org-fc-awk.el
@@ -83,7 +83,8 @@ ITAGS and LTAGS are strings `\":tag1:tag2:\"'"
(lambda (file)
(mapcar
(lambda (card)
- (plist-put card :path (plist-get file :path)))
+ (plist-put card :path (plist-get file :path))
+ (plist-put card :filetitle (plist-get file :title)))
(plist-get file :cards)))
index))