💾 Archived View for flexibeast.space › gemlog › 2022-07-02.gmi captured on 2024-06-16 at 12:30:15. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-10)
-=-=-=-=-=-=-
i'm not aware of any widespread convention for designating tags on a gemlog post - if there is one, please let me know! Otherwise, at the risk of creating standard 15[a], here's what i'm going to start using on my own gemlog.
1. A ‘tags line’ is designated with the character ‘🏷’ at the beginning of a line,
2. optionally followed by
3. at least one space and/or tab, and
4. a comma-separated list of values,
5. each value containing any valid UTF-8 character above and including codepoint 0x20,
6 with the exception of a comma (‘,’).
7. The line may contain a trailing comma.
8. The list of tags cannot extend past the end of the line beginning with ‘-<=’.
9. In the presence of more than one tags line in a document, the last line wins.
1. When this post was first published, line 1 referred to “the three characters ‘-<=’”, and this line of commentary originally said “the trigraph ‘-<=’ is intended to look vaguely like a physical tag, and seems reasonably unlikely to be regularly used for another purpose within gemtext.” The line prefix was changed to ‘🏷’ as a result of feedback.
2. Making everything after these three characters optional allows for the possibility of having a ‘placeholder’ tags line.
4. Field splitting on commas is trivial in any serious programming language[b].
6. Allowing a trailing comma is intended to make it easier to generate a conformant tag list.
6. Having the tags line be no more than a single line is intended to facilitate line-oriented parsing.
8. The “last line wins” rule is intended to handle faulty gemtext generators (which in some instances might be a human brain).
The final inner parenthesis group in each example represent a capture group, which can then be split on ‘,’.
^-<=(?:(?: |\t)+([^\n]+))$
Emacs Lisp Reference Manual: ‘35.3.1 Syntax of Regular Expressions’
^-<=\\(?:\\(?: \\|\t\\)+\\([^\n]+\\)\\)$
^-<=(( |\t)+([^\n]+))$
A tags parser must parse the test_tags.txt file as follows:
☙
🏷 gemini
☙
[b] i.e. i'm not particularly concerned about esolangs like Ook! or Piet. :-)