Parent: neorg.
#tangle todos.nu
def todos [path: path = ./.] {
rg '\(.\)' --json $path
| lines
| each {|| from json}
| filter {|e| $e.type == 'match'}
| each {||
get data
| reject absolute_offset
| update lines {||
get text
| str replace --regex '^.*\(.\)\s+' ""
}
| update submatches {|| get 0.match.text}
| update path {|| get text}
}
| rename file text line status
| move text --after status
}
foo:} and {:bar
.#tangle graph.nu
def graph [where: path = .] {
rg '\{./[a-z\-]*.html}[[a-z\-]*]' --json
| lines
| each {|| from json}
| filter {|e| $e.type == 'match' }
| each {||
get data
| update path {|| get text}
| reject lines line_number absolute_offset
| update submatches {||
get 0.match.text
| str replace -r '\{./(.*).html}[(.*)]' '$1'
}
}
| rename from to
| update from {|| str replace '.norg' '' }
| reduce --fold '' {|it, acc| $acc + $'"($it.from)" -> "($it.to)"' + "\n"}
| $"digraph G {\n($in)}"
| dot -Tpng
| feh -
}