srcweave icon indicating copy to clipboard operation
srcweave copied to clipboard

escape --- in code blocks?

Open nikonakoneko opened this issue 3 years ago • 4 comments

I was trying to produce a lit file from a lit file. But I don't find how to escape the code block inside the code block like the following example

# Recursive literate

Consider the following:

--- /example.lit
the following should generate `test.lua` when processing `example.lit`:
--- /test.lua
--- this is a valid lua comment…
print("Hello, Lua!")
---
---

nikonakoneko avatar Aug 12 '22 18:08 nikonakoneko

Thanks for the feedback. I currently don't have an escape, but if you add a space so that the --- isn't exactly at he start of the line, I believe that will work. Does that solve your use case, or should we come up with something better?

justinmeiners avatar Aug 15 '22 00:08 justinmeiners

I imagine escaping comments will be something people want. Perhaps the srcweave syntax would be conducive to using Lua style comment escapes:

# Recursive literate

Consider the following:

---[==[ /example.lit
the following should generate `test.lua` when processing `example.lit`:
---[=[ /test.lua
--- this is a valid lua comment…
print("Hello, Lua!")
---]=]
---]==]

atweiden avatar Aug 15 '22 02:08 atweiden

@justinmeiners I guess that adding a space would also "escape" it in the generated lit file. What I'd like here is a lit file that produce another lit file with functional code block that can further generate another source file. I'm not dying for that feature, but I wanted to illustrate a basic exemple of writing literate file using literate file. And I ran in that issue that I can't have codeblocks containing codeblocks of the source to generate.

nikonakoneko avatar Aug 21 '22 17:08 nikonakoneko

@soratobukuroneko understood. I will give this some thought.

justinmeiners avatar Aug 21 '22 17:08 justinmeiners