From b633b6f9c3f83a35a1ab595dfabaecb5847a7b56 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 13 Aug 2022 22:32:36 +0200 Subject: [PATCH] rc restructuredtext: fix code block regex Commit 9ea6b88c1 (Fix remaining kak scripts to use the new highlighter syntax, 2018-07-01) changed the regex that detects HTML code blocks from \.\.\h*code::\h*html\h*\n to \.\.\h*html::\h*c\h*\n the stray c looks wrong. According to https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#showing-code-examples a code block looks like .. code-block:: html Some HTML code. Correct the regex accordingly. The original version used "code" instead of "cod- block". That was incorrect because "code" requires a different syntax (no "..") and creates inline code blocks (for which we could add highlighting later), see https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-code --- rc/filetype/restructuredtext.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/restructuredtext.kak b/rc/filetype/restructuredtext.kak index 434525a5..b1a69806 100644 --- a/rc/filetype/restructuredtext.kak +++ b/rc/filetype/restructuredtext.kak @@ -33,7 +33,7 @@ evaluate-commands %sh{ perl pug python ragel ruby rust sass scala scss sh swift \ tupfile yaml; do if [ "$ft" = kak ]; then ref="kakrc"; else ref="$ft"; fi - printf 'add-highlighter shared/restructuredtext/%s region %s %s ref %s\n' "$ft" '\.\.\h*'$ft'::\h*c\h*\n' '^(?=\S)' "$ref" + printf 'add-highlighter shared/restructuredtext/%s region %s %s ref %s\n' "$ft" "\.\.\h*code-block::\h*$ft\h*\n" '^(?=\S)' "$ref" done }