about summary refs log tree commit diff
path: root/web/todolist
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-04-01T14·19+0200
committertazjin <mail@tazj.in>2021-04-01T16·53+0000
commite096146937e895934e788198e75f20ef7e9c52e7 (patch)
treeed26c6c880362e2841624fba6106fa4bf2ca9855 /web/todolist
parent19b3cfb9b633667db4a12360c8ac178db8fc5561 (diff)
feat(web/todolist): Drop 'TODO' prefixes in individual items r/2388
This modifies the capture regex executed by `jq` to capture the TODO
text itself as a separate capture group, which is then used for the
content of the TODO listing.

The web listing looks much cleaner this way.

Change-Id: I00a14da57b315a353f700c112ba33f38e16f1f85
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2749
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'web/todolist')
-rw-r--r--web/todolist/extract-todos.jq15
1 files changed, 10 insertions, 5 deletions
diff --git a/web/todolist/extract-todos.jq b/web/todolist/extract-todos.jq
index cda717fceb70..d4e0476c403a 100644
--- a/web/todolist/extract-todos.jq
+++ b/web/todolist/extract-todos.jq
@@ -3,15 +3,20 @@
 #
 # This assumes that the filter used is something like 'TODO\(\w+\):'
 
+# Capture the username and todo entry from an input string.
+def capture_todo:
+  capture("TODO\\((?<user>\\w+)\\):\\s+(?<todo>.*)$");
+
 # Construct a structure with only the fields we need to populate the
 # page.
 def simplify_match:
-  .data.submatches[0].match.text as $todo
+  .data as $data
+  | (.data.submatches[0].match.text | capture_todo) as $capture
   | {
-     file: (.data.path.text | sub("/nix/store/.+-depot/"; "")),
-     line: .data.line_number,
-     todo: $todo,
-     user: ($todo | capture("TODO\\((?<user>\\w+)\\)") | .user),
+     file: ($data | .path.text | sub("/nix/store/.+-depot/"; "")),
+     line: ($data | .line_number),
+     todo: ($capture | .todo),
+     user: ($capture | .user),
      };
 
 # Group all matches first by the user and return them in sorted order