Changeset 33741 in project


Ignore:
Timestamp:
11/13/16 10:07:23 (8 months ago)
Author:
mario
Message:

awful (wiki): update doc with changes from git

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/awful

    r32309 r33741  
    15531553been introduced in awful version 0.40.0.
    15541554
     1555Note that {{$db}} is supposed to be used in the context of request
     1556handlers (i.e., in the body of a lambda bound to a uri path by
     1557{{define-page}}).
     1558
     1559If you want to use {{$db}} out of the context of request handlers,
     1560you'll have to manage database connections yourself.  Basically, you
     1561have to parameterize {{db-connection}} with the actual connection
     1562object.  Example:
     1563
     1564<enscript highlight=scheme>
     1565(parameterize ((db-connection (open-database (db-credentials))))
     1566  ($db the-query)
     1567  (close-database (db-connection)))
     1568</enscript>
     1569
    15551570
    15561571===== {{$db-row-obj}}
     
    15811596
    15821597===== {{define-page}}
    1583 <procedure>(define-page path-matcher handler #!key css title doctype headers charset no-ajax use-ajax no-template no-session no-db no-javascript-compression method use-sxml strict)</procedure>
     1598<procedure>(define-page path-matcher handler #!key css title doctype headers charset no-ajax use-ajax no-template no-session no-db no-javascript-compression method use-sxml vhost-root-path strict)</procedure>
    15841599
    15851600Define an awful page.
     
    15911606
    15921607
    1593 {{handler}} should return either a string or a no-argument procedure.
    1594 If it returns a string, it will be given as argument to
    1595 {{(page-template)}}, unless {{no-template}} is not false. If
    1596 {{handler}} returns a procedure (feature introduced in awful 0.35),
    1597 awful won't do anything besides evaluating the returned procedure.  It
    1598 can be useful, for example, to serve static files out of the web
    1599 server document directory (see the examples in this section).
     1608{{handler}} should return either a string, a no-argument procedure or
     1609a list (in case SXML mode is enabled -- SXML support has been
     1610introduced in awful 0.36).  If it returns a string, it will be given
     1611as argument to {{(page-template)}}, unless {{no-template}} is not
     1612false. If {{handler}} returns a procedure (feature introduced in awful
     16130.35), awful won't do anything besides evaluating the returned
     1614procedure.  It can be useful, for example, to serve static files out
     1615of the web server document directory (see the examples in this
     1616section). If {{handler}} produces a list, awful or the particular page
     1617in question must be operating in SXML mode, which can be set via the
     1618{{enable-sxml}} parameter or via de {{use-sxml}} keywork parameter for
     1619{{define-page}}.  The list produced by the handler will be given as
     1620argument to the procedure yield by the {{sxml->html}} parameter.
    16001621
    16011622{{use-sxml}} (boolean): specifies whether awful should assume that the
     
    16341655not {{#f}}.
    16351656
     1657{{vhost-root-path}} (a string or {{#f}}) is the root path of the
     1658virtual host the page definition is to be applied to.  If
     1659{{vhost-root-path}} is set to a path, the page definition will only be
     1660valid for the virtual host whose root path is the given path.
     1661
    16361662If {{strict}} is truthy, awful will only match the requested path if
    16371663it strictly matches the defined matchers.  For convenience, awful
     
    16491675{{(irregex "/[^/]*")}}, even if the regex specified that paths with a
    16501676trailing slash should not match.
    1651 
    16521677
    16531678Examples:
     
    18021827
    18031828Generate JavaScript code to be added to the page defined by
    1804 {{define-page}}.  Return the generated JavaScript code (which usually
    1805 is not useful, so should be discarded).
     1829{{define-page}}.  Return the generated JavaScript code. Unless
     1830{{no-page-javascript}} is a truthy value, the JavaScript code will be
     1831added to the page in which case the returned JavaScript code is
     1832usually not useful and can be discarded.
    18061833
    18071834{{path}} is the URL path (a string) of the server side handler. This
     
    19411968jQuery.ajax
    19421969([[http://api.jquery.com/jQuery.ajax/|http://api.jquery.com/jQuery.ajax/]]).
     1970
     1971The {{no-page-javascript}} keyword parameter is a boolean that
     1972determines whether the generated JavaScript code is automatically
     1973added to the page or not.  Defaults to {{#f}}. This parameter may be
     1974useful if you want more control of where or when the generated
     1975JavaScript code gets added to the page or even if it gets added at
     1976all.
    19431977
    19441978The {{ajax}} procedure is session, HTTP request and database -aware.
     
    31553189=== License
    31563190
    3157   Copyright (c) 2010-2014, Mario Domenech Goulart
     3191  Copyright (c) 2010-2016, Mario Domenech Goulart
    31583192  All rights reserved.
    31593193 
Note: See TracChangeset for help on using the changeset viewer.