Macros?
Ben Wilson
dausha at gmail.com
Tue May 2 15:17:43 EDT 2006
A good macro style is (:macroname attr=val:). It is used by PmWiki.[1]
The have applied it to the creation of conditionals (i.e., (:if
condition true:)(:ifend:)) to including other pages, creation of
forms, etc. So, there is PHP code that helps guide the way. PmWiki
also has stages of markup, and the (::) system is called "directives,"
which is applied before other markups.
I've considered redoing the core PmWiki markup with Markdown, and have
actually substituted a few of the more basic syntacies (i.e. emphases,
bold, headings). Although, that does break some of the add on
functionality (e.g. table of contents). The hurdle for this will be
the (un)ordered lists. PmWiki uses white space at the beginning of a
line to denote <PRE>, so I have to "numb" that behavior first. PmWiki
uses '*' or '#' at the beginning of the line to start the
lists--repeating (e.g. ** item) for indented lists.
Ben Wilson
[1]: http://www.pmwiki.org
On 5/2/06, A. Pagaltzis <pagaltzis at gmx.de> wrote:
> * Anton J Aylward <aja at 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/>
> _______________________________________________
> Markdown-Discuss mailing list
> Markdown-Discuss at six.pairlist.net
> http://six.pairlist.net/mailman/listinfo/markdown-discuss
>
--
Ben Wilson
" Mundus vult decipi, ergo decipiatur"
More information about the Markdown-Discuss
mailing list