/[LeafOK_CVS]/lbbs/src/lml.c
ViewVC logotype

Diff of /lbbs/src/lml.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.23 by sysadm, Sat Oct 18 13:22:52 2025 UTC Revision 1.25 by sysadm, Fri Oct 24 03:57:45 2025 UTC
# Line 106  static int lml_tag_disable_filter(const Line 106  static int lml_tag_disable_filter(const
106          return snprintf(tag_output_buf, tag_output_buf_len, "%s", (quote_mode ? "[plain]" : ""));          return snprintf(tag_output_buf, tag_output_buf_len, "%s", (quote_mode ? "[plain]" : ""));
107  }  }
108    
109    static int lml_tag_user_disabled = 0;
110    
111    static int lml_tag_user_disable_filter(const char *tag_name, const char *tag_param_buf, char *tag_output_buf, size_t tag_output_buf_len, int quote_mode)
112    {
113            lml_tag_user_disabled = 1;
114            tag_output_buf[0] = '\0';
115            return 0;
116    }
117    
118    static int lml_tag_user_enable_filter(const char *tag_name, const char *tag_param_buf, char *tag_output_buf, size_t tag_output_buf_len, int quote_mode)
119    {
120            lml_tag_user_disabled = 0;
121            tag_output_buf[0] = '\0';
122            return 0;
123    }
124    
125  typedef struct lml_tag_def_t  typedef struct lml_tag_def_t
126  {  {
127          const char *tag_name; // tag name          const char *tag_name; // tag name
# Line 118  typedef struct lml_tag_def_t Line 134  typedef struct lml_tag_def_t
134  const LML_TAG_DEF lml_tag_def[] = {  const LML_TAG_DEF lml_tag_def[] = {
135          // Definition of tuple: {lml_tag, lml_output, default_param, quote_mode_output, lml_filter_cb}          // Definition of tuple: {lml_tag, lml_output, default_param, quote_mode_output, lml_filter_cb}
136          {"plain", NULL, NULL, NULL, lml_tag_disable_filter},          {"plain", NULL, NULL, NULL, lml_tag_disable_filter},
137            {"nolml", NULL, NULL, NULL, lml_tag_user_disable_filter},
138            {"lml", NULL, NULL, NULL, lml_tag_user_enable_filter},
139          {"left", "[", "", "[left]", NULL},          {"left", "[", "", "[left]", NULL},
140          {"right", "]", "", "[right]", NULL},          {"right", "]", "", "[right]", NULL},
141          {"bold", "\033[1m", "", "", NULL}, // does not work in Fterm          {"bold", "\033[1m", "", "", NULL}, // does not work in Fterm
# Line 151  const LML_TAG_DEF lml_tag_def[] = { Line 169  const LML_TAG_DEF lml_tag_def[] = {
169          {"bwf", "\033[1;31m****\033[m", "", "****", NULL},          {"bwf", "\033[1;31m****\033[m", "", "****", NULL},
170  };  };
171    
172  #define LML_TAG_COUNT 32  #define LML_TAG_COUNT (sizeof(lml_tag_def) / sizeof(LML_TAG_DEF))
173    
174  static int lml_tag_name_len[LML_TAG_COUNT];  static int lml_tag_name_len[LML_TAG_COUNT];
175  static int lml_ready = 0;  static int lml_ready = 0;
# Line 189  int lml_render(const char *str_in, char Line 207  int lml_render(const char *str_in, char
207          lml_init();          lml_init();
208    
209          lml_tag_disabled = 0;          lml_tag_disabled = 0;
210            lml_tag_user_disabled = 0;
211          lml_tag_quote_level = 0;          lml_tag_quote_level = 0;
212    
213          for (i = 0; str_in[i] != '\0'; i++)          for (i = 0; str_in[i] != '\0'; i++)
# Line 308  int lml_render(const char *str_in, char Line 327  int lml_render(const char *str_in, char
327                                                                  strncpy(tag_param_buf, lml_tag_def[k].default_param, LML_TAG_PARAM_BUF_LEN - 1);                                                                  strncpy(tag_param_buf, lml_tag_def[k].default_param, LML_TAG_PARAM_BUF_LEN - 1);
328                                                                  tag_param_buf[LML_TAG_PARAM_BUF_LEN - 1] = '\0';                                                                  tag_param_buf[LML_TAG_PARAM_BUF_LEN - 1] = '\0';
329                                                          }                                                          }
330                                                          if (!quote_mode)                                                          if (!quote_mode && !lml_tag_user_disabled)
331                                                          {                                                          {
332                                                                  if (lml_tag_def[k].tag_output != NULL)                                                                  if (lml_tag_def[k].tag_output != NULL)
333                                                                  {                                                                  {
# Line 324  int lml_render(const char *str_in, char Line 343  int lml_render(const char *str_in, char
343                                                                          tag_output_len = 0;                                                                          tag_output_len = 0;
344                                                                  }                                                                  }
345                                                          }                                                          }
346                                                          else // quote mode                                                          else // if (quote_mode || lml_tag_user_disabled)
347                                                          {                                                          {
348                                                                  if (lml_tag_def[k].quote_mode_output != NULL)                                                                  if (lml_tag_def[k].quote_mode_output != NULL)
349                                                                  {                                                                  {


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1