HTML Anchor Tag Macros
The macros in this selected portion of the example html_macros.cfg configuration file below are used for specifying HTML anchor tags, for example, links, names, URLs, mailtos, etc.
/////////////////////////////////////////////////////////////////////////////// // // html_macros.cfg -- macros for html formatting // /////////////////////////////////////////////////////////////////////////////// ... // anchor tags lnk(T, L) // link <a href="(L)">(T)</a> lnkn(T, L) // navy link <a href="(L)">=fn((T))</a> nmlnk(T, L) // name link <a name="(T)" href="(L)" style="text-decoration: none; font-weight: 700">(T)</a> nmitlnk(T, L) // name italic link <a name="(T)" href="(L)" style="text-decoration: none; font-style: italic; font-weight: 700">(T)</a> emlnk(T, L) // emphasized link <a href="(L)" style="text-decoration: none; font-weight: 700">(T)</a> emitlnk(T, L) // emphasized italic link <a href="(L)" style="text-decoration: none; font-style: italic; font-weight: 700">(T)</a> nm(T) // name <a name="(T)">(T)</a> name(N, T) // name, alternate text <a name="(N)">(T)</a> emnm(T) // emphasized name <a name="(T)">=em((T))</a> emitnm(T) // emphasized italic name <a name="(T)">=em(=i((T)))</a> url(L) <a href="http:\/\/(L)">(L)</a> email(T, S) <a href="mailto:(T)?subject\=(S)">(T)</a> /////////////////////////////////////////////////////////////////////////////// nmlnkn(T, L) // navy named link <a name="(T)" href="http:\/\/(L)" style="text-decoration: none; font-weight: 700">=fn((T))</a> nmlnkg(T, L) // green named link <a name="(T)" href="http:\/\/(L)" style="text-decoration: none; font-weight: 700">=fg((T))</a> nmlnkbl(T, L) // blue named link <a name="(T)" href="http:\/\/(L)" style="text-decoration: none; font-weight: 700">=fbl((T))</a> ... ///////////////////////////////////////////////////////////////////////////////
Using macros such as these, we can dispense for the most part with ugly, error-prone HTML tags and instead use the much shorter and more readable PIKT macro equivalents.
So, for example, instead of writing this:
<a href="/pikt/faq.html">FAQ</a>
we would write this:
=lnk(FAQ, =piktdocroot/faq.html)
They both achieve the same result, but specifying the link the second way with PIKT macros is clearer. Note how the =lnk(T, L) macro allows us to specify the link text before the link URL--an order that seems more natural to us.
Here is some HTML code from the current page that uses the HTML anchor tag macros:
=lnk(Links, =piktdocroot/links.html) | =lnk(SiteIndex, =piktdocroot/site_index.html) | =lnk(Contribute, =piktdocroot/faq.html#contribute) | =lnk(ContactUs, =piktdocroot/faq.html#contact) =br =lnk(Top of Page, #pagetop)
After PIKT macro preprocessing, here is the result:
<a href="/pikt/links.html">Links</a> | <a href="/pikt/site_index.html">SiteIndex</a> | <a href="/pikt/faq.html#contribute">Contribute</a> | <a href="/pikt/faq.html#contact">ContactUs</a> <br> <a href="#pagetop">Top of Page</a>
In fact, we can take this one step further. If we define yet another linking macro
piktlnk(T, L) =lnk((T), =piktdocroot/(L))
we can then simplify the above example to
=piktlnk(Links, links.html) | =piktlnk(SiteIndex, site_index.html) | =piktlnk(Contribute, faq.html#contribute) | =piktlnk(ContactUs, faq.html#contact)
With similar HTML preprocessing, the principal PIKT Maintainer manages nearly 1,000 web pages (at last count) over several different Web sites (including pikt.org, as you might expect).
For more examples, see Samples.