For admins, by admins.
  
 

The Guiding Principles for Anti Webpages

  • Anti Webpages: When you just gotta git 'er done dammit.
  • If you want to write straight HTML or Javascript or CSS, go ahead and do it. Anti Webpages don't judge, they glue.
  • If you can't solve it with a regular expression, you aren't trying hard enough.
  • There's Even More Ways To Do It Than In Perl (TEMWTDITIP).
  • It doesn't matter how deep you go. There's no bottom.
  • Why duct-tape when you can super-glue?

Anti Webpages are an experimental and innovative new way of creating web content. The server portion of Antiweb is separate from Antiweb Pages and is more straightforward--all it has to do is implement HTTP 1.1 as efficiently and securely as possible.Antiweb Tip
Installing an .awp file is as easy as copying it into an Antiweb HTML root, making sure the worker has a cache directory, and adding :awp to the worker's conf. However, you can also compile an .awp file with the launch script's -awp command even if no Antiweb server is running.
This stuff is kinda crazy. Antiweb Pages are unstable meaning their exact specification will change over time (but we think we're pretty close).

The point of Anti Webpages is to create static HTML files which can be served very efficiently by Antiweb. Although they support AJAX callbacks and flat-file or BerkeleyDB data-stores, Anti Webpages revolve around static content and that is all this manual currently describes.

  1. Pages and Layouts
  2. Inheritance
  3. Super-Glue
  4. More Info

Pages and Layouts

An Anti Webpage is a file that ends in .awp. Like almost all of Antiweb's files, .awp files are confs. Each .awp file maps to an .awp/ directory on your website. There can be multiple pages inside this directory, each indicated with an xconf. Here is a simple .awp file with one page xconf:

(page "index.html"
  :layout #"
content                        |
"#
  :content #"Hello world!"#
)

  • Strings can be delimited with regular double quotes (") or with the special #" and "# quotes. These special quotes allow you to insert quote characters, backslashes, etc, without having to escape them.
  • The :layout option positions the segments of the awp file. There must be at least one line terminated with a vertical bar (|). All lines must be terminated by vertical bars except blank lines. All the vertical bars should "line up".

The :layout option positions the segments of the awp file. There must be at least one line terminated with a vertical bar (|). The above code positions the :content segment in the middle of the page. Multiple bars can be used to indicate more specific positioning. For example, the following code "bounds" :content in a right-most portion of the page:

(page "index.html"
  :layout #"
                     | content |
"#
  :content #"Hello world!"#
)

Alternatively, you can use the locator modifier (@) to position a segment within its area. The following is similar to the previous example:

(page "index.html"
  :layout #"
content@r                      |
"#
  :content #"Hello world!"#
)

@r means it should positioned at the right of its area. The possible modifiers are @r @l @t @b @tl @tr @bl @br (though the letter arrangements don't matter). Here is a more complicated example:

(page "index.html"
  :title "Antiweb Manual"

  :layout-width 800
  :layout #"
logo@r |  |          header@l         |  slogan  |
nav@rt |  |          content@tl                  |
                       footer                    |
"#

  :header #"<h1><u>Antiweb Manual</u></h1>"#
)

When the above .awp file is rendered, there is one segment displayed (:header) and the rest are NIL because you haven't added them yet. There are some special keywords that don't relate to the layout:

  • :title - This is the page's HTML title.
  • :css - CSS code. There can be multiple :css parameters. They are all added to a CSS block at the top of the rendered HTML page.
  • :js - Javascript code. There can be multiple :js parameters. They are all added to a Javascript block at the top of the rendered HTML page.
  • :js-end - Identical to :js except the code is added to a Javascript block at the bottom of the page, not the top.

Inheritance

Because it is so common to want to "re-use" parts of other pages, Anti Webpages support page inheritance. This is different from the inheritance of conf files and is only given the same name to add to the general confusion. Of course .awp files are confs so you can use that inheritance too. You can even inherit pages across inherited .awp files.

Here is how you use page inheritance:

(page "index.html"
  :title "my title"
  :layout #"
     | header |                |
content@r                      |
"#
  :header "my site"
  :content #"my content"#
)

(page "other.html"
  :inherit "index.html"
  :content #"my other content"#
)

Now, when other.html is rendered, it is exactly the same as index.html except for the :content parameter. This parameter has been over-ridden or shadowed. What happens is the xconf for index.html is appended on to the end of other.html's xconf. When Antiweb goes to render other.html, it only looks for the first parameter named :content so it gets the shadowing one.

  • Any parameter can be inherited or shadowed, including :layout and :title.
  • Since Antiweb takes all :css, :js, and :js-end parameters, not just the first ones it finds, all CSS and JS code is inherited.

Super-Glue

So what are these things we're passing as arguments? They are lisp strings. But they don't need to be. They can be anything and Anti Webpages will super-glue them into HTML. There are several built-in list forms provided. For example, p takes any amount of arguments and will wrap HTML <p> tags around each one:

(page "other.html"
  :inherit "index.html"
  :content (p "pargraph 1"
              #"paragraph 2"#
              (p #"subparagraph"#)
           )
)

But another way you could have done that is by giving a string and then unquoting a list-based expression inside that string. If super-glue finds the sequence of characters # and then ( followed by a terminating ) later inside a string, it will treat it as a list form and will super-glue it too:

(page "other.html"
  :inherit "index.html"
  :content #"
             #(p "pargraph 1"
                 #"paragraph 2"#
                 (p #"subparagraph"#)
              )
           "#
)

There is no bottom.

Anti Webpages don't care if you use HTML. The two previous examples could both have been written like this:

(page "other.html"
  :inherit "index.html"
  :content #"
<p>pargraph 1</p>
<p>pargraph 2</p>
<p><p>subparagraph</p></p>
"#
)

  • You can create your own glue types like p with the defglue form. Glue types added in an .awp file are local to that .awp file only.

More Info

Ya ok you guys are nuts but that sounds pretty cool.

For more info see the following files:

  • src/manual.awp - The .awp file for the manual you are reading now.
  • src/awp.lisp - The implementation of Anti Webpages.
  • src/glue.lisp - Default glue types included with Antiweb.