CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...

Home Page:http://cdelord.fr/pp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Temporarily suspend printing text via storage/recall macros?

rhagenson opened this issue · comments

Is there a way to temporarily store the processed text of a macro rather than print it immediately then later recall all the stored text?

Contrived (but simplified example):

!define(firstname)(!store(stored-firstname)(_!1_))
!define(middlename)(!store(stored-middlename)(~!1~))
!define(lastname)(!store(stored-lastname)(**!1**))
!define(printname)(!recall(stored-firstname) !recall(stored-middlename) !recall(stored-lastname))

The !printname would appear as: First Middle Last

One increment better would be a way to define the new storage macros based on the name of the macros used to store them then recall based on pattern match. E.g. !define(firstname)(!store(names-)(!1)) (creates a macros called names-firstname) then later !recall(names-)(firstname) to recall a single entry under "names "or !recall(names-) to recall all entries (in order they were entered).

I kind of figured there was a way to do this already, just not the worded the same way I had in my head. I will look into the !append macro. Thank you.