]> ocean-lang.org Git - ocean/commitdiff
mdcode: indent must start with a TAB
authorNeilBrown <neil@brown.name>
Sun, 5 May 2019 03:18:46 +0000 (13:18 +1000)
committerNeilBrown <neil@brown.name>
Sun, 5 May 2019 03:18:46 +0000 (13:18 +1000)
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 <neil@brown.name>
csrc/mdcode.mdc

index 8f53d184b21010c3fe6ab64c08146c129919588d..e1498cea31ab05c22628861fc301c3af7d947bdb 100644 (file)
@@ -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++;