~aleteoryx/gloss

3385310a5ddd849eecb507821ae6ce95bb51de9b — Aleteoryx 3 months ago 88cdd4d
make it all presentable
5 files changed, 55 insertions(+), 4 deletions(-)

A COPYING
A README.md
M gloss.py
M testout/a.html
M testsrc/a.gls
A COPYING => COPYING +13 -0
@@ 0,0 1,13 @@
Copyright (C) 2025 by Aleteoryx <alyx@aleteoryx.me>

Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

A README.md => README.md +38 -0
@@ 0,0 1,38 @@
# gloss

a glossary-style wiki program. with a formatting language like markdown but worse.

it is designed to maximize nonlinear browsing.

***

the central gloss.py script translates each .gls file in its input directory to a .html in its output.

.gls files are composed of a names section, a set of blocks, and an optional "see also" section.

the names section consists of the first non-empty non-comment lines in a file.
each line becomes a name for the file.
a file's names are automatically turned into links,
the first time it is referenced in another document.
matching is performed at word boundaries: a file with name "foo" will not be linked from "foobar".
the names section is terminated with a blank line.

blocks can be either paragraph blocks or quote blocks, and they are terminated by blank lines.
a block is a quote block if its first line begins with a '>'.
to begin a paragraph block with '>', escape it with a backslash.

if any line in a block begins with ~, it will become the block's metadata.
only quotes have metadata, for authorship info.
the format is thus: `<source> @@ <time> // <url>`.
if `@@` is omitted, the signature will have no time associated.
if `//` is omitted, the signature will have no URL associated.

within a block, one can write a link of the form `<https://example.com>`, or `<https://example.com|example page>`.
one can also escape `<` and `>` with backslashes.

if a block begins with `***`, the "see also" section is entered.
each subsequent non-empty line should be the slug (filename, minus .gls) of an article.
it will be linked in a "see also" list at the bottom.

if a template.html is present in the source directory, it will be the template for all rendered pages.
run gloss.py with no arguments for more information.

M gloss.py => gloss.py +1 -1
@@ 92,7 92,7 @@ def first_pass(slug, fp):
				block_text = line[1:].strip()
				continue
			
			if line.startswith("\\"):
			if line.startswith("\\>") or line.startswith("\\~") or line.startswith("\\***") or line == "\\":
				line = line[1:]
			block_type = 'para'
			block_text = line

M testout/a.html => testout/a.html +2 -2
@@ 12,13 12,13 @@
	<blockquote cite="https://aleteoryx.me">this is a quote block</blockquote>
	<p>&mdash; <cite><a href="https://aleteoryx.me">aleteoryx</a></cite>, 2025</p>
</div>
<p><a href="http://example.com">example page</a></p>
<p>\&lt;http://example.com|example page&gt;</p>
<hr>
<h3>See Also:</h3>
<ul>
	<li><a href="b.html">The Letter B</a></li>
</li>
</main>
<footer>File last modified Fri, 2025-15-51 00:51:02 </footer>
<footer>File last modified Fri, 2025-15-51 00:51:39 </footer>
</body>
</html>

M testsrc/a.gls => testsrc/a.gls +1 -1
@@ 9,7 9,7 @@ the same in the browser.
> this is a quote block
~aleteoryx @@ 2025 // https://aleteoryx.me

<http://example.com|example page>
\<http://example.com|example page>

***
b