From: NeilBrown Date: Sun, 5 May 2019 03:18:46 +0000 (+1000) Subject: mdcode: indent must start with a TAB X-Git-Tag: JamisonCreek-3~24 X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=5190fd3edaacdf904e88837a41cbe4e213910a16 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 --- 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++;