Open computator opened 4 months ago
There's no built-in support for this, though your YAML example makes for a compelling use case.
I suspect that you could kludge together a solution that defines the newline itself as a macro that echoes a certain number of spaces followed by its argument. For this you'd need to define a new mode that allows the newline to be a macro name, and everything that follows it up to the next newline its argument. You'd have to activate this mode before the include macro, and probably turn it off again afterwards. However, I don't have time to experiment to test this suspicion.
Probably exec
would be a simpler solution. (Either that, or I actually implement an include_indented
meta-macro, though I won't have time to do that soon.)
Thanks for the response. I might have to try that out!
I would like to be able to include one file inside another, but have the contents of the included file all indented by a certain amount. For example:
test.inc
test.yaml
Intended result:
I am not sure if this is currently possible with gpp only? If so, I couldn't figure out how. Perhaps there's a way to use the output of include in a macro to then prefix all the lines with a string?
The only solution I could come up with so far is using exec, which I would prefer to avoid if possible.