diff options
| author | Nicholas Johnson <> | 2026-09-18 00:00:00 +0000 |
|---|---|---|
| committer | Nicholas Johnson <> | 2026-09-18 00:00:00 +0000 |
| commit | 7a51b9a97b2d618e6b006f1a3b6a0ebd4acd51888af95e670662cf5655fffb3a (patch) | |
| tree | 15ceb7dcaba9eee32a6374c22d329361ac9497088089c7b636c0c22351c8911f | |
| parent | f7010449afad2fea6da148330d201529ccc2d65ce50e31083d605c5733c4afa2 (diff) | |
| download | hugo-theme-journal-7a51b9a97b2d618e6b006f1a3b6a0ebd4acd51888af95e670662cf5655fffb3a.tar.gz hugo-theme-journal-7a51b9a97b2d618e6b006f1a3b6a0ebd4acd51888af95e670662cf5655fffb3a.zip | |
Fix preformatted text opening an entry being treated as prose
The chunking regex required at least one character before a preformatted
block, so a block starting on the first line of an entry could never
match the preformatted branch and fell through to the prose branch. Its
contents were then run through the prose substitutions: asterisks were
stripped, ordered list items were rewritten as unordered ones and links
were turned into references, inside text that must be reproduced
verbatim.
Allow the leading segment to be empty. Blocks elsewhere in an entry,
multiple blocks and reference numbering are unaffected.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| -rw-r--r-- | layouts/single.gmi | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/layouts/single.gmi b/layouts/single.gmi index 2cf53a4..29df881 100644 --- a/layouts/single.gmi +++ b/layouts/single.gmi @@ -21,7 +21,7 @@ {{/* split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */ -}} {{/* the regex matching below the preformatted text matches exactly once in the entire text */ -}} -{{ $chunks := findRESubmatch `(?sm)(?:(.+?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content -}} +{{ $chunks := findRESubmatch `(?sm)(?:(.*?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content -}} {{ $ref_index := 0 -}} |
