From 5190fd3edaacdf904e88837a41cbe4e213910a16 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sun, 5 May 2019 13:18:46 +1000 Subject: [PATCH] mdcode: indent must start with a TAB For Makefiles, indent must start with a TAB. So insert a TAB if there are 8 or more spaces of indent. Signed-off-by: NeilBrown --- csrc/mdcode.mdc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/csrc/mdcode.mdc b/csrc/mdcode.mdc index 8f53d18..e1498ce 100644 --- a/csrc/mdcode.mdc +++ b/csrc/mdcode.mdc @@ -800,8 +800,8 @@ This could go wrong if the first line of a code block marked by _`` ``` ``_ is indented. To overcome this we would need to record some extra state in each `code_node`. For now we won't bother. -The indents we insert will all be spaces. This might not work well -for `Makefiles`. +The indents we insert will mostly be spaces. All-spaces doesn't work +for `Makefiles`, so if the indent is 8 or more, we use a TAB first. ##### internal functions @@ -818,7 +818,10 @@ for `Makefiles`. fprintf(out, "#line %d \"%s\"\n", node->line_no, fname); while (len && *c) { - fprintf(out, "%*s", node->indent, ""); + if (node->indent >= 8) + fprintf(out, "\t%*s", node->indent - 8, ""); + else + fprintf(out, "%*s", node->indent, ""); if (node->needs_strip) { if (*c == '\t' && len > 1) { c++; -- 2.43.0