/*
* Copyright (C) 2022 luca0N!
*
* This file is part of Static Website Generator (swg).
*
* Static Website Generator (swg) is free software: you can redistribute it
* and/or modify it under the terms of the version 3 of the GNU Lesser General
* Public License as published by the Free Software Foundation.
*
* Static Website Generator (swg) 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 Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Static Website Generator (swg). If not, see
* .
*
* Contact luca0N! by e-mail: .
*/
#include "Article.hxx"
#include
#include
#include
#include "Common.hxx"
enum IterationStage {
CHECKING_TITLE,
READING_TITLE,
CHECKING
};
namespace Article {
/*
* FIXME: The article metadata declaration uses the same INI format as
* swg.cfg. Since they use the exact same format, we could unify the .cfg
* parsing into one function.
*/
void get_metadata(std::string const &path, Metadata *m) {
memset(m, 0, sizeof(Metadata));
FILE *a = fopen(path.c_str(), "r");
int buflen = 16;
char buf[buflen];
const char *det_article = "