Skip to content

indentation of expanded code blocks #2

@shakfu

Description

@shakfu

I just noticed that the worgle does't indent the expanded code block as expected (my sole experience in literate programming is via leo-editor).

For example the following test.org

#+TITLE:Worgle Indentation Test

#+NAME: top
#+BEGIN_SRC c :tangle hello.c
#include <stdio.h>

int main(int argc, char *argv[])
{
    <<say_the_worgle_greeting>>
    return 0;
}
#+END_SRC

#+NAME: say_the_worgle_greeting
#+BEGIN_SRC c
printf("Hello Worleg Borgle!\n");
#+END_SRC

To tangle, run:

#+NAME: generate_and_run
#+BEGIN_SRC sh
./lit README.org
gcc hello.c -o hello
./hello
#+END_SRC

This gets tangled to hello.c as follows

#include <stdio.h>

int main(int argc, char *argv[])
{
printf("Hello Worleg Borgle!\n");
    return 0;
}

instead of what I expected:

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("Hello Worleg Borgle!\n");
    return 0;
}

Of course this is not a big deal for bracketed languages, but with something like python it becomes an issue.
Is this straightforward to fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions