PIKT

Samples: HTML Anchor Tag Macros

PIKT Logo
Home FAQ News Intro Samples Tutorial Reference Software Authors Licensing SiteSearch


The macros in this selected portion of the sample 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="http://pikt.org/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="http://pikt.org/pikt/links.html">Links</a> |
<a href="http://pikt.org/pikt/site_index.html">SiteIndex</a> |
<a href="http://pikt.org/pikt/faq.html#contribute">Contribute</a> |
<a href="http://pikt.org/pikt/faq.html#contact">ContactUs</a>   
<br>
<a href="#pagetop">Top of Page</a>
With similar HTML preprocessing, the principal PIKT Maintainer manages more than 650 web pages (at last count) over several different Web sites (including pikt.org, as you might expect).

[For more examples, see Samples.]

Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software | Authors | Licensing | SiteSearch
Links | SiteIndex | Pikt-Users | Pikt-Workers | Contribute | ContactUs | Top of Page
Page best viewed at 1024x768.   Page last updated 2005-06-22.
This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.
Copyright © 1998-2005 Robert Osterlund.  All rights reserved.

Computer Books at Amazon.com

Dynamic HTML: The Definitive Reference
Dynamic HTML: The Definitive Reference

HTML & XHTML: The Complete Reference
HTML & XHTML: The Complete Reference

HTML 4 for Dummies
HTML 4 for Dummies

PHP Pocket Reference
PHP Pocket Reference

PHP Cookbook
PHP Cookbook