CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...
http://cdelord.fr/pp
GNU General Public License v3.0
252 stars 21 forks source link

Add !append Macro #45

Closed tajmone closed 6 years ago

tajmone commented 6 years ago

Feature request:

!append(SYMBOL)(TEXT)

... which would allow to incrementally define symbols. It would be useful to create ad hoc text for documentation pages, exploiting conditional statements and OS specific commands to build SYMBOL step by step, and in the final document it can be emitted with a single !SYMBOL call.

Currently this is difficult to achieve via custom macros because it would envolve nesting temporary macros definition (prev TEXT, new TEXT containing previous one, etc) and I haven't so far managed to find a way to achive it without incurring in infinte loops or crashes.

Unlike literal code, the aim of this macro is to append TEXT which might contain other SYMBOLS or MACROS.

CDSoft commented 6 years ago

done.

tajmone commented 6 years ago

Thanks a lot! It's really useful, especially for maintainance of project documentation.

I've created an !importAdd(FILE) macro that, beside importing macros-definitions modules, it also incrementally creates a macro with a markdown list of all the imported modules (which can then be used to emit an awlays-up-to-date list of modules in the proejct documentation):

https://github.com/tajmone/pb-archives-test/blob/d44a924/_butler_/macros/macros-init.pp#L53

robinrosenstock commented 6 years ago

Why not closing this issue?