Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

awful-static-pages

  1. Outdated egg!
  2. awful-static-pages
    1. Introduction
    2. Author
    3. Repository
    4. Requirements
    5. Library API
      1. Procedure
        1. generate-static-pages!
      2. Parameters
        1. index-file
        2. request-pages
    6. Command line tool
    7. License
    8. Version history
      1. Version 0.1.6
      2. Version 0.1.5
      3. Version 0.1.4
      4. Version 0.1.3
      5. Version 0.1.2
      6. Version 0.1.1
      7. Version 0.1.0

Introduction

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.

Author

Mario Domenech Goulart

Repository

https://github.com/mario-goulart/awful-static-pages

Requirements

Library API

Procedure

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.

Parameters

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

License

 Copyright (c) 2014-2018 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.

Version history

Version 0.1.6

Version 0.1.5

Version 0.1.4

Version 0.1.3

Version 0.1.2

Version 0.1.1

Version 0.1.0