awful-static-pages provides a library and a command line application to generate static pages out of awful dynamic pages which respond to the GET method.
- awful (>= 0.40.0)
generate-static-pages![procedure] (generate-static-pages! directory #!key resources)
Generates static pages into directory based on the resources resources table. If resources is not provided, awful's resources table is used.
index-file[parameter] (index-file ["index.html"])
The default index file to be created when the resource is a directory.
The default is "index.html".
request-pages[parameter] (request-pages ['()])
A list of page paths to be requested. That's useful when you have resource matches which can match an arbitrary (possibly infinite) number of inputs. For example, matches implemented as regexes or procedures.
The default value is '().
Command line tool
The command line tool is basically a wrapper over generate-static-pages!:
$ awful-static-pages --help Usage: awful-static-pages [ --config=<config file> ] <app1 app2 ... appn> <output dir>
Here's an usage example:
$ cat test-app.scm
(use awful regex srfi-13) (define-page "/foo" (lambda () "foo")) (define-page "/bar" (lambda () "bar")) (define-page "/baz" (lambda () "baz")) (define-page "/1/2/3/4" (lambda () "4")) (define-page (regexp "/regex/[0-9]") (lambda (path) (->string path))) (define-page (lambda (path) (and (string-prefix? "/procedure" path) (list path))) (lambda (path) path))
$ cat test-conf.scm
(use awful-static-pages) (request-pages '("/regex/3" "/regex/7" "/procedure/foo" ))
$ awful-static-pages --config=test-conf.scm test-app.scm static Writing static/baz/index.html Writing static/foo/index.html Writing static/procedure/foo/index.html Writing static/bar/index.html Writing static/regex/3/index.html Writing static/regex/7/index.html Writing static/1/2/3/4/index.html
Copyright (c) 2014, 2015 Mario Domenech Goulart All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Make awful-static-pages compatible with both awful's resource table formats (0.42.0 and previous)
- Fixed build of the command line application and tests
- Initial release