diff --git a/swad_HTML.c b/swad_HTML.c index 5f84df2f..6f6b9877 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -64,6 +64,7 @@ static unsigned HTM_UL_NestingLevel = 0; static unsigned HTM_LI_NestingLevel = 0; static unsigned HTM_A_NestingLevel = 0; static unsigned HTM_SCRIPT_NestingLevel = 0; +static unsigned HTM_LABEL_NestingLevel = 0; static unsigned HTM_TEXTAREA_NestingLevel = 0; /*****************************************************************************/ @@ -86,6 +87,8 @@ static void HTM_LI_BeginWithoutAttr (void); static void HTM_A_BeginWithoutAttr (void); +static void HTM_LABEL_BeginWithoutAttr (void); + static void HTM_TEXTAREA_BeginWithoutAttr (void); /*****************************************************************************/ @@ -736,6 +739,58 @@ void HTM_SCRIPT_End (void) HTM_SCRIPT_NestingLevel--; } +/*****************************************************************************/ +/*********************************** Labels **********************************/ +/*****************************************************************************/ + +void HTM_LABEL_Begin (const char *fmt,...) + { + va_list ap; + int NumBytesPrinted; + char *Attr; + + if (fmt) + { + if (fmt[0]) + { + va_start (ap,fmt); + NumBytesPrinted = vasprintf (&Attr,fmt,ap); + va_end (ap); + + if (NumBytesPrinted < 0) // If memory allocation wasn't possible, + // or some other error occurs, + // vasprintf will return -1 + Lay_NotEnoughMemoryExit (); + + /***** Print HTML *****/ + fprintf (Gbl.F.Out,"