The weblocks-util Reference Manual

This is the weblocks-util Reference Manual, version 0.1.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 18:16:51 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 weblocks-util

Utilities for weblocks

Maintainer

Olexiy Zamkoviy, Scott L. Burson

Author

Slava Akhmechet

License

LLGPL

Version

0.1.1

Dependencies
  • closer-mop (system).
  • hunchentoot (system).
  • puri (system).
  • cl-json (system).
  • cl-who (system).
  • parenscript (system).
  • cl-fad (system).
  • optima (system).
  • cl-cont (system).
  • metatilities (system).
  • cl-ppcre (system).
  • anaphora (system).
  • f-underscore (system).
  • bordeaux-threads (system).
  • salza2 (system).
  • html-template (system).
  • trivial-timeout (system).
  • trivial-backtrace (system).
  • parse-number (system).
  • pretty-function (system).
  • ironclad (system).
Source

weblocks-util.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 weblocks-util/src

Source

weblocks-util.asd.

Parent Component

weblocks-util (system).

Child Components

3.2 weblocks-util/src/utils

Dependency

util.lisp (file).

Source

weblocks-util.asd.

Parent Component

src (module).

Child Components

4 Files

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


4.1 Lisp


4.1.1 weblocks-util/weblocks-util.asd

Source

weblocks-util.asd.

Parent Component

weblocks-util (system).

ASDF Systems

weblocks-util.

Packages

weblocks-util-asd.


4.1.2 weblocks-util/src/util.lisp

Source

weblocks-util.asd.

Parent Component

src (module).

Packages

weblocks-util.

Internals

wexport (function).


4.1.3 weblocks-util/src/utils/misc.lisp

Source

weblocks-util.asd.

Parent Component

utils (module).

Public Interface
Internals

4.1.4 weblocks-util/src/utils/clos.lisp

Source

weblocks-util.asd.

Parent Component

utils (module).

Public Interface

4.1.5 weblocks-util/src/utils/list.lisp

Source

weblocks-util.asd.

Parent Component

utils (module).

Public Interface

4.1.6 weblocks-util/src/utils/i18n.lisp

Source

weblocks-util.asd.

Parent Component

utils (module).

Public Interface

4.1.7 weblocks-util/src/utils/templates.lisp

Dependency

html-parts.lisp (file).

Source

weblocks-util.asd.

Parent Component

utils (module).

Public Interface
Internals

calculate-template-priority (function).


4.1.8 weblocks-util/src/utils/html-parts.lisp

Source

weblocks-util.asd.

Parent Component

