summaryrefslogtreecommitdiff
path: root/src/atom-writer.h
blob: cf900014a637bec95c683b126f3153e78619af8e (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
/*   Cataract - Static web photo gallery generator
 *   Copyright (C) 2010 Tomas Bzatek <tbzatek@users.sourceforge.net>
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version 2
 *   of the License, or any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
#ifndef __ATOM_WRITER_H__
#define __ATOM_WRITER_H__

#include <glib.h>
#include "setup.h"

/*
 *  Resources:
 *     http://tools.ietf.org/html/rfc4287
 *     http://www.atomenabled.org/developers/syndication/
 *     http://feedvalidator.org/
 *     http://diveintomark.org/archives/2004/05/28/howto-atom-id
 *
 */


typedef struct {
  gchar *title;
  gchar *base_url;
  gchar *feed_url;

  GSList *items;
} TAtomFeed;

typedef struct {
  gchar *title;
  gchar *path;           /*  relative path in the gallery structure  */
  gchar *date;           /*  format ISO.8601.1988 yyyy-mm-ddThh:mm:ssZ or yyyy-mm-ddThh:mm:ss+hh:mm (timezone)  */
  gchar *summary;        /*  escaped automatically  */
  gchar *summary_type;   /*  valid values are "text", "html", "xhtml"  */
} TAtomFeedItem;


/*  Global instances  */
TAtomFeed *news_feed;


TAtomFeed *      atom_writer_new ();
void             atom_writer_write_to_file (TAtomFeed *feed, const gchar *filename, TGallerySetup *setup);
void             atom_writer_set_title     (TAtomFeed *feed, const gchar *title);
void             atom_writer_set_base_url  (TAtomFeed *feed, const gchar *base_url);
void             atom_writer_set_feed_url  (TAtomFeed *feed, const gchar *feed_url);
void             atom_writer_free          (TAtomFeed *feed);    /*  will free data of all items  */

TAtomFeedItem *  atom_writer_add_item   (TAtomFeed *feed);
void             atom_feed_item_set_title        (TAtomFeedItem *item, const gchar *title);
void             atom_feed_item_set_path         (TAtomFeedItem *item, const gchar *path);
void             atom_feed_item_set_date         (TAtomFeedItem *item, const gchar *date);
void             atom_feed_item_set_summary      (TAtomFeedItem *item, const gchar *summary);
void             atom_feed_item_set_summary_type (TAtomFeedItem *item, const gchar *summary_type);


#endif /* __ATOM_WRITER_H__ */