add botany page

This commit is contained in:
Jake 2022-01-21 11:57:58 +00:00
parent 6a66e5ea9b
commit b20600c37c
2 changed files with 40 additions and 0 deletions

13
_data/botany.js Normal file
View File

@ -0,0 +1,13 @@
const { promisify } = require('util');
const exec = promisify(require('child_process').exec);
const fs = require('fs').promises;
module.exports = async (data) => {
const plantData = JSON.parse((await fs.readFile("/home/jakew/.botany/jakew_plant_data.json")).toString());
const plantArt = (await exec("/usr/bin/python3 /home/jakew/botany/botany-view.py")).stdout;
return {
...plantData,
art: plantArt
}
}

27
botany.njk Normal file
View File

@ -0,0 +1,27 @@
---
title: botany
layout: main
eleventyNavigation:
key: Botany
---
<div style="display: flex; gap: 1em;">
<div style="flex: 0 0 50%">
<pre>{{ botany.art }}</pre>
</div>
<div style="flex: 1">
<h3>{{ botany.description }}</h3>
<ul>
<li><b>age:</b> {{ botany.age }}</li>
<li><b>score:</b> {{ botany.score }}</li>
<li><b>stage:</b> {{ botany.stage }}</li>
<li><b>gen:</b> {{ botany.generation }}</li>
</ul>
</div>
</div>
<hr>
<p>when you are logged into south london, run <code>python3 ~jakew/botany/botany.py</code> to get started!</p>