#!/usr/bin/awk -f # # gmi2html2 - convert a Gemini file to an HTML body # # SPDX-FileCopyrightText: 2023 Daniel Kalak # SPDX-License-Identifier: GPL-3.0-or-later { prev = this; } { if (prev == "pre-on" || prev == "pre") this = "pre"; } { if (this != "pre") this = "text" ; } /^```/ { if (this != "pre") this = "pre-on" ; else this = "pre-off"; } /^#/ { if (this != "pre") this = "h1" ; } /^##/ { if (this != "pre") this = "h2" ; } /^###/ { if (this != "pre") this = "h3" ; } /^\* / { if (this != "pre") this = "list" ; } /^>/ { if (this != "pre") this = "quote" ; } function closeln() { if (prev == "text") printf(""); if (prev == "pre-off") printf(""); if (prev == "list") printf(""); if (prev == "quote") printf(""); } prev != this { closeln(); } prev { printf("\n"); } END { closeln(); printf("\n"); } prev != this { if (this == "text") printf("
");
	if (this == "pre-on") printf("
");
	if (this == "list")   printf("