From 3cbb8b8b56cb56f9cca84740baa065cb07997f90 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 9 Feb 2020 10:45:11 +0100 Subject: issue #7570 Comments replaced by block comments inside Markdown code block --- src/commentcnv.l | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index ba2e5ec..5198a98 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -349,6 +349,17 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z yyextra->blockName=&yytext[1]; BEGIN(VerbatimCode); } +("```"[`]*|"~~~"[~]*) { /* start of markdown code block */ + if (!Config_getBool(MARKDOWN_SUPPORT)) + { + REJECT; + } + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->lastCommentContext = YY_START; + yyextra->javaBlock=0; + yyextra->blockName=QCString(yytext).left(3); + BEGIN(VerbatimCode); + } [\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */ copyToOutput(yyscanner,yytext,(int)yyleng); yyextra->lastCommentContext = YY_START; @@ -427,6 +438,13 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z } } } +("```"[`]*|"~~~"[~]*) { /* end of markdown code block */ + copyToOutput(yyscanner,yytext,(int)yyleng); + if (yytext[0]==yyextra->blockName[0]) + { + BEGIN(yyextra->lastCommentContext); + } + } [\\@]("enddot"|"endcode"|"endmsc"|"enduml") { /* end of verbatim block */ copyToOutput(yyscanner,yytext,(int)yyleng); if (&yytext[4]==yyextra->blockName) @@ -526,7 +544,7 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z copyToOutput(yyscanner,yytext,(int)yyleng); } -[^ <\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ +[^ `~<\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ copyToOutput(yyscanner,yytext,(int)yyleng); } "*"+[^*/\\@\n{\"]* { /* stars without slashes */ -- cgit v0.12