aboutsummaryrefslogtreecommitdiffstats
path: root/src/directives.h
blob: dd27f03fcf927986b86c67e1f1a373452b44bbe6 (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
/*
 * blogc: A blog compiler.
 * Copyright (C) 2015 Rafael G. Martins <rafael@rafaelmartins.eng.br>
 *
 * This program can be distributed under the terms of the BSD License.
 * See the file LICENSE.
 */

#ifndef _DIRECTIVES_H
#define _DIRECTIVES_H

#include "utils/utils.h"
#include "error.h"

typedef struct {
    const char *name;
    const char *argument;
    b_trie_t *params;
    const char *eol;
} blogc_directive_ctx_t;

typedef char* (*blogc_directive_func_t)(blogc_directive_ctx_t *ctx,
    blogc_error_t **err);

typedef struct {
    const char *name;
    blogc_directive_func_t callback;
} blogc_directive_t;

char* blogc_directive_loader(blogc_directive_ctx_t *ctx, blogc_error_t **err);


// built-in directives (that are everything we support right now
char* blogc_directive_youtube(blogc_directive_ctx_t *ctx, blogc_error_t **err);

#endif /* _DIRECTIVES_H */