Aller au contenu principal

generate

Used to generate a file.

GENERATE

NAME

generate - Used to generate a file.

SYNOPSIS

generate (template : template.sn, file : filename, jsmin : true | false, cssmin : true | false, error : true | FALSE, compile : true, delcompile : false)

DESCRIPTION

This function is used to generate a file from a template.

PARAMETERS

Here is the list of parameters:

template
Template to use. The default value is template.sn.
filename
File to generate. No default value. If no filename is specified, return the result of the generate in the result. You cannot have ompile without filename.
jsmin
If jsmin is set to true, then the file is passed threw jsmin compression. If an error occured in the JS (unterminated string), the file is not compress.
cssmin
If cssmin is set to true, then the file is passed threw cssmin compression.
compile
If compile is set to true, the file will be generated in a temporary file in /tmp and this file will be parsed to generate the real file.
 
permissions
This parameter is valid from version 5.148 of Sncode.
This integer parameter is use to specify the permission of the generated file. This parameter is influence by umask value. 
A  numeric  mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1.  Omitted
digits are assumed to be leading zeros.  The first digit selects the set user ID (4) and set group ID (2) and restricted
deletion or sticky (1) attributes.  The second digit selects permissions for the user who owns the file: read (4), write
(2), and execute (1); the third selects permissions for other users in the file’s group, with the same values;  and  the
fourth for other users not in the file’s group, with the same values.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

generate(file:"gen.sn",template:"template4.sn");
generate(delcompile: false, compile: true, file:"gen.snc",template:"template5.sn");

template5.sn {_{
        global a;
        'a=';a;
        a=12;
        "{_{ a="; a; "; ',a from = '; a; }}";
}} \{_{
        for(i=0;i<5;++i) do
                i;
        endfor
}}

SEE ALSO

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

1.1 2019-05-15 laplante@sednove.com From version 5.117, add the possibilities to don't specify the filename

Edit

© 2024 extenso Inc. All rights reserved.