source: project/wiki/eggref/4/awful-static-pages @ 32775

Last change on this file since 32775 was 32775, checked in by Mario Domenech Goulart, 5 years ago

awful-static-pages (wiki): release note for version 0.1.3

File size: 4.3 KB
Line 
1[[tags: egg awful-static-pages]]
2
3== awful-static-pages
4
5[[toc:]]
6
7=== Introduction
8
9awful-static-pages provides a library and a command line application
10to generate static pages out of awful dynamic pages which respond to
11the GET method.
12
13=== Author
14
15[[http://wiki.call-cc.org/users/mario-domenech-goulart|Mario Domenech Goulart]]
16
17=== Repository
18
19[[https://github.com/mario-goulart/awful-static-pages|https://github.com/mario-goulart/awful-static-pages]]
20
21=== Requirements
22
23* [[/egg/awful|awful]] (>= 0.40.0)
24
25=== Library API
26
27==== Procedure
28
29===== {{generate-static-pages!}}
30<procedure>(generate-static-pages! directory #!key resources)</procedure>
31
32Generates static pages into {{directory}} based on the {{resources}}
33resources table.  If {{resources}} is not provided,
34[[/egg/awful#awful-resources-table|awful's resources table]] is used.
35
36
37==== Parameters
38
39===== {{index-file}}
40<parameter>(index-file ["index.html"])</parameter>
41
42The default index file to be created when the resource is a directory.
43
44The default is {{"index.html"}}.
45
46
47===== {{request-pages}}
48<parameter>(request-pages ['()])</parameter>
49
50A list of page paths to be requested.  That's useful when you have
51resource matches which can match an arbitrary (possibly infinite)
52number of inputs.  For example, matches implemented as regexes or
53procedures.
54
55The default value is {{'()}}.
56
57
58=== Command line tool
59
60The command line tool is basically a wrapper over {{generate-static-pages!}}:
61
62  $ awful-static-pages --help
63  Usage: awful-static-pages [ --config=<config file> ] <app1 app2 ... appn> <output dir>
64
65Here's an usage example:
66
67  $ cat test-app.scm
68<enscript highlight=scheme>
69(use awful regex srfi-13)
70
71(define-page "/foo"
72  (lambda ()
73    "foo"))
74
75(define-page "/bar"
76  (lambda ()
77    "bar"))
78
79(define-page "/baz"
80  (lambda ()
81    "baz"))
82
83(define-page "/1/2/3/4"
84  (lambda ()
85    "4"))
86
87(define-page (regexp "/regex/[0-9]")
88  (lambda (path)
89    (->string path)))
90
91(define-page
92  (lambda (path)
93    (and (string-prefix? "/procedure" path)
94         (list path)))
95  (lambda (path)
96    path))
97</enscript>
98
99  $ cat test-conf.scm
100<enscript highlight=scheme>
101(use awful-static-pages)
102
103(request-pages
104 '("/regex/3"
105   "/regex/7"
106   "/procedure/foo"
107   ))
108</enscript>
109
110  $ awful-static-pages --config=test-conf.scm test-app.scm static
111  Writing static/baz/index.html
112  Writing static/foo/index.html
113  Writing static/procedure/foo/index.html
114  Writing static/bar/index.html
115  Writing static/regex/3/index.html
116  Writing static/regex/7/index.html
117  Writing static/1/2/3/4/index.html
118
119
120=== License
121
122  Copyright (c) 2014, 2015 Mario Domenech Goulart
123  All rights reserved.
124 
125  Redistribution and use in source and binary forms, with or without
126  modification, are permitted provided that the following conditions
127  are met:
128  1. Redistributions of source code must retain the above copyright
129     notice, this list of conditions and the following disclaimer.
130  2. Redistributions in binary form must reproduce the above copyright
131     notice, this list of conditions and the following disclaimer in the
132     documentation and/or other materials provided with the distribution.
133  3. The name of the authors may not be used to endorse or promote products
134     derived from this software without specific prior written permission.
135 
136  THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
137  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
138  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
139  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
140  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
141  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
142  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
143  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
144  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
145  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
146  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
147
148
149=== Version history
150
151==== Version 0.1.3
152
153* Sort resources to get a deterministic order when writing files
154
155==== Version 0.1.2
156
157* Make awful-static-pages compatible with both awful's resource table formats (0.42.0 and previous)
158
159==== Version 0.1.1
160
161* Fixed build of the command line application and tests
162
163==== Version 0.1.0
164
165* Initial release
166
Note: See TracBrowser for help on using the repository browser.