The cl-durian Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-durian Reference Manual

This is the cl-durian Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Tue Jan 09 13:34:00 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

cl-durian

cl-durian creates HTML from simple list structures.

(cl-durian:html `(html ((h1 "This is the title") (body ((p "line1")(p "line2"))))))

"<html><h1>This&nbsp;is&nbsp;the&nbsp;title</h1><body><p>line1</p><p>line2</p></body></html>"

More Examples

attributes

Attributes are handled as a list of lists like in the syntax of let.

(cl-durian:html `(tag ((att1 "val1") (att2 "val2")) "stuff in body"))

"<tag ATT1=\"val1\" ATT2=\"val2\">stuff&nbsp;in&nbsp;body</tag>"

Note that this is detected by the outer list having a length of 3. If you would like to have attributes, but no text between the tags, then use either the empty list (as () or nil) or the empty string "".

(cl-durian:html `(tag ((att1 "val1") (att2 "val2")) ""))

"<tag ATT1=\"val1\" ATT2=\"val2\"></tag>"

tags within strings

Tags must be symbols, a list starting with anything other than a symbol is taken to be a list of things that must be handled separately.

(cl-durian:html `(p ("this has an " (i "italic") " word")))

"<p>this&nbsp;has&nbsp;an&nbsp;<i>italic</i>&nbsp;word</p>"

scripts

The script symbol from the cl-durian package is used to denote a script, and thus the text within these tags will not be escaped as other html text is.

(cl-durian:html `(cl-durian:script ((type "text/javascript")) "var j = 10;"))

"<script TYPE=\"text/javascript\">var j = 10;</script>"

raw text

The raw symbol from the cl-durian package is used to denote text that is note meant to be escaped and is not to be surrounded by tags.

This is meant to allow a way to avoid escaping if you are to want to insert CSS or HTML from another file without causing it to be escaped again.

interpolation

List structures with the backtick are used to allow for interpolation.

(let ((name "George"))
  (cl-durian:html `(html ((h1 "NAME") (body (p ,name))))))

"<html><h1>NAME</h1><body><p>George</p></body></html>"

Functions that return list structures can be used to help abstract. They can then be called within other list structures.

when and list splicing can be used to conditionally add things into the html list structure.

(cl-durian:html `(html ,@(when user-identified `(,(user-banner session-value)))))

Functions that edit or wrap other list structures can also be used to great effect.

Dictionary

html

`html' takes a list structure and creates a formatted html string. This is the main function of cl-durian.

*force-tags-lowercase*

defaults to t (true)

This forces all tags to lowercase. It can be changed, but it defaults to t for convenience as symbols are naturally read in all caps by the lisp reader. Changing this to nil will allow control over the case of tags. Note that as symbols are read in in capital letters, symbols will need to be put between |these| to get any |mIxEd| lowercase.

html-escape

escapes a string for use in html (not generally needed, cl-durian handles the escaping of strings automatically).

script

This symbol denotes that a script follows. Scripts are unescaped.

raw

This is a symbol used by the package to denote that the text in the given list is untagged and needs no escaping.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-durian

Author

Jonathan Wardell Avery <phage74@gmail.com>

License

WTFPL

Description

dynamic html generation from list structures (interpolation friendly)

Source

cl-durian.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 cl-durian.asd

Location

cl-durian.asd

Systems

cl-durian (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 cl-durian/package.lisp

Parent

cl-durian (system)

Location

package.lisp

Packages

cl-durian


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 cl-durian/cl-durian.lisp

Dependency

package.lisp (file)

Parent

cl-durian (system)

Location

cl-durian.lisp

Exported Definitions
Internal Definitions

entity-map (special variable)


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 cl-durian

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

entity-map (special variable)


Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *force-tags-lowercase*
Package

cl-durian

Source

cl-durian.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: html GIVEN
Package

cl-durian

Source

cl-durian.lisp (file)

Function: html-escape TEXT
Package

cl-durian

Source

cl-durian.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: entity-map
Package

cl-durian

Source

cl-durian.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-durian.asd: The cl-durian<dot>asd file
cl-durian/cl-durian.lisp: The cl-durian/cl-durian<dot>lisp file
cl-durian/package.lisp: The cl-durian/package<dot>lisp file

F
File, Lisp, cl-durian.asd: The cl-durian<dot>asd file
File, Lisp, cl-durian/cl-durian.lisp: The cl-durian/cl-durian<dot>lisp file
File, Lisp, cl-durian/package.lisp: The cl-durian/package<dot>lisp file

L
Lisp File, cl-durian.asd: The cl-durian<dot>asd file
Lisp File, cl-durian/cl-durian.lisp: The cl-durian/cl-durian<dot>lisp file
Lisp File, cl-durian/package.lisp: The cl-durian/package<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   F   H  
Index Entry  Section

F
Function, html: Exported functions
Function, html-escape: Exported functions

H
html: Exported functions
html-escape: Exported functions

Jump to:   F   H  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
E   S  
Index Entry  Section

*
*force-tags-lowercase*: Exported special variables

E
entity-map: Internal special variables

S
Special Variable, *force-tags-lowercase*: Exported special variables
Special Variable, entity-map: Internal special variables

Jump to:   *  
E   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-durian: The cl-durian system
cl-durian: The cl-durian package

P
Package, cl-durian: The cl-durian package

S
System, cl-durian: The cl-durian system

Jump to:   C   P   S