1
0
Fork
You've already forked GeminiReCite
0
Bash script for automatic citations' numbering of Gemtext files, especially useful when adding new citations in-between others.
  • Shell 100%
2023年07月21日 16:15:54 +02:00
COPYING Add main files 2023年07月16日 23:36:27 +02:00
geminiReCite.sh Uuuh... Ok. A negated set automatically focus characters, no need to escape them. 2023年07月21日 16:15:54 +02:00
README.md First (real) commit 2023年07月16日 23:35:40 +02:00

GeminiReCite — Automate citations' numbering of GemText files in a footnote-style

Bash script for automatic citations' numbering of Gemtext files, especially useful when adding new citations in-between others.

GemText format

The GemText specification states that any link must be on its own line, starting with the => sequence.

By design, that is easily matched, and parsed through the ^=> regexp.

Other than that, there's no official format for citations.

Footnote-style

Considering the diversity of content to be linked, the more elegant way to cite anything is IMHO the numbered footnote-style. That is, a bracketed inline number, matched with a link in the end-bibliography section such as:

The GemText specification[1] states than any link must be on its own line, starting with the `=>` sequence.
=> gemini://gemini.circumlunar.space/docs/gemtext.gmi [1] A quick introduction to "gemtext" markup

Usecase

The main usecase for this script is for those reviewing their writings, and inserting new citations inside the text. Doing so would require one to renumber each following citation which, in my case, is a pain to do manually.

This script automatically renumber the bracketed references in a file, both in the text and the bibliography section. It specifically matches my own way of formatting Gemini files, and assumes:

  • Each link to be referenced in the text once. No less, and no more.
  • The bibliography to be separated from the main text.
  • The links in the bibliography to be ordered as they appears in the text.

Only the first condition is checked, at launch, the second one could be implemented further down the way if requested, while the last one seems like an impossible task.

Dependencies

Each step of the script is commented and quite simple, but feel free to request for clarifications. The whole script is built upon:

  • sed for modifications.
  • cat and grep for accessory checks.