Vim window logic, slimv
This commit is contained in:
parent
babcc9e44b
commit
515847d07e
791 changed files with 51552 additions and 86 deletions
|
|
@ -0,0 +1,232 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<link href="examples.css" rel="stylesheet" type="text/css" />
|
||||
<title>CL-EMB: Examples</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Some examples of <a href="http://common-lisp.net/project/cl-emb/">CL-EMB</a> usage</h1>
|
||||
<ol>
|
||||
<li><a href="#combine-cl-who">Combining CL-EMB with CL-WHO</a></li>
|
||||
<li><a href="#simple-loop">A simple loop</a></li>
|
||||
<li><a href="#build-dropdown">Build a dropdown</a></li>
|
||||
<li><a href="#mark-fields">Mark invalid form fields</a></li>
|
||||
<li><a href="#using-generic-templates">Using generic templates</a></li>
|
||||
</ol>
|
||||
<table border="1" cellpadding="2" id="combine-cl-who">
|
||||
<caption>Combining CL-EMB with CL-WHO</caption>
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<td>
|
||||
You can mix several methods of HTML generating together. Think of <a href="http://www.cliki.net/Lisp%20Markup%20Languages">Lisp Markup Languages</a> like <a href="http://weitz.de/cl-who/">CL-WHO</a>. <small>(Example code from the <a href="http://weitz.de/cl-who/">CL-WHO</a> documentation.)</small>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
ENV
|
||||
</th>
|
||||
<td>
|
||||
<code>NIL</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Dependencies
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://weitz.de/cl-who/">CL-WHO</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<pre><h1>Music links</h1>
|
||||
<%
|
||||
(cl-who:with-html-output (*standard-output*)
|
||||
(loop for (link . title) in
|
||||
'(("http://zappa.com/" . "Frank Zappa")
|
||||
("http://marcusmiller.com/" . "Marcus Miller")
|
||||
("http://www.milesdavis.com/" . "Miles Davis"))
|
||||
do (cl-who:htm (:a :href link
|
||||
(:b (cl-who:str title)))
|
||||
:br)))
|
||||
%></pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table border="1" cellpadding="2" id="simple-loop">
|
||||
<caption>A simple loop</caption>
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<td>
|
||||
The "Music links" example with template tags and a loop. This example isn't meant to prove anything! Use the method which fits your problem!<br/>
|
||||
The output of the title gets escaped by CL-EMB ("-escape html"). Depending on the situation you'd rather escape the output yourself and don't want to use any complicated modifiers in the template code itself.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
ENV
|
||||
</th>
|
||||
<td>
|
||||
<pre>'(:music-list
|
||||
((:link "http://zappa.com/" :title "Frank Zappa")
|
||||
(:link "http://marcusmiller.com/" :title "Marcus Miller")
|
||||
(:link "http://www.milesdavis.com/" :title "Miles Davis")))</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Dependencies
|
||||
</th>
|
||||
<td>
|
||||
-
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<pre><h1>Music links</h1>
|
||||
<% @loop music-list %>
|
||||
<a href="<% @var link %>"><b><% @var title -escape html%></b></a><br />
|
||||
<% @endloop %></pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table border="1" cellpadding="2" id="build-dropdown">
|
||||
<caption>Build a dropdown</caption>
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<td>
|
||||
You can mix template style with embedded Common Lisp style. This example shows how to access the plist ENV. Within the loop (<code >@loop</code>) ENV gets bound to every plist in the list.<br/>
|
||||
<a href="http://weitz.de/tbnl/">TBNL</a> is used to access a submitted parameter "product" and compare it to the current value attribute of the option element.<br/>
|
||||
Remember the escaping! Set <code>cl-emb:*escape-type*</code> to <code>:html</code> and all output of <code>@var</code> will be escaped correctly.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
ENV
|
||||
</th>
|
||||
<td>
|
||||
<pre>'(:products
|
||||
((:value "foo1" :text "Super Foo")
|
||||
(:value "fooxl" :text "Super Foo XL")
|
||||
(:value "bar2000" :text "Ultra Bar 2000")
|
||||
(:value "hl2" :text "Half-Life 2")
|
||||
(:value "dn4e4" :text "Vaporware")))</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Dependencies
|
||||
</th>
|
||||
<td>
|
||||
<a href="http://weitz.de/tbnl/">TBNL</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<pre><select name="product">
|
||||
<% @loop products %>
|
||||
<option value="<% @var value %>"<%
|
||||
(when (equal (getf env :value) (tbnl:parameter "product"))
|
||||
%> selected="selected"<% ) %>><% @var text %></option>
|
||||
<% @endloop %>
|
||||
</select></pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table border="1" cellpadding="2" id="mark-fields">
|
||||
<caption>Mark invalid form fields</caption>
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<td>
|
||||
Validate a form and mark the errors in the <em>ENV</em> plist.<br />
|
||||
Again: Remember the escaping!
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
ENV
|
||||
</th>
|
||||
<td>
|
||||
<pre>'(:email "stesch@home" :email-error t)</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Dependencies
|
||||
</th>
|
||||
<td>
|
||||
-
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<pre><% @if email-error %>
|
||||
<span class="error">Please provide valid e-mail address</span><br />
|
||||
<% @endif %>
|
||||
<input type="text" name="email" value="<% @var email %>"/></pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table border="1" cellpadding="2" id="using-generic-templates">
|
||||
<caption>Using generic templates</caption>
|
||||
<tr>
|
||||
<th>
|
||||
Description
|
||||
</th>
|
||||
<td>
|
||||
You want to use generic templates which can be called with a defined set of parameters? Then <code>@with</code> and <code>@endwith</code> is what you are looking for. It sets the current <em>ENV</em> to the one accessed by a given name. See the example below, which calls a template for textinput fields.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
ENV
|
||||
</th>
|
||||
<td>
|
||||
<pre>'(:name (:name "name"
|
||||
:length 40)
|
||||
:e-mail (:name "email"
|
||||
:value "no@no"
|
||||
:error t
|
||||
:length 120))</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Dependencies
|
||||
</th>
|
||||
<td>
|
||||
-
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<pre>Please enter your name:<br />
|
||||
<% @with name %>
|
||||
<% @include "includes/textinput.tmpl" %>
|
||||
<% @endwith %>
|
||||
<br />
|
||||
Please enter your e-mail address:<br />
|
||||
<small>(Use the TLD <em>.invalid</em>
|
||||
if you don't want to receive mail</small>
|
||||
<% @with e-mail %>
|
||||
<% @include "includes/textinput.tmpl" %>
|
||||
<% @endwith %></pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue