/*
Copyright:
(C) 2022-2023 Daniele 'dzonerzy' Linguaglossa - http://libdzonerzy.so
This file is part of libdzonerzy.so.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
*/
#pragma once
#define _GNU_SOURCE
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define EXPORT_SYMBOL(return, name) __attribute__((visibility("default"))) return name
#define HIDE_SYMBOL __attribute__((visibility("hidden")))
#define SECTION(x) __attribute__((section(x)))
// section name should be like "articles/article_name.md"
#define ARTICLE(x) SECTION("articles/" x ".md")
// section name should be like "pages/page_name.md"
#define PAGE(x) SECTION("pages/" x ".md")
/* CSS macros */
// comment macros
#define CSS_COMMENT(x) "/* " x " */\n"
// property macros
#define CSS_PROPERTY(n, v) " " n ": " v ";\n"
// property macros with unescaped values
#define CSS_PROPERTY_UNESCAPED(n, v) " " n " : " v ";\n"
// selector macros
#define CSS_SELECTOR(n) n "{\n"
// end selector macros
#define CSS_END_SELECTOR() "}\n"
// rgb macros
#define CSS_RGB(r, g, b) "rgb(" #r "," #g "," #b ")"
// rgba macros
#define CSS_RGBA(r, g, b, a) "rgba(" #r "," #g "," #b "," #a ")"
// hsl macros
#define CSS_HSL(h, s, l) "hsl(" #h "," #s "," #l ")"
// hsla macros
#define CSS_HSLA(h, s, l, a) "hsla(" #h "," #s "," #l "," #a ")"
// url macros
#define CSS_URL(x) "url(" #x ")"
// new line macros
#define CSS_NEWLINE() "\n"
/* MD macros */
// meta info
#define MD_META(title, author) "% " title "\n" \
"% " author "\n"
#define MD_META_CUSTOM(v) "% " v "\n"
#define MD_META_NAMED(p, v) "% " p ": " v "\n"
#define MD_COMMENT(x) "\n"
// section macros from 1 to 4
#define MD_SECTION1(x) "# " x "\n"
#define MD_SECTION2(x) "## " x "\n"
#define MD_SECTION3(x) "### " x "\n"
#define MD_SECTION4(x) "#### " x "\n"
// bold macros
#define MD_BOLD(x) "**" x "**"
// italic macros
#define MD_ITALIC(x) "*" x "*"
// link macros
#define MD_LINK(x, y) "[" x "](" y ")"
// image macros
#define MD_IMAGE(x, y) "![" x "](" y ")\n\n"
// image macros with attributes
#define MD_IMAGE_ATTR(x, y, a, v) "![" x "](" y "){" a "=\"" v "\"}\n\n"
// raw html tag macros
#define MD_RAWTAG(t, c) "<" t ">" c "" t ">"
// new line macros
#define MD_NEWLINE() "\n\n"
// code macros
#define MD_CODE(x) "`" x "`"
// code block macros
#define MD_CODEBLOCK(x) "```" x "```"
// start/end a code block macros
#define MD_CODEBLOCK_TICKS(x) "\n```" x "\n"
// code block macros with language
#define MD_CODEBLOCK_LANG(l, c) "```" l "\n" c "\n```"
// text macros
#define MD_TEXT(x) x
// list macros
#define MD_LIST(x) "- " x "\n"
// XML macros
// urlset macros
#define XML_URLSET() "\n"
// url macros
#define XML_URL(x) " \n" \
" " x "\n" \
" " __DATE__ "\n" \
" \n"
// end urlset macros
#define XML_END_URLSET() "\n"
// HTML macros
// html tag macros
#define HTML_TAG(t, c) "<" t ">\n" c "" t ">\n"
// html tag macros open
#define HTML_TAG_OPEN(t, a) "<" t " " a ">\n"
// html tag macros with attributes and content
#define HTML_TAG_OPEN_CONTENT(t, a, c) "<" t " " a ">\n" c "" t ">\n"
// html tag macros close
#define HTML_TAG_CLOSE(t) "" t ">"
// html raw text macros
#define HTML_RAWTEXT(x) x
// html new line macros
#define HTML_NEWLINE() "\n"