Added paragraph, image and link detection to porcess_md function. Refactored code a bit
This commit is contained in:
29
include/articles_op/article.h
Normal file
29
include/articles_op/article.h
Normal 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
|
23
include/articles_op/process_md.h
Normal file
23
include/articles_op/process_md.h
Normal 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
|
@ -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
|
@ -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
|
Reference in New Issue
Block a user