From d200aa75a5c0199e92fc75c9ed2183fac8d52221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Gen=C4=8Dur?= Date: Sun, 5 Feb 2023 14:29:06 +0100 Subject: [PATCH 1/4] allow backslash escapes in fence code infostrings --- markdown.dtx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markdown.dtx b/markdown.dtx index ad3d22da8..9584b5b28 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -24424,11 +24424,11 @@ M.extensions.fenced_code = function(blank_before_code_fence, end local tilde_infostring - = C((parsers.linechar + = Cs((parsers.backslash / "" * parsers.escapable + parsers.linechar - (parsers.spacechar^1 * parsers.newline))^0) local backtick_infostring - = C((parsers.linechar + = Cs((parsers.backslash / "" * (parsers.escapable - parsers.backtick) + parsers.linechar - (parsers.backtick + parsers.spacechar^1 * parsers.newline))^0) From 85189e64cea1b63f16b69dfebabe547d94a33364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Gen=C4=8Dur?= Date: Thu, 2 Mar 2023 18:33:10 +0100 Subject: [PATCH 2/4] formatting --- markdown.dtx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/markdown.dtx b/markdown.dtx index 9584b5b28..78d58cc81 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -24424,11 +24424,13 @@ M.extensions.fenced_code = function(blank_before_code_fence, end local tilde_infostring - = Cs((parsers.backslash / "" * parsers.escapable + parsers.linechar + = Cs(( parsers.backslash / "" * parsers.escapable + + parsers.linechar - (parsers.spacechar^1 * parsers.newline))^0) local backtick_infostring - = Cs((parsers.backslash / "" * (parsers.escapable - parsers.backtick) + parsers.linechar + = Cs(( parsers.backslash / "" * (parsers.escapable - parsers.backtick) + + parsers.linechar - (parsers.backtick + parsers.spacechar^1 * parsers.newline))^0) From 49b45c965fbe77890226ca9bf3a8a9a31fd597a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Gen=C4=8Dur?= Date: Tue, 14 Mar 2023 11:49:13 +0100 Subject: [PATCH 3/4] replace patterns --- markdown.dtx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/markdown.dtx b/markdown.dtx index 78d58cc81..d98093166 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -24424,15 +24424,15 @@ M.extensions.fenced_code = function(blank_before_code_fence, end local tilde_infostring - = Cs(( parsers.backslash / "" * parsers.escapable - + parsers.linechar - - (parsers.spacechar^1 * parsers.newline))^0) + = Cs(( parsers.anyescaped + - parsers.newline + - (parsers.spacechar^1 * parsers.newline))^0) local backtick_infostring - = Cs(( parsers.backslash / "" * (parsers.escapable - parsers.backtick) - + parsers.linechar - - (parsers.backtick - + parsers.spacechar^1 * parsers.newline))^0) + = Cs(((-#(parsers.backslash * parsers.backtick) * parsers.anyescaped) + - parsers.newline + - (parsers.backtick + + parsers.spacechar^1 * parsers.newline))^0) local fenceindent local fencehead = function(char, infostring) From e98bf58579dd41878a8af400467f70f9262e568e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Gen=C4=8Dur?= Date: Tue, 28 Mar 2023 21:42:37 +0200 Subject: [PATCH 4/4] allow and strip leading and trailing whitespaces in infostrings --- markdown.dtx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/markdown.dtx b/markdown.dtx index d98093166..6767fc92b 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -24423,16 +24423,18 @@ M.extensions.fenced_code = function(blank_before_code_fence, return #a >= #b and i end - local tilde_infostring - = Cs(( parsers.anyescaped - - parsers.newline - - (parsers.spacechar^1 * parsers.newline))^0) - - local backtick_infostring - = Cs(((-#(parsers.backslash * parsers.backtick) * parsers.anyescaped) - - parsers.newline - - (parsers.backtick - + parsers.spacechar^1 * parsers.newline))^0) + local function strip_enclosing_whitespaces(str) + return str:gsub("^%s*(.-)%s*$", "%1") + end + + local tilde_infostring = Cs(( parsers.anyescaped + - parsers.newline)^0 + / strip_enclosing_whitespaces) + + local backtick_infostring = Cs(((-#(parsers.backslash * parsers.backtick) * parsers.anyescaped) + - parsers.newline + - parsers.backtick)^0 + / strip_enclosing_whitespaces) local fenceindent local fencehead = function(char, infostring)