💾 Archived View for gemini.ctrl-c.club › ~philaeni › 2023-08-10.gmi captured on 2024-12-17 at 10:16:28. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

2023-08-10 refer, groff, and dictfmt

Back to poking at dictfmt, since I started building my own personal dictionary I can access through dict, and I don't particularly like any of the formats dictfmt expects.

I had a go at using refer + groff to pipe to dictfmt.

Formatting refer's output is trivial, since you can just override the `.][` macro to access the various `[K`, `[T`, `[X` string registers, *but* it just inserts the annotation text - collected as is from the `%X` lines - straight after that, which troff takes to be a single paragraph.

Fixing *that* is just matter of setting a trap with `.it` so that it breaks and inserts an empty line after each input line, *but* troff behaves in a frustrating way where it comes to multiple runs of spaces, which it inserts as-is.

Fixing *that* is doable by shoving the output into `fmt -u`, made even easier by the fact that those lines will be indented and can thus be targeted via the `-p` option, *but...*

There isn't an easy way I can think of to differentiate between *paragraphs* (which should be followed by an empty line) and simple *line breaks* - /e.g./ in example blocks - and since I already got up to three "but"s, I am probably better off just editing the dictionary source by hand.

A sample refer file

The troff file that builds the dictionary

Back to the log