templates/README.md
changeset 98 dd260cff924e
parent 94 4c0206d283e5
child 120 54b6f2a4098b
equal deleted inserted replaced
97:ce979580711a 98:dd260cff924e
    11 environment variable.\
    11 environment variable.\
    12 If set, template files are looked up relatively from this repository first
    12 If set, template files are looked up relatively from this repository first
    13 (unless they are absolute paths or start with "./" or "../").
    13 (unless they are absolute paths or start with "./" or "../").
    14 
    14 
    15 The themes are located in the `themes` directory, inside the base template
    15 The themes are located in the `themes` directory, inside the base template
    16 directory.
    16 directory (e.g. `$template_directory/themes/ansi/`).
    17 A theme is a collection of templates grouped in a theme directory (the name of
    17 A theme is a collection of templates grouped in a theme directory (the name of
    18 the directory is the name of the theme).\
    18 the directory is the name of the theme).
    19 E.g. `$template_directory/themes/ansi/`
       
    20 
    19 
    21 ## Themes
    20 ## Themes
    22 
    21 
    23 To use a theme, simply specify the theme name with the --theme flag (the
    22 To use a theme, simply specify the theme name with the --theme flag (the
    24 --output=theme flag is implied):
    23 --output=theme flag is implied):
    43 Here's a list of available commands (please check the Go template documentation for the built-in functions):
    42 Here's a list of available commands (please check the Go template documentation for the built-in functions):
    44 - fromunix UNIXTIMESTAMP
    43 - fromunix UNIXTIMESTAMP
    45 - fromhtml HTMLTEXT
    44 - fromhtml HTMLTEXT
    46 - wrap TEXT
    45 - wrap TEXT
    47 - trim TEXT
    46 - trim TEXT
    48 - color COLORSPEC
    47 - color COLORSPEC\
    49   COLORSPEC is a string with the following format: `[FGCOLOR][,BGCOLOR[,STYLE]]` or `reset`.
    48   COLORSPEC is a string with the following format: `[FGCOLOR][,BGCOLOR[,STYLE]]` or `reset`.
    50 
    49 
    51   Examples:
    50 Examples:
    52 
    51 
    53     {{color "red"}}red text{{color "reset"}}
    52 ```
    54     {{color ",red"}}red background{{color "reset"}}
    53   {{color "red"}}red text{{color "reset"}}
    55     {{color "white,,bold"}}bright white text{{color "reset"}}
    54   {{color ",red"}}red background{{color "reset"}}
       
    55   {{color "white,,bold"}}bright white text{{color "reset"}}
    56 
    56 
    57     Message: {{color "blue"}}{{.content | fromhtml | wrap "    " 80 | trim}}{{color "reset"}}
    57   Message: {{color "blue"}}{{.content | fromhtml | wrap "    " 80 | trim}}{{color "reset"}}
       
    58 ```
    58 
    59 
    59 Note that the _wrap_ implementation might change in the future; currently it is
    60 Note that the _wrap_ implementation might change in the future; currently it is
    60 paragraph-based, not line-based, and the result can be surprising after
    61 paragraph-based, not line-based, and the result can be surprising after
    61 _fromhtml_ (carriage returns are ignored).
    62 _fromhtml_ (carriage returns are ignored).