Introduction to pop!talkTM On this Page
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Overview pop!talk is a superset of HTML. When you use pop!siteTM, you are composing pop!talk documents and pop!site translates them into plain HTML. Because HTML is the foundation of pop!talk, it's important to understand some key HTML terms that we use:
If you're not comfortable with these terms, you should review our quick Key Concepts in HTML page before proceeding. To begin to write pop!talk documents, you must have a basic understanding of the following concepts:
In the following sections, you'll find an introduction to each of these concepts. At the bottom of some sections, you'll find a link to a more comprehensive discussion of the topic.
System Elements
When processing a document, pop!site
(generally) ignores HTML tags and simply passes them on to the output document
for processing by a browser.
pop!talk, however, supports a variety of additional built-in system
elements which are processed immediately
by pop!site.
As an example, pop!talk supports an <include> element that lets you insert the contents of
a secondary "include file" into your main document.
Examples of additional system elements include:
Variables and Expressions
HTML supports a variety of entities. For example, the HTML entity
< produces a "<" symbol. pop!talk extends this entity feature
and allows you to define your own entities, called variables.
As an example:
After processing by pop!site, this will produce:
In this example, thisyear and nextyear are variables. The sequences between the &( and the ) are called expressions. In the first two expressions, we are setting the values of our two variables. In the second two expressions, we are obtaining the values of the variables. As a convenience, you can leave off the parentheses in an expression if you're just refering to the value of a variable. In this case, you can even leave off the trailing semicolon if the next character is something other than a digit or letter. Thus the above example could also be written:
As an additional convenience, you can also embed some simple references to variables in quoted strings. More Information: Variables and Expressions.
User-Defined Macros
In addition to HTML's elements and pop!talk's system elements, authors
can also define their own elements (called macros). A macro
is a fragment of pop!talk that is used whenever the macro is referred to.
Imagine that
you're building a document and you want to put a navigation toolbar at the top of each page
on a personal web site you're building. You might want this toolbar to look like this:
TOP - BIOGRAPHY - VACATIONS - FAMILY
Each of these four items would be links to the different sections
of your site. The HTML to produce this toolbar would be:
To have this tool bar on every page, you'd have to paste this sequence into each HTML document on your site. For example:
Unfortunately, changing your mind about the appearance or contents of this toolbar will be a pain because you'll have to go change each page again. Using pop!talk, you'd define a macro for your toolbar. Macros are defined using the built-in <define> element:
Here we have defined a new empty element (one without an end tag) called toolbar. We can immediately use this macro in place of the explicit HTML:
Of course, each document must "know" about the definition of toolbar. This is handled by placing the macro definition in an additional "include file" which each document will "include." Thus:
In the above example, we defined a simple empty macro (one with no end tag). Let's also define a container macro. A common use for container macros is wrapping a section of a document with some extra elements. In the example above, the standard HTML tags (<html>, <body>, etc) are a good candidate for a container macro. Let's define a new element called doc which takes care of all these common HTML tags. With the new macro we'll be able to say:
Our new <doc> macro will be defined like this:
Important things to note about this macros include:
More Information: Defining Macros.
Objects, Methods and Properties
There are two kinds of elements: properties and methods.
With pop!talk, you'll be dealing with
a variety of objects (for example, Documents, TimeStamps, and Strings).
These objects have elements (properties and methods) called object elements.
For example, a String object, has a length property,
and a substring method (which divides the String into pieces).
In the case of system elements (system properties and system methods),
we're dealing with aspects of pop!site as a whole. For example,
there is a system method <read> which reads information from a file.
Thus we have:
When using properties (and some methods), you're manipulating objects. When you refer to a property or method, you "get" an object which you can then manipulate. As described above, these objects have properties and methods. To understand what you can do with a particular object, you must consider its type: objects of different types have different properties and methods. Consider String and Number objects. You can capitalize a String - but not a Number. You can subtract one from a Number - but not from a String. To understand how you might use objects, let's examine the system property <maindocument>. When you refer to this property, you get a Document object. Document objects have timestamp and filename properties:
Imagine that you wanted each of your web pages to identify when it was last changed. You could place this pop!talk into your document:
This first gets the system property maindocument (a Document object), and then asks it for its timestamp property (producing a TimeStamp object). Taking this example further, the TimeStamp object has properties, so you could say:
which might produce something like:
Of course, dayofweek property gives you a String object which you could further manipulate...
More Information: List of System Methods.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Copyright 1995-1997. Pragmatica, Inc. All Rights reserved. Pragmatica, pop!site and pop!talk are trademarks of Pragmatica, Inc. Modified: 07 March, 1997 23:47:22
Page Feedback
|