Tiffy is a static website generator that uses Lizard markup files to create a website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 lines
748 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "layout.h"
#include "files.h"
int getLayout( char * f, Layout * layout ) {
char * lfile = NULL;
readfile( f, &lfile );
if ( lfile == NULL) {
perror( "Malloc in parse layout failed." );
exit( EXIT_FAILURE );
}
int index = 0;
while ( lfile[ index ] != '\0' ) {
if ( lfile[ index ] == '{' && lfile[ index + 1 ] == '{' ) {
lfile[ index ] = '\0';
sprintf( layout->top, "%s", lfile );
index++;
while ( lfile[ index ] != '\0' ) {
if ( lfile[ index ] == '}' && lfile[ index + 1 ] == '}' ) {
sprintf( layout->bottom, "%s", &lfile[ index + 2 ] );
return 1;
}
index++;
}
}
index++;
}
return 0;
}