aboutsummaryrefslogtreecommitdiffstats
path: root/man/blogc.1.ronn
blob: 8bcd12d522666a1a0d194c27b846b87077c91bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
blogc(1) -- a blog compiler
===========================

## SYNOPSIS

`blogc` [`-d`] [`-D` <KEY>=<VALUE> ...] `-t` <TEMPLATE> [`-o` <OUTPUT>] <SOURCE><br>
`blogc` `-l` [`-e` <SOURCE>] [`-d`] [`-D` <KEY>=<VALUE> ...] `-t` <TEMPLATE> [`-o` <OUTPUT>] [<SOURCE> ...]<br>
`blogc` `-l` [`-e` <SOURCE>] [`-d`] [`-D` <KEY>=<VALUE> ...] `-t` <TEMPLATE> [`-o` <OUTPUT>] [<SOURCE> ...]<br>
`blogc` `-l` [`-e` <SOURCE>] `-p` <KEY> [`-d`] [`-D` <KEY>=<VALUE> ...] [<SOURCE> ...]<br>
`blogc` `-i` [`-d`] [`-D` <KEY>=<VALUE> ...] `-t` <TEMPLATE> [`-o` <OUTPUT>] &lt; <FILE_LIST><br>
`blogc` `-i` `-l` [`-e` <SOURCE>] [`-d`] [`-D` <KEY>=<VALUE> ...] `-t` <TEMPLATE> [`-o` <OUTPUT>] &lt; <FILE_LIST><br>
`blogc` `-i` `-l` [`-e` <SOURCE>] `-p` <KEY> [`-d`] [`-D` <KEY>=<VALUE> ...] &lt; <FILE_LIST><br>
`echo` `-e` "<SOURCE>\n..." | `blogc` `-i` [`-d`] [`-D` <KEY>=<VALUE> ...] `-t` <TEMPLATE> [`-o` <OUTPUT>]<br>
`echo` `-e` "<SOURCE>\n..." | `blogc` `-i` `-l` [`-e` <SOURCE>] [`-d`] [`-D` <KEY>=<VALUE> ...] `-t` <TEMPLATE> [`-o` <OUTPUT>]<br>
`echo` `-e` "<SOURCE>\n..." | `blogc` `-i` `-l` [`-e` <SOURCE>] `-p` <KEY> [`-d`] [`-D` <KEY>=<VALUE> ...]<br>
`blogc` [`-h`|`-v`]

## DESCRIPTION

**blogc** compiles source files and templates into blog/website resources. It
gets one (or more) source files and a template, and generates an output file,
based on the template and the content read from the source file(s). It was
designed to be used with make(1).

`blogc` works on two modes:

  * `entry`:
    Default mode, first example in [SYNOPSIS][]. Accepts only one source
    file, and process it as a single entry of the blog/website, like a static
    page or a post.

  * `listing`:
    Listing mode, second example in [SYNOPSIS][], activated when calling `blogc`
    with `-l` option. Accepts multiple source files, and allow users to iterate
    over the content of all the source files to produce listing pages, like
    indexes and feeds. By providing another source file to `blogc` with `-e`
    option, third example in [SYNOPSIS][], its content will be available for usage
    during listing, similar to the default entry mode. This is useful for users
    that want to have an index page with content and posts listing together.
    See blogc-template(7) for details.

## OPTIONS

  * `-d`:
    Activates debug.

  * `-i`:
    Reads list of source files from standard input. Content of standard input is
    parsed as a file where each line is a file path. Empty lines and lines
    starting with `#` are ignored. If some source files are provided to command
    line while using this option, they will be parsed **before** the files read
    from standard input.

  * `-l`:
    Activates listing mode, allowing user to provide multiple source files. See
    blogc-source(7) for details.

  * `-e` <SOURCE>:
    When used together with `-l` the source file will be parsed and its content
    will be made available for usage in the templates in listing mode. See
    blogc-template(7) for details.

  * `-D` <KEY>=<VALUE>:
    Set global configuration parameter. <KEY> must be an ascii uppercase string,
    with only letters, numbers (after the first letter) and underscores (after
    the first letter). These parameters are available anywhere in templates,
    but may be overridden by local configuration parameters set in source files.
    See blogc-template(7) for details.

  * `-p` <KEY>:
    Show the value of a variable right after the source parsing and exits. This
    is useful to get parameters for your `Makefile`, like the last page when
    implementing pagination, see blogc-pagination(7) for details. This option can
    also dump variables defined in a source file, if called without `-l`.
    Please note that variables generated by blogc during rendering process, like
    `BLOGC_RUSAGE_MEMORY` are not available, because blogc will exit without
    rendering any content when called with this option, and will not even require
    a template. However, variables generated during parsing process, like
    `CONTENT` are available.

  * `-t` <TEMPLATE>:
    Template file. It is a required option, if `blogc` needs to render something.
    See blogc-template(7) for details.

  * `-o` <OUTPUT>:
    Output file. If provided this option, save the compiled output to the given
    file. Otherwise, the compiled output is sent to `stdout`.

  * `-v`:
    Show program name, version and exit.

  * `-h`:
    Show help message and exit.

## FILES

The `blogc` command expects a template file blogc-template(7), one (or more)
source files blogc-source(7) and an output file, if wanted. Templates and source
files must have valid UTF-8 content.

## ENVIRONMENT

No environment variables are required by `blogc`, but global timezone will
be used by locale-dependant datetime input field descriptors (like `%c`), and
can be overridden using environment variables. See strftime(3).

## EXAMPLES

Build index from source files:

    $ blogc -l -t template.tmpl -o index.html source1.txt source2.txt source3.txt

Build index from source files, with additional content from `index.txt`:

    $ blogc -l -e index.txt -t template.tmpl -o index.html source1.txt source2.txt source3.txt

Build entry page from source file:

    $ blogc -t template.tmpl -o entry.html entry.txt

## BUGS

**blogc** is based in handwritten parsers, that even being well tested, may be
subject of parsing bugs. Please report any issues to:
<https://github.com/blogc/blogc>

## AUTHOR

Rafael G. Martins &lt;<rafael@rafaelmartins.eng.br>&gt;

## SEE ALSO

blogc-source(7), blogc-template(7), blogc-pagination(7) make(1), strftime(3)