Logs for my internship @ LAAS-CNRS
1function cite-web
2 set id $argv[1]
3 set url $argv[2]
4
5 # horrible mdr
6 set full_url (https -F --print h --debug $url 2>&1 | rg "^\\s*'url': '(.*$url.*)'}\\)" | sd "^\\s*'url': '(.+)'}\\)" '$1')
7
8 set title (https -F $url | htmlq --text 'head title')
9
10 echo "Adding $title"
11
12 set citation '{ $id: {
13 type: "web",
14 title: $title,
15 url: { date: $today, value: $url },
16 } }'
17
18
19 echo '{}' | yq -Y "$citation" \
20 --arg today (date --iso-8601) \
21 --arg id $id \
22 --arg title "$title" \
23 --arg url "$full_url" \
24 >> bib.yaml
25
26 # Add a blank line
27 echo >> bib.yaml
28end