Added paragraph, image and link detection to porcess_md function. Refactored code a bit

This commit is contained in:
2020-07-04 14:10:16 +05:00
parent 06ff0761fc
commit 4c61d24352
8 changed files with 388 additions and 228 deletions

View File

@ -0,0 +1,29 @@
#ifndef _ARTICLE_H
#define _ARTICLE_H
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "../../include/file_op/file.h"
#include "../../include/utils_op/utils.h"
#include "../../include/articles_op/process_md.h"
#define LINE_LENGTH 512
#ifndef _ARTICLE_INFO
#define _ARTICLE_INFO
typedef struct
{
char *title;
long time;
char *content;
unsigned long length;
} article_info;
#endif
#endif

View File

@ -0,0 +1,23 @@
#ifndef _PROCESS_MD_H
#define _PROCESS_MD_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifndef _ARTICLE_INFO
#define _ARTICLE_INFO
typedef struct
{
char *title;
long time;
char *content;
unsigned long length;
} article_info;
#endif
int process_md(article_info article, char **out);
#endif

View File

@ -7,6 +7,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
struct file_s
{
@ -18,5 +19,6 @@ struct file_s
char *gen_file_path(char *path);
int send_file(int cli_fd, struct file_s *file);
struct file_s *get_file_info(char *file_path);
size_t get_file_size(FILE *file);
#endif

View File

@ -10,5 +10,6 @@ void err_msg(char *msg);
char *concat_to_front(char **str1, char *str2);
char *get_status_message(int status_code);
char *to_lower(char *str);
char *trim(char *str);
#endif