Is there any way to do macros in Markdown? Or do you have any other suggestions? I'm thinking of a few uses. One is to read back system stuff that might be global or session settings. Example Tell the user where they are coming from, time etc You are %%USERNAME%% Logged in at %%LOGINTIME%% Your browser is %%HTTP{"User-Agent"}%% You are accessing from %%REMOTE_ADDR%%:%%REMOTE_PORT%% The time is now %%TIME(timezone=%%USER{%%TZ%%}%%, fmt="HH:MM:SS")%% The HTTP is the hash of all headers The USER is the hash of all user parameters ... name timezone etc ... You get the idea ... Example: I have support for 'twisies' in javascript but want to activate them in the page body a) Show/hide information Lead in text %TWISTYSHOW{id="sectionone" mode="div" link=" <input type=\"button\" value=\"Click here to view\">" }%% %%TWISTYHIDE{id="sectionone" mode="div" link=" <input type=\"button\" value=\"Click here to hide\">" }%% %TWISTYTOGGLE{id="sectionone" mode="div"}% Text here gets toggled %%ENDTWISTYTOGGLE%% Expands to .. <span id="sectiononeshow" class="twistyMakeOpaque"> <a href="#" class="twistyTrigger"> <span class="LinkLabel"> <input type="button" value="Click here to view"> </span></a></span> <span id="sectiononehide" class="twistyTransparent twistyMakeOpaque"> <a href="#" class="twistyTrigger"> <span class="LinkLabel"> <input type="button" value="Click here to hide"> </span></a></span> <p /> <div id="sectioonetoggle" class="twistyMakeHidden"> Text here gets toggled </div> A null "hide" button just unfurls the hidden text. The "id" is so you can stack/nest them. -------------------------- Suggestions? Ideas? /anton
* Anton J Aylward <aja@si.on.ca> [2006-05-02 19:35]:> Is there any way to do macros in Markdown? Or do you have any > other suggestions?You can hack this on top of Markdown as it is, as long as you don?t need to nest macros inside links. Then you can write this:> You are %%USERNAME%% > Logged in at %%LOGINTIME%% > > Your browser is %%HTTP{"User-Agent"}%% > You are accessing from %%REMOTE_ADDR%%:%%REMOTE_PORT%% > > The time is now %%TIME(timezone=%%USER{%%TZ%%}%%, fmt="HH:MM:SS")%%like this: You are [USERNAME](macro:) Logged in at [LOGINTIME](macro:) Your browser is [HTTP{"User-Agent"}](macro:) You are accessing from [REMOTE_ADDR](macro:):[REMOTE_PORT](macro:) The time is now [TIME(timezone=USER{TZ},fmt="HH:MM:SS")](macro:) Markdown makes this out of it: <p>You are <a href="macro:">USERNAME</a> Logged in at <a href="macro:">LOGINTIME</a></p> <p>Your browser is <a href="macro:">HTTP{?User-Agent?}</a> You are accessing from <a href="macro:">REMOTE<em>ADDR</a>:<a href="macro:">REMOTE</em>PORT</a></p> <p>The time is now <a href="macro:">TIME(timezone=USER{TZ},fmt=?HH:MM:SS?)</a></p> Then you can you go in there and replace `<a>` tags with a `href` of `macro:` by the result of evaluating their textual content. Hmm, you?d have to be careful about your underscores and asterisks; not to mention there?s a bug there in Markdown? Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>