From 766c9bad627e43ea337ad2dc6a9873794e7dda54 Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Wed, 25 Jun 2025 21:10:23 -0700 Subject: [PATCH] Use '_' instead of '.' for numbering cosmo escapes because it gets syntax highlighted weird because '.' is not valid for like a variable name so the syntax highlighter is splitting the escape phrase at the '.' which means that phrase won't match when unescaped so it fails to get unescaped for example, this would fail: ``` $$ct ``` --- posts/2025-06-22-test-nginx-conf-directives.md | 3 +++ renderers/markdown.moon | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/posts/2025-06-22-test-nginx-conf-directives.md b/posts/2025-06-22-test-nginx-conf-directives.md index 940dab4..b7ea346 100644 --- a/posts/2025-06-22-test-nginx-conf-directives.md +++ b/posts/2025-06-22-test-nginx-conf-directives.md @@ -398,11 +398,14 @@ Edit Makefile: --add-host=git.domain.abc=$(loopback) \ +Rebuild image: ```console $ make image-rm image-build ``` +Run tests: + ```console $ make test ●●●● diff --git a/renderers/markdown.moon b/renderers/markdown.moon index 93cc393..131ddad 100644 --- a/renderers/markdown.moon +++ b/renderers/markdown.moon @@ -48,7 +48,7 @@ escape_cosmo = (str) -> cosmo = parse_cosmo! / (tpl) -> counter += 1 - key = "#{dollar_temp}.#{counter}" + key = "#{dollar_temp}_#{counter}" escapes[key] = tpl key @@ -59,7 +59,7 @@ escape_cosmo = (str) -> unescape_cosmo = (str, escapes) -> import P, R, Cmt, Cs from require "lpeg" - escape_patt = P(dollar_temp) * P(".") * R("09")^1 / (key) -> + escape_patt = P(dollar_temp) * P("_") * R("09")^1 / (key) -> escapes[key] or error "bad key for unescape_cosmo" patt = Cs (escape_patt + P(1))^0 * P(-1) @@ -84,8 +84,6 @@ write_exec = (cmd, content) -> fname --- config command like this in site.moon: --- require("renderers.markdown").cmd = "pandoc --mathjax >" class PandocRenderer extends require "sitegen.renderers.html" @escape_cosmo: escape_cosmo @unescape_cosmo: unescape_cosmo