schema refactor
parent
3767581b18
commit
359c0377d2
1337
db/games.rec
1337
db/games.rec
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
115
justfile
115
justfile
|
@ -5,47 +5,112 @@ default:
|
|||
just -l --unsorted
|
||||
|
||||
# how many games played
|
||||
played:
|
||||
recsel -e "Role = 'Player'" -P Module {{database}}
|
||||
@played:
|
||||
recsel -t Game -e "Role = 'Player'" -P Module -C {{database}}
|
||||
|
||||
# how many games ran
|
||||
ran:
|
||||
recsel -e "Role = 'DM'" -P Module {{database}}
|
||||
@ran:
|
||||
recsel -t Game -e "Role = 'DM'" -P Module -C {{database}}
|
||||
|
||||
# ongoing
|
||||
ongoing:
|
||||
recsel -e 'Status = "Ongoing"' -p System,Module {{database}}
|
||||
@ongoing:
|
||||
recsel -t Game -e 'Status = "Ongoing"' -p System,Module {{database}}
|
||||
|
||||
# show all in year
|
||||
year x:
|
||||
recsel -e 'Updated >> "{{x}}-01-01"' -P "Module,System,Updated" {{database}}
|
||||
|
||||
# export csv
|
||||
csv:
|
||||
rec2csv {{database}}
|
||||
|
||||
# get some json
|
||||
json:
|
||||
rec2csv {{database}} | csvjson | jq
|
||||
recsel -t Game -e 'Updated >> "{{x}}-01-01"' -P "Module,System,Updated" {{database}}
|
||||
|
||||
# create a new entry
|
||||
new:
|
||||
node bin/cli.js
|
||||
|
||||
# featuring descending sort!
|
||||
markdown:
|
||||
recsel -S Updated {{database}} | rec2csv | csvjson | jq 'reverse | map(.Notes |= gsub("\n"; "\n\n"))' | in2csv -f json | csv2rec | recfmt -f templates/markdown.template
|
||||
|
||||
# html out
|
||||
html:
|
||||
just markdown | pandoc -t html --toc -s --metadata title="Games!" --metadata toc-title="Index" -B templates/before.html -A templates/after.html -H templates/header.html -o dist/index.html
|
||||
#!/usr/bin/env sh
|
||||
## BEGIN: TEMPLATES ##
|
||||
gameheadertmpl='<article>
|
||||
<h2 id={{{{Id}}>{{{{Module}} ({{{{System}})</h2>
|
||||
<p>{{{{Module}} is a game of {{{{System}} that I started playing on {{{{Started}} as a {{{{Role}}. It is a {{{{Format}} {{{{Length}} and is currently {{{{Status}}.</p>
|
||||
<p>Here is how it went!</p>
|
||||
'
|
||||
|
||||
updatetmpl='<h3>{{{{Created}}</h3>
|
||||
|
||||
{{{{Text}}
|
||||
'
|
||||
|
||||
gamefootertmpl='<center>🎲🎲</center>
|
||||
</article>'
|
||||
|
||||
toctmpl='<li><a href="#{{{{Id}}">{{{{Module}} ({{{{System}})</a></li>'
|
||||
## END: TEMPLATES ##
|
||||
|
||||
exec > dist/index.html
|
||||
|
||||
## BEGIN: STYLE ##
|
||||
cat<<EOF
|
||||
<link rel="alternate" type="application/rss+xml" href="feed.xml" title="dozens gamelog">
|
||||
<style>
|
||||
body {
|
||||
max-width: 80ch;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h2 {
|
||||
border-bottom: solid 1px black;
|
||||
margin-top: 3rem;
|
||||
}
|
||||
</style>
|
||||
EOF
|
||||
## END: STYLE ##
|
||||
|
||||
## BEGIN: INTRO ##
|
||||
cat<<EOF
|
||||
<h1>Games!</h1>
|
||||
<li>src: <a href='https://git.tilde.town/dozens/gamelog'>https://git.tilde.town/dozens/gamelog</a></li>
|
||||
<li>dozens webring: <a href='https://tilde.town/%7Edozens/webring/dozens/index.html?name=gamelog&dir=prev'>previous</a> <a href='https://tilde.town/%7Edozens/webring/dozens/index.html'>index</a> <a href='https://tilde.town/%7Edozens/webring/dozens/index.html?name=gamelog&dir=next'>next</a></li>
|
||||
<li><a href="feed.xml">rss</a></li>
|
||||
EOF
|
||||
## END: INTRO ##
|
||||
|
||||
## BEGIN: TOC ##
|
||||
echo '<h2>Contents</h2>'
|
||||
recsel {{database}} -t Game | recfmt "$toctmpl"
|
||||
## END: TOC ##
|
||||
|
||||
## BEGIN: BODY ##
|
||||
allgames=(`recsel {{database}} -t Game -P Id -C | tr '\n' ' '`)
|
||||
for idx in "${allgames[@]}"
|
||||
do
|
||||
recsel {{database}} -t Game -e "Id = $idx" | recfmt "$gameheadertmpl"
|
||||
recsel {{database}} -t Update -e "Game = $idx" | recfmt "$updatetmpl" | markdown
|
||||
echo $gamefootertmpl
|
||||
done
|
||||
## END: BODY ##
|
||||
|
||||
# rss feed
|
||||
feed:
|
||||
echo "<rss version=\"2.0\"><channel><title>gamelog</title>" > dist/feed.xml
|
||||
echo "<link>http://tilde.town/~dozens/gamelog/index.html</link><description>all the games i play</description><atom:link rel=\"self\" type=\"application/rss+xml\" href=\"http://tilde.town/~dozens/gamelog/feed.xml\"/>" >> dist/feed.xml
|
||||
recsel {{database}} | recfmt -f templates/feed.template >> dist/feed.xml
|
||||
echo '</channel></rss>' >> dist/feed.xml
|
||||
#!/usr/bin/env sh
|
||||
feedtmpl='<item>
|
||||
<title>{{{{Game_System}} - {{{{Game_Module}}</title>
|
||||
<link>http://tilde.town/~dozens/gamelog/index.html</link>
|
||||
<pubDate>{{{{Created}}</pubDate>
|
||||
<description>
|
||||
<![CDATA[
|
||||
{{{{Text}}
|
||||
]]>
|
||||
</description>
|
||||
</item>
|
||||
'
|
||||
exec > dist/feed.xml
|
||||
cat<<EOF
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>gamelog</title>
|
||||
<link>http://tilde.town/~dozens/gamelog/index.html</link>
|
||||
<description>all the games i play</description>
|
||||
<atom:link rel="self" type="application/rss+xml" href="http://tilde.town/~dozens/gamelog/feed.xml"/>
|
||||
EOF
|
||||
recsel -t Update -j Game {{database}} | recfmt "$feedtmpl"
|
||||
echo '</channel></rss>'
|
||||
sed -i '' 's/&/and/g' dist/feed.xml
|
||||
|
||||
# copy to blog
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# Templates
|
||||
|
||||
this directory holds templates, includes, partials, etc.
|
||||
|
||||
Namely `.template` files for recfmt, and `.html` files for pandoc
|
|
@ -1,4 +0,0 @@
|
|||
<hr />
|
||||
<p>
|
||||
<center>✌️</center>
|
||||
</p>
|
|
@ -1,10 +0,0 @@
|
|||
<p>In 2021 I started keeping track of all the <abbr title="tabletop role playing game">ttrpgs</abbr> I play in a recfile database.</p>
|
||||
|
||||
<p>Learn more at <a href="https://git.tilde.town/dozens/gamelog">https://git.tilde.town/dozens/gamelog</a></p>
|
||||
|
||||
<p>
|
||||
This site is part of the dozensweb webring:
|
||||
<a href="https://tilde.town/%7Edozens/webring/dozens/index.html?name=gamelog&dir=prev">previous</a>
|
||||
<a href="https://tilde.town/%7Edozens/webring/dozens/index.html">index</a>
|
||||
<a href="https://tilde.town/%7Edozens/webring/dozens/index.html?name=gamelog&dir=next">next</a>
|
||||
</p>
|
|
@ -1,10 +0,0 @@
|
|||
<item>
|
||||
<title>{{System}} - {{Module}}</title>
|
||||
<link>http://tilde.town/~dozens/gamelog/index.html</link>
|
||||
<pubDate>{{Updated}}</pubDate>
|
||||
<description>
|
||||
<![CDATA[
|
||||
{{Notes}}
|
||||
]]>
|
||||
</description>
|
||||
</item>
|
|
@ -1,12 +0,0 @@
|
|||
<link rel="alternate" type="application/rss+xml" href="/feed.xml" title="dozens gamelog">
|
||||
<style>
|
||||
body {
|
||||
max-width: 68ch;
|
||||
margin: 0 auto;
|
||||
line-height: 1.2;
|
||||
}
|
||||
h2 {
|
||||
border-bottom: solid 1px black;
|
||||
margin-top: 3rem;
|
||||
}
|
||||
</style>
|
|
@ -1,9 +0,0 @@
|
|||
## {{Module}} ({{System}})
|
||||
|
||||
{{Module}} is a game of {{System}} that I started playing {{Started}} as a {{Role}}. It is a {{Format}} {{Length}} and is currently {{Status}}.
|
||||
|
||||
Here's how it went!
|
||||
|
||||
{{Notes}}
|
||||
|
||||
<p><center>🎲🎲</center></p>
|
|
@ -1,6 +0,0 @@
|
|||
function Meta(m)
|
||||
if m.date == nil then
|
||||
m.date = os.date("%B %e, %Y")
|
||||
return m
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue