Store references as metadata

This commit is contained in:
David Eisinger
2023-04-04 20:15:46 -04:00
parent 49ca2bd736
commit 39b932a708
6 changed files with 74 additions and 42 deletions

View File

@@ -2,25 +2,18 @@
require "uri" require "uri"
require "digest" require "digest"
require "time"
filename, *urls = ARGV path, *urls = ARGV
unless filename && urls.any? unless path && urls.any?
warn "Please supply a filename and url" warn "Please supply a path and url"
exit 1 exit 1
end end
path = filename.sub(File.basename(filename), "") puts "references:"
content = File.read(filename)
urls.each do |url| urls.each do |url|
link_id = content.scan(/\[(\d+)\]: #{url}/).first.first
unless link_id
warn "Link not found"
exit 1
end
page_content = `curl -s #{url}` page_content = `curl -s #{url}`
text_content = `w3m #{url}` text_content = `w3m #{url}`
@@ -41,12 +34,14 @@ urls.each do |url|
.join .join
.downcase .downcase
link_filename = "#{URI.parse(url).host.gsub(".", "-")}-#{hash}.txt" filename = "#{URI.parse(url).host.gsub(".", "-")}-#{hash}.txt"
File.write("#{path}/#{link_filename}", text_content) File.write("#{path}/#{filename}", text_content)
content.gsub!(/\[#{link_id}\]([^:])/, "[#{link_id}][^#{link_id}-backup]\\1") puts <<~STR
content << "\n[^#{link_id}-backup]: \"<a href=\"#{url}\">#{title}</a>\"; <a href=\"#{link_filename}\">backed up #{Time.now.utc}</a>" - title: "#{title}"
url: #{url}
date: #{Time.now.utc.iso8601}
file: #{filename}
STR
end end
File.write(filename, content)

View File

@@ -314,30 +314,31 @@ Popular Essays
Housekeeping Walking Venice
We're off, tomorrow Notes on a week of walking Venice, an incredibly beautiful city that feels
totally cursed
A Late Night Walk in a Small Southern Town Brandos Room
Can't sleep, move them feet Traveling space, if not time, to say hello to Capote and Brando
The Cafe With a View of the Waterfall Zero milestone
On small cafes along world heritage paths From where everything is measured
A walk around Kii in the New York Times A Few Feet Above the Earth
A photo + text essay about the Peninsula On balance and the inner ear
[ ] [ ]

View File

@@ -5,6 +5,19 @@ draft: false
tags: tags:
- dispatch - dispatch
- ebikes - ebikes
references:
- title: Electric Bike, Stupid Love of My Life — by Craig Mod
url: https://craigmod.com/essays/electric_bikes/
date: 2023-04-04T23:47:24Z
file: craigmod-com-avmku7.txt
- title: Programming is a Pop Culture  Baldur Bjarnason
url: https://www.baldurbjarnason.com/2022/programming-is-a-pop-culture/
date: 2023-04-04T23:47:24Z
file: www-baldurbjarnason-com-7p5031.txt
- title: Julia Cameron Wants You to Do Your Morning Pages - The New York Times
url: https://www.nytimes.com/2019/02/02/style/julia-cameron-the-artists-way.html
date: 2023-04-04T23:47:25Z
file: www-nytimes-com-tq2xdi.txt
--- ---
With the warm winter we've been having in NC, I've gotten to take Nev to and from daycare on the e-bike a whole bunch, which has been just fantastic. I'm wary of becoming too much of an evangelist, but it really does feel like they can replace cars for a lot of folks, and they're fun as hell. With the warm winter we've been having in NC, I've gotten to take Nev to and from daycare on the e-bike a whole bunch, which has been just fantastic. I'm wary of becoming too much of an evangelist, but it really does feel like they can replace cars for a lot of folks, and they're fun as hell.
@@ -24,14 +37,10 @@ Reading:
Links: Links:
* [Electric Bike, Stupid Love of My Life — by Craig Mod][1][^1-backup] * [Electric Bike, Stupid Love of My Life — by Craig Mod][1]
* [Programming is a Pop Culture Baldur Bjarnason][2][^2-backup] * [Programming is a Pop Culture Baldur Bjarnason][2]
* [Julia Cameron Wants You to Do Your Morning Pages - The New York Times][3][^3-backup] * [Julia Cameron Wants You to Do Your Morning Pages - The New York Times][3]
[1]: https://craigmod.com/essays/electric_bikes/ [1]: https://craigmod.com/essays/electric_bikes/
[2]: https://www.baldurbjarnason.com/2022/programming-is-a-pop-culture/ [2]: https://www.baldurbjarnason.com/2022/programming-is-a-pop-culture/
[3]: https://www.nytimes.com/2019/02/02/style/julia-cameron-the-artists-way.html [3]: https://www.nytimes.com/2019/02/02/style/julia-cameron-the-artists-way.html
[^1-backup]: "<a href="https://craigmod.com/essays/electric_bikes/">Electric Bike, Stupid Love of My Life — by Craig Mod</a>"; <a href="craigmod-com-yw1bcq.txt">backed up 2023-04-04 15:54:35 UTC</a>
[^2-backup]: "<a href="https://www.baldurbjarnason.com/2022/programming-is-a-pop-culture/">Programming is a Pop Culture  Baldur Bjarnason</a>"; <a href="www-baldurbjarnason-com-7p5031.txt">backed up 2023-04-04 15:54:36 UTC</a>
[^3-backup]: "<a href="https://www.nytimes.com/2019/02/02/style/julia-cameron-the-artists-way.html">Julia Cameron Wants You to Do Your Morning Pages - The New York Times</a>"; <a href="www-nytimes-com-tq2xdi.txt">backed up 2023-04-04 15:54:36 UTC</a>

View File

@@ -4,9 +4,22 @@ date: 2023-04-03T09:49:46-04:00
draft: false draft: false
tags: tags:
- dispatch - dispatch
references:
- title: The Enduring Point of Pointless Corp | Viget
url: https://www.viget.com/articles/the-enduring-point-of-pointless-corp/
date: 2023-04-04T23:45:46Z
file: www-viget-com-5w5oyj.txt
- title: "How to tell if AI threatens YOUR job: No, really, this post may give you a way to answer that"
url: https://blog.testdouble.com/posts/2023-03-14-how-to-tell-if-ai-threatens-your-job/
date: 2023-04-04T23:45:46Z
file: blog-testdouble-com-rtepba.txt
- title: "This Page is Designed to Last: A Manifesto for Preserving Content on the Web"
url: https://jeffhuang.com/designed_to_last/
date: 2023-04-04T23:45:47Z
file: jeffhuang-com-arq78r.txt
--- ---
March was great -- took a two night/one day work retreat, spent a weekend out in the woods with the family, had my annual trip to Las Vegas, and participated in Viget's [Pointless Week][1][^1-backup]. Also got to spend some quality time with Nevie; she's a great kid and it's amazing to see her personality come out. March was great -- took a two night/one day work retreat, spent a weekend out in the woods with the family, had my annual trip to Las Vegas, and participated in Viget's [Pointless Week][1]. Also got to spend some quality time with Nevie; she's a great kid and it's amazing to see her personality come out.
<!--more--> <!--more-->
@@ -44,14 +57,10 @@ Links:
* [verbose.club][8] -- I got to work on this as part of Pointless Week. Super fun to build, and the game's actually pretty good! * [verbose.club][8] -- I got to work on this as part of Pointless Week. Super fun to build, and the game's actually pretty good!
* [Caddy - The Ultimate Server with Automatic HTTPS][9] -- used this to serve 👆 in a docker compose setup. * [Caddy - The Ultimate Server with Automatic HTTPS][9] -- used this to serve 👆 in a docker compose setup.
* [How to tell if AI threatens YOUR job: No, really, this post may give you a way to answer that][10][^10-backup] * [How to tell if AI threatens YOUR job: No, really, this post may give you a way to answer that][10]
* [This Page is Designed to Last: A Manifesto for Preserving Content on the Web][11][^11-backup] * [This Page is Designed to Last: A Manifesto for Preserving Content on the Web][11]
[8]: https://verbose.club/ [8]: https://verbose.club/
[9]: https://caddyserver.com/ [9]: https://caddyserver.com/
[10]: https://blog.testdouble.com/posts/2023-03-14-how-to-tell-if-ai-threatens-your-job/ [10]: https://blog.testdouble.com/posts/2023-03-14-how-to-tell-if-ai-threatens-your-job/
[11]: https://jeffhuang.com/designed_to_last/ [11]: https://jeffhuang.com/designed_to_last/
[^10-backup]: "<a href="https://blog.testdouble.com/posts/2023-03-14-how-to-tell-if-ai-threatens-your-job/">How to tell if AI threatens YOUR job: No, really, this post may give you a way to answer that</a>"; <a href="blog-testdouble-com-rtepba.txt">backed up 2023-04-04 15:39:36 UTC</a>
[^11-backup]: "<a href="https://jeffhuang.com/designed_to_last/">This Page is Designed to Last: A Manifesto for Preserving Content on the Web</a>"; <a href="jeffhuang-com-arq78r.txt">backed up 2023-04-04 15:39:37 UTC</a>
[^1-backup]: "<a href="https://www.viget.com/articles/the-enduring-point-of-pointless-corp/">The Enduring Point of Pointless Corp | Viget</a>"; <a href="www-viget-com-5w5oyj.txt">backed up 2023-04-04 15:52:27 UTC</a>

View File

@@ -16,8 +16,7 @@
{{ .Date | time.Format "(2006-01-02)" }} {{ .Date | time.Format "(2006-01-02)" }}
</p> </p>
{{ $sup := "<sup.*?>.*?</sup>" }} {{ .Summary }}
{{ replaceRE $sup "" .Summary | safeHTML }}
</li> </li>
{{ end }} {{ end }}
</ul> </ul>

View File

@@ -16,4 +16,23 @@
</h3> </h3>
{{ .Content }} {{ .Content }}
{{ with .Params.References }}
<hr>
<div class="footnotes">
<h3>References</h3>
<ul>
{{ range . }}
<li>
"<a href="{{ .url }}">{{ .title }}</a>";
<a href="{{ .file }}">
backed up {{ .date | time.Format "2006-01-02 15:04:05 MST" }}
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ end }} {{ end }}