💾 Archived View for darknesscode.xyz › notes › gemini-capsule.gmi captured on 2024-08-18 at 17:27:27. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-05)
-=-=-=-=-=-=-
By Achim - Sat 15 May 2021
One thing I like of Gemini/Capsule is that is simple and no need to render the file to another format, because is just plain text is easy to work with.
Here is my simple script to work with my capsule, nothing fancy, let's say is simple and is working just fine for what I want to do.
First here is a example of my capsule file structure
├── index.gmi ├── gmi-capsules │ └── index.gmi ├── gmi-crafts │ ├── gemini-and-html.gmi │ ├── gemini-capsule.gmi │ ├── gemini-markup.gmi │ ├── genimi-and-html.gmi │ ├── index.gmi │ ├── microlog-dmenu.gmi │ └── setup-agate-server.gmi ├── images │ ├── dwm-arch-linux.png │ ├── dwm-debian.png │ ├── dwm.png │ ├── dwm-void-linux.png │ ├── gemini-html.png │ ├── i3wm-a.png │ └── xmonad.png ├── linux │ ├── chntpw.gmi │ ├── dmenu.gmi │ ├── dwm.gmi │ ├── git-server.gmi │ ├── index.gmi │ ├── tg-telegram.gmi │ └── xmonad.gmi ├── microlog │ └── index.gmi └── notes ├── bootable-linux-usb-drive.gmi ├── cifs.gmi ├── crontab.gmi ├── datetimectl.gmi ├── epr-epub-reader.gmi ├── index.gmi └── network-manager.gmi
The capsule has six folders in each there is a index.gmi file, that is the index in each section of the capsule that has all the links to each post in that section. Out of all the folders there is a index.gmi this one is the index for the whole capsule.
At the beginning I did everything manually, create the file post then add the link in the index and blablabla... So because I'm lazy, i create a little scrip to do that for me!
Here is the script
#!/bin/sh ### DMENU font="-fn Noto-13" feed="$(printf "%s" | dmenu $font -b -p ' New Post (notes/linux/gmi-crafts) : ')" || exit 1 ### TERMINAL terminal="st" ### GEMINI CAPSULE gmi_path="$HOME/Documents/websites/gemini/" linkName="$(echo $feed | awk -F"/" '{print $2}')" folder="$(echo $feed | awk -F"/" '{print $1}')" postName="$(echo $linkName | sed -e 's/-/ /g' -e 's/\b\(.\)/\u\1/g')" sed -i "15i \=\>\ $linkName.gmi $(date +'%b %d') - $postName" $gmi_path/$folder/index.gmi && touch $gmi_path/$feed.gmi && ### OPEN FILE exec $terminal -e vim $gmi_path/$feed.gmi || notify-send " Huston we have a problem!!! "
I call the script with a keybinding (i use a window manager) and pip it into dmenu
The first part of the script has dmenu stuff and a variable for my terminal of choice
When i want to create a new entry, i have to follow this structure for this to work, it will be like
foldername/name-of-the-new-entry
In my case will be like
gmi-crafs/gemini-capulse
Note the dashes in the files names and folders, the extension of the file will added automatically
Problems with the scrip, ok I don't see them like a real problem, but the scrip will fail is the folder does no exist or if the file exist already
----------
----------
© DarknessCode