utils (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 weblocks-util

General Lisp utilities traditionally exported with Weblocks.

Source

util.lisp.

Use List
  • anaphora.
  • closer-mop.
  • common-lisp.
  • f-underscore.
  • hunchentoot.
  • metabang.utilities.
Public Interface
Internals

5.2 weblocks-util-asd

Source

weblocks-util.asd.

Use List
  • asdf/interface.
  • common-lisp.

6 Definitions

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


6.1 Public Interface


6.1.1 Special variables

Special Variable: *parts-md5-context-hash*

A hash with key of html part md5 hash and the value of html part context

Package

weblocks-util.

Source

html-parts.lisp.

Special Variable: *parts-md5-hash*

A hash with key of html part md5 hash
and the value of list with html part as car and list of children as cdr

Package

weblocks-util.

Source

html-parts.lisp.

Special Variable: *process-html-parts-p*
Package

weblocks-util.

Source

html-parts.lisp.

Special Variable: *templates*

Hash containing all templates. Hash key is template name, hash value is a cons with template and context arguments

Package

weblocks-util.

Source

templates.lisp.

Special Variable: *translation-function*
Package

weblocks-util.

Source

i18n.lisp.


6.1.2 Macros

Macro: defrender (widget-type &body body)
Package

weblocks-util.

Source

misc.lisp.

Macro: insert-at (newelt list index)

Destructively inserts ’newelt’ into ’list’ before ’index’.

Package

weblocks-util.

Source

list.lisp.

Macro: nested-html-part (context &body body)

Adds part of html (a string received as a result of &body evaluation) and context associated with it to html parts set.

Package

weblocks-util.

Source

html-parts.lisp.

Macro: with-file-write ((stream-name path &key element-type) &body body)
Package

weblocks-util.

Source

misc.lisp.


6.1.3 Ordinary functions

Function: alist->plist (alist)

Converts an alist to plist.

Package

weblocks-util.

Source

list.lisp.

Function: append-custom-fields (custom-fields args)

Appends ’custom-fields’ to the end of custom fields that are already defined in ’args’.

Package

weblocks-util.

Source

misc.lisp.

Function: asdf-system-directory (asdf-system-name)

Computes the directory in which the .asdf file for a given ASDF system resides.

Package

weblocks-util.

Source

misc.lisp.

Function: concatenate-keywords (&rest symbols)
Package

weblocks-util.

Source

misc.lisp.

Function: deftemplate (name function &rest context)

Associates function with template name. Template name is a keyword.
Context arguments used to calculate effective template.
:application-class, a symbol, this argument gives 10 points for template if its value equal to type of application used. :context-matches argument is a callback which will be called with template context during template calculation and should return points

Package

weblocks-util.

Source

templates.lisp.

Function: drop-last (list)

Returns a copy of the list without the last element.

Package

weblocks-util.

Source

list.lisp.

Function: find-own-symbol (name &optional package)

Like ‘find-symbol’, but reject symbols not really in PACKAGE.

Package

weblocks-util.

Source

misc.lisp.

Function: find-slot-dsd (class slot-name)

Returns a direct-slot-definition object of a slot with ’slot-name’ in ’class’.

Package

weblocks-util.

Source

clos.lisp.

Function: find-slot-esd (class slot-name)

Returns an effective-slot-definition object of a slot with ’slot-name’ in ’class’.

Package

weblocks-util.

Source

clos.lisp.

Function: function-designator-p (obj)

Returns true if the object is a function designator.

Package

weblocks-util.

Source

misc.lisp.

Function: gen-id (&optional prefix)

Generates an ID unique accross the session. The generated ID can be used to create IDs for html elements, widgets, etc.

Package

weblocks-util.

Source

misc.lisp.

Function: get-html-part (key)

Returns html part string by its md5

Package

weblocks-util.

Source

html-parts.lisp.

Function: get-html-part-children (key)

Returns html part child parts by its md5

Package

weblocks-util.

Source

html-parts.lisp.

Function: get-html-part-context (key)

Returns html part context by its md5

Package

weblocks-util.

Source

html-parts.lisp.

Function: get-html-parts-root-hash ()

Returns md5 hash of root html part in parts tree

Package

weblocks-util.

Source

html-parts.lisp.

Function: gzip-file (input output &key if-exists if-does-not-exist minimum-length)

Redefined salsa2:gzip-file with more keywords.

Package

weblocks-util.

Source

misc.lisp.

Function: hash-keys (hashtable)

Returns all keys in the hashtable.

Package

weblocks-util.

Source

misc.lisp.

Function: insert-after (newelt list index)

Destructively inserts ’newelt’ into ’list’ after ’index’.

Package

weblocks-util.

Source

list.lisp.

Function: intersperse (list delimeter &key last)

Intersperses a list with a delimeter.

If ’last’ is specified, it will be used for the last delimeter, instead of ’delimeter’.

(intersperse ’(1 2 3 4 5) 0)
=> (1 0 2 0 3 0 4 0 5)

Package

weblocks-util.

Source

list.lisp.

Function: list->assoc (lst &key map)

Nondestructively convert a list of elements to an association
list If an element of a list is a cons cell, it is left as
is. Otherwise, it is replaced with a cons cell whose ’car’ is the
element and whose ’cdr’ is a result of ’map’ applied to the
element. The ’map’ is an identity by default.

Ex:
(list->assoc ’(name age (city . location))) => ((name . name) (age . age) (city . location)) (list->assoc ’(1 (2 . 2) 3) :map #’1+) => ((1 . 2) (2 . 2) (3 . 4))

Package

weblocks-util.

Source

list.lisp.

Function: list-starts-with (list elements &key test)

Determines if a list starts with the given elements.

Package

weblocks-util.

Source

list.lisp.

Function: md5 (string)
Package

weblocks-util.

Source

misc.lisp.

Function: merge-files-with-newline (file-list saved-path)
Package

weblocks-util.

Source

misc.lisp.

Function: ninsert (list thing pos)
Package

weblocks-util.

Source

list.lisp.

Function: public-file-relative-path (type filename)

Infer FILENAME’s relative path and extension from TYPE.

Example:

(public-file-relative-path :stylesheet "navigation") => "stylesheets/navigation.css"

Package

weblocks-util.

Source

misc.lisp.

Function: public-files-relative-paths (&rest args)

A helper function that returns a list of paths for files provided in ’args’. Each argument must be a cons cell where car is
either :stylesheet or :script and cdr is a name of the file.

Useful when generating a list of dependencies for widgets and/or the application (see the ’dependencies’ generic function and *application-dependencies*.)

Ex:
(get-public-files-paths ’(:stylesheet . "navigation")
’(:script . "effects"))
=> (#P"stylesheets/navigation.css" #P"scripts/effects.js")

Package

weblocks-util.

Source

misc.lisp.

Function: read-from-file (path)
Package

weblocks-util.

Source

misc.lisp.

Function: relative-path (full-path prefix-path)
Package

weblocks-util.

Source

misc.lisp.

Function: remove-keyword-parameter (parameter-list keyword)

Removes a keyword parameter from a parameter-list. (remove-keyword-parameter ’(1 2 3 :a 1 :b 2 :c 3) :b) => (1 2 3 :a 1 :c 3)

Package

weblocks-util.

Source

list.lisp.

Function: remove-keyword-parameters (parameter-list &rest keywords)

Removes all parameters with keys in ’keywords’ from ’parameter-list’.

Package

weblocks-util.

Source

list.lisp.

Function: remove-template (name function)

Removes template associated with name and function.

Package

weblocks-util.

Source

templates.lisp.

Function: render-wt-to-string (template context &rest args)

Similar to render-wt but renders template to string instead of *weblocks-output-stream*

Package

weblocks-util.

Source

templates.lisp.

Function: request-parameter (name)

Get parameter ’name’ from the request. If the request was submitted via GET method, the parameter is obtained from the query string. If the request was submitted via POST, the parameter is obtained from the body of the request. Otherwise, an error is signalled.

Package

weblocks-util.

Source

misc.lisp.

Function: request-parameters ()

Get parameters alist from the request. If the request was submitted via GET method, the parameters are obtained from the query string. If the request was submitted via POST, the parameters are obtained from the body of the request. Otherwise, an error is signalled.

Package

weblocks-util.

Source

misc.lisp.

Function: reset-html-parts-set ()

Resets html parts set

Package

weblocks-util.

Source

html-parts.lisp.

Function: safe-apply (fn &rest args)

Apply ’fn’ if it isn’t nil. Otherwise return nil.

Package

weblocks-util.

Source

misc.lisp.

Function: safe-funcall (fn &rest args)

Funcall ’fn’ if it isn’t nil. Otherwise return nil.

Package

weblocks-util.

Source

misc.lisp.

Function: safe-getf (list name)

Like GETF but copes with odd argument lists. Extracts the first value whose predecessor matches NAME. Returns NIL as second value if the key wasn’t found at all.

Package

weblocks-util.

Source

list.lisp.

Function: safe-subseq (sequence start &optional end)

A safe alternative to subseq that automatically adjust indices.

Package

weblocks-util.

Source

list.lisp.

Function: slot-equal (o1 o2 &key exclude test)

Whether O1 and O2 have identical slot contents, excluding slot names in EXCLUDE.

Two slots are considered equal if they are either both unbound or if they are both bound and pass TEST.

Signals an error when the slot names of O1 and O2 don’t match.

Package

weblocks-util.

Source

clos.lisp.

Function: slot-value-by-path (obj path)

Retrieves a value of a slot from a hierarchy of objects. A nil on the path is ignored.

ex:
(slot-value-by-path employee ’(address street)) => "17 Sunvalley St." (slot-value-by-path employee ’(address)) => #<ADDRESS {XXX}> (slot-value-by-path employee ’address) => #<ADDRESS {XXX}> (slot-value-by-path address ’(street)) => "17 Sunvalley St." (slot-value-by-path address ’(nil street)) => "17 Sunvalley St."

obj - a CLOS object
path - a list of slot names

Package

weblocks-util.

Source

clos.lisp.

Function: slurp-file (filepath &key element-type)
Package

weblocks-util.

Source

misc.lisp.

Function: stable-set-difference (list-1 list-2 &key test key)

Returns a list of element of ’list-1’ that do not appear in ’list-2’.

Package

weblocks-util.

Source

list.lisp.

Function: symbol-status (symbol)

Returns a status of ’symbol’ in its package (internal, external, etc.)

Package

weblocks-util.

Source

misc.lisp.

Function: translate (string &rest scope)

Translates given string by calling *translation-function* with string and ’scope’.
’scope’ is a set of function key arguments which can be :accusative-form-p
:genitive-form-p
:items-count
:preceding-count

Package

weblocks-util.

Source

i18n.lisp.

Function: update-html-parts-connections ()

Builds html parts tree from html parts list.
Each html part child is a substring of its parent.
Html parts which are empty strings removed from html parts set.

Package

weblocks-util.

Source

html-parts.lisp.

Function: write-to-file (object path)
Package

weblocks-util.

Source

misc.lisp.


6.1.4 Generic functions

Generic Function: object-class-name (obj)

Returns an object’s class name (i.e. "Employee"). This method is be used to present the name of an entity to the user. Override this method to change the name for particular objects.

Package

weblocks-util.

Source

clos.lisp.

Methods
Method: object-class-name (obj)

6.2 Internals


6.2.1 Special variables

Special Variable: *asdf-system-cache*
Package

weblocks-util.

Source

misc.lisp.

Special Variable: *current-html-part-children*

Contains callback which should return boolean value
indicating whether html parts should be collected and processed

Package

weblocks-util.

Source

html-parts.lisp.


6.2.2 Ordinary functions

Function: calculate-template-priority (template actual-context)

Calculates priority for finding effective template.

Package

weblocks-util.

Source

templates.lisp.

Function: congruent-lambda-expression (lambda-list function)

Answer a lambda expression with LAMBDA-LIST that passes all args (assuming the call is allowed by LAMBDA-LIST) to FUNCTION, answering its result.

Package

weblocks-util.

Source

misc.lisp.

Function: is-substring-of-p (string-child string-parent)

Checks whether one string is substring of another and has less length.

Package

weblocks-util.

Source

html-parts.lisp.

Function: merge-files (file-list saved-path &key element-type linkage-element-fn)
Package

weblocks-util.

Source

misc.lisp.

Function: process-html-parts-p ()

Whether or not to capture html parts information

Package

weblocks-util.

Source

html-parts.lisp.

Function: remove-html-part (key)

Removes html part by its md5

Package

weblocks-util.

Source

html-parts.lisp.

Function: set-html-part-children (key children)

Sets html part child parts by its md5

Package

weblocks-util.

Source

html-parts.lisp.

Function: update-current-html-part-children (args)

Takes strings list as an argument and adds strings which are html parts (which are in html parts set) to *current-html-part-children* list

Package

weblocks-util.

Source

html-parts.lisp.

Function: wexport (symbols-designator &optional package-specs)

Export SYMBOLS-DESIGNATOR from PACKAGE-SPECS. Over ‘export’, PACKAGE-SPECS can be a list of packages, and the name designators therein are interpreted by prepending "WEBLOCKS-". In the latter case, the symbols will be imported first if need be.

Package

weblocks-util.

Source

util.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   C   D   F   G   H   I   L   M   N   O   P   R   S   T   U   W  
Index Entry  Section

A
alist->plist: Public ordinary functions
append-custom-fields: Public ordinary functions
asdf-system-directory: Public ordinary functions

C
calculate-template-priority: Private ordinary functions
concatenate-keywords: Public ordinary functions
congruent-lambda-expression: Private ordinary functions

D
defrender: Public macros
deftemplate: Public ordinary functions
drop-last: Public ordinary functions

F
find-own-symbol: Public ordinary functions
find-slot-dsd: Public ordinary functions
find-slot-esd: Public ordinary functions
Function, alist->plist: Public ordinary functions
Function, append-custom-fields: Public ordinary functions
Function, asdf-system-directory: Public ordinary functions
Function, calculate-template-priority: Private ordinary functions
Function, concatenate-keywords: Public ordinary functions
Function, congruent-lambda-expression: Private ordinary functions
Function, deftemplate: Public ordinary functions
Function, drop-last: Public ordinary functions
Function, find-own-symbol: Public ordinary functions
Function, find-slot-dsd: Public ordinary functions
Function, find-slot-esd: Public ordinary functions
Function, function-designator-p: Public ordinary functions
Function, gen-id: Public ordinary functions
Function, get-html-part: Public ordinary functions
Function, get-html-part-children: Public ordinary functions
Function, get-html-part-context: Public ordinary functions
Function, get-html-parts-root-hash: Public ordinary functions
Function, gzip-file: Public ordinary functions
Function, hash-keys: Public ordinary functions
Function, insert-after: Public ordinary functions
Function, intersperse: Public ordinary functions
Function, is-substring-of-p: Private ordinary functions
Function, list->assoc: Public ordinary functions
Function, list-starts-with: Public ordinary functions
Function, md5: Public ordinary functions
Function, merge-files: Private ordinary functions
Function, merge-files-with-newline: Public ordinary functions
Function, ninsert: Public ordinary functions
Function, process-html-parts-p: Private ordinary functions
Function, public-file-relative-path: Public ordinary functions
Function, public-files-relative-paths: Public ordinary functions
Function, read-from-file: Public ordinary functions
Function, relative-path: Public ordinary functions
Function, remove-html-part: Private ordinary functions
Function, remove-keyword-parameter: Public ordinary functions
Function, remove-keyword-parameters: Public ordinary functions
Function, remove-template: Public ordinary functions
Function, render-wt-to-string: Public ordinary functions
Function, request-parameter: Public ordinary functions
Function, request-parameters: Public ordinary functions
Function, reset-html-parts-set: Public ordinary functions
Function, safe-apply: Public ordinary functions
Function, safe-funcall: Public ordinary functions
Function, safe-getf: Public ordinary functions
Function, safe-subseq: Public ordinary functions
Function, set-html-part-children: Private ordinary functions
Function, slot-equal: Public ordinary functions
Function, slot-value-by-path: Public ordinary functions
Function, slurp-file: Public ordinary functions
Function, stable-set-difference: Public ordinary functions
Function, symbol-status: Public ordinary functions
Function, translate: Public ordinary functions
Function, update-current-html-part-children: Private ordinary functions
Function, update-html-parts-connections: Public ordinary functions
Function, wexport: Private ordinary functions
Function, write-to-file: Public ordinary functions
function-designator-p: Public ordinary functions

G
gen-id: Public ordinary functions
Generic Function, object-class-name: Public generic functions
get-html-part: Public ordinary functions
get-html-part-children: Public ordinary functions
get-html-part-context: Public ordinary functions
get-html-parts-root-hash: Public ordinary functions
gzip-file: Public ordinary functions

H
hash-keys: Public ordinary functions

I
insert-after: Public ordinary functions
insert-at: Public macros
intersperse: Public ordinary functions
is-substring-of-p: Private ordinary functions

L
list->assoc: Public ordinary functions
list-starts-with: Public ordinary functions

M
Macro, defrender: Public macros
Macro, insert-at: Public macros
Macro, nested-html-part: Public macros
Macro, with-file-write: Public macros
md5: Public ordinary functions
merge-files: Private ordinary functions
merge-files-with-newline: Public ordinary functions
Method, object-class-name: Public generic functions

N
nested-html-part: Public macros
ninsert: Public ordinary functions

O
object-class-name: Public generic functions
object-class-name: Public generic functions

P
process-html-parts-p: Private ordinary functions
public-file-relative-path: Public ordinary functions
public-files-relative-paths: Public ordinary functions

R
read-from-file: Public ordinary functions
relative-path: Public ordinary functions
remove-html-part: Private ordinary functions
remove-keyword-parameter: Public ordinary functions
remove-keyword-parameters: Public ordinary functions
remove-template: Public ordinary functions
render-wt-to-string: Public ordinary functions
request-parameter: Public ordinary functions
request-parameters: Public ordinary functions
reset-html-parts-set: Public ordinary functions

S
safe-apply: Public ordinary functions
safe-funcall: Public ordinary functions
safe-getf: Public ordinary functions
safe-subseq: Public ordinary functions
set-html-part-children: Private ordinary functions
slot-equal: Public ordinary functions
slot-value-by-path: Public ordinary functions
slurp-file: Public ordinary functions
stable-set-difference: Public ordinary functions
symbol-status: Public ordinary functions

T
translate: Public ordinary functions

U
update-current-html-part-children: Private ordinary functions
update-html-parts-connections: Public ordinary functions

W
wexport: Private ordinary functions
with-file-write: Public macros
write-to-file: Public ordinary functions


A.4 Data types

Jump to:   C   F   H   I   L   M   P   S   T   U   W  
Index Entry  Section

C
clos.lisp: The weblocks-util/src/utils/clos․lisp file

F
File, clos.lisp: The weblocks-util/src/utils/clos․lisp file
File, html-parts.lisp: The weblocks-util/src/utils/html-parts․lisp file
File, i18n.lisp: The weblocks-util/src/utils/i18n․lisp file
File, list.lisp: The weblocks-util/src/utils/list․lisp file
File, misc.lisp: The weblocks-util/src/utils/misc․lisp file
File, templates.lisp: The weblocks-util/src/utils/templates․lisp file
File, util.lisp: The weblocks-util/src/util․lisp file
File, weblocks-util.asd: The weblocks-util/weblocks-util․asd file

H
html-parts.lisp: The weblocks-util/src/utils/html-parts․lisp file

I
i18n.lisp: The weblocks-util/src/utils/i18n․lisp file

L
list.lisp: The weblocks-util/src/utils/list․lisp file

M
misc.lisp: The weblocks-util/src/utils/misc․lisp file
Module, src: The weblocks-util/src module
Module, utils: The weblocks-util/src/utils module

P
Package, weblocks-util: The weblocks-util package
Package, weblocks-util-asd: The weblocks-util-asd package

S
src: The weblocks-util/src module
System, weblocks-util: The weblocks-util system

T
templates.lisp: The weblocks-util/src/utils/templates․lisp file

U
util.lisp: The weblocks-util/src/util․lisp file
utils: The weblocks-util/src/utils module

W
weblocks-util: The weblocks-util system
weblocks-util: The weblocks-util package
weblocks-util-asd: The weblocks-util-asd package
weblocks-util.asd: The weblocks-util/weblocks-util․asd file