| 62 |
return 0; |
return 0; |
| 63 |
} |
} |
| 64 |
|
|
| 65 |
|
#define LML_TAG_QUOTE_MAX_LEVEL 10 |
| 66 |
|
#define LML_TAG_QUOTE_LEVEL_LOOP 3 |
| 67 |
|
|
| 68 |
|
static const char *lml_tag_quote_color[] = { |
| 69 |
|
"\033[33m", |
| 70 |
|
"\033[32m", |
| 71 |
|
"\033[35m", |
| 72 |
|
}; |
| 73 |
|
|
| 74 |
|
static int lml_tag_quote_level = 0; |
| 75 |
|
|
| 76 |
|
static int lml_tag_quote_filter(const char *tag_name, const char *tag_param_buf, char *tag_output_buf, size_t tag_output_buf_len) |
| 77 |
|
{ |
| 78 |
|
|
| 79 |
|
if (strcasecmp(tag_name, "quote") == 0) |
| 80 |
|
{ |
| 81 |
|
if (lml_tag_quote_level <= LML_TAG_QUOTE_MAX_LEVEL) |
| 82 |
|
{ |
| 83 |
|
lml_tag_quote_level++; |
| 84 |
|
} |
| 85 |
|
return snprintf(tag_output_buf, tag_output_buf_len, lml_tag_quote_color[lml_tag_quote_level % LML_TAG_QUOTE_LEVEL_LOOP]); |
| 86 |
|
} |
| 87 |
|
else if (strcasecmp(tag_name, "/quote") == 0) |
| 88 |
|
{ |
| 89 |
|
if (lml_tag_quote_level > 0) |
| 90 |
|
{ |
| 91 |
|
lml_tag_quote_level--; |
| 92 |
|
} |
| 93 |
|
if (lml_tag_quote_level > 0) |
| 94 |
|
{ |
| 95 |
|
return snprintf(tag_output_buf, tag_output_buf_len, lml_tag_quote_color[lml_tag_quote_level % LML_TAG_QUOTE_LEVEL_LOOP]); |
| 96 |
|
} |
| 97 |
|
else |
| 98 |
|
{ |
| 99 |
|
return snprintf(tag_output_buf, tag_output_buf_len, "\033[m"); |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
return 0; |
| 104 |
|
} |
| 105 |
|
|
| 106 |
const static char *LML_tag_def[][3] = { |
const static char *LML_tag_def[][3] = { |
| 107 |
{"left", "[", ""}, |
{"left", "[", ""}, |
| 108 |
{"right", "]", NULL}, |
{"right", "]", NULL}, |
| 120 |
{"/u", "\033[24m", NULL}, |
{"/u", "\033[24m", NULL}, |
| 121 |
{"color", NULL, (const char *)lml_tag_color_filter}, |
{"color", NULL, (const char *)lml_tag_color_filter}, |
| 122 |
{"/color", "\033[m", NULL}, |
{"/color", "\033[m", NULL}, |
| 123 |
|
{"quote", NULL, (const char *)lml_tag_quote_filter}, |
| 124 |
|
{"/quote", NULL, (const char *)lml_tag_quote_filter}, |
| 125 |
{"url", "", ""}, |
{"url", "", ""}, |
| 126 |
{"/url", "(Á´½Ó: %s)", NULL}, |
{"/url", "(Á´½Ó: %s)", NULL}, |
| 127 |
{"link", "", ""}, |
{"link", "", ""}, |
| 137 |
{"bwf", "\033[1;31m****\033[m", ""}, |
{"bwf", "\033[1;31m****\033[m", ""}, |
| 138 |
}; |
}; |
| 139 |
|
|
| 140 |
#define LML_TAG_COUNT 29 |
#define LML_TAG_COUNT 31 |
| 141 |
|
|
| 142 |
static int LML_tag_name_len[LML_TAG_COUNT]; |
static int LML_tag_name_len[LML_TAG_COUNT]; |
| 143 |
static int LML_init = 0; |
static int LML_init = 0; |
| 171 |
|
|
| 172 |
lml_init(); |
lml_init(); |
| 173 |
|
|
| 174 |
|
lml_tag_quote_level = 0; |
| 175 |
|
|
| 176 |
for (i = 0; str_in[i] != '\0'; i++) |
for (i = 0; str_in[i] != '\0'; i++) |
| 177 |
{ |
{ |
| 178 |
if (str_in[i] == '[') |
if (str_in[i] == '[') |