The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

#define MAX_TAGNAMELENGTH 20
#define MAX_STRIPTAGS 20

typedef struct Stripper {
  int f_in_tag;
  int f_closing;
  int f_lastchar_slash;

  char tagname[MAX_TAGNAMELENGTH];
  char * p_tagname;
  char f_full_tagname;

  int f_outputted_space;
  int f_just_seen_tag;

  int f_in_quote;
  char quote;

  int f_in_decl;
  int f_in_comment;
  int f_lastchar_minus;

  int f_in_striptag;
  char striptag[MAX_TAGNAMELENGTH];
  char o_striptags[MAX_STRIPTAGS][MAX_TAGNAMELENGTH];
  int numstriptags;
  int o_emit_spaces;
} Stripper;

void strip_html( Stripper * stripper, const char * raw, char * clean );
void reset( Stripper * stripper );
void clear_striptags( Stripper * stripper );
void add_striptag( Stripper * stripper, char * tag );
void set_emit_spaces( Stripper * stripper, int emit );

void check_end( Stripper * stripper, char